This Website Lead Tracker Demo Python Game JavaScript Particle Sim C++ Embedded Design
Lead Tracker
Contact Info Certifications Resume LinkedIn

Demos▸​
3. Python Game

In 2014, I was feeling creative and wanted to create a game. I was really enjoying the genre of idle/upgrade games that just came out (like Cookie Clicker). I especially liked the gameplay mechanic of exponential expansion, where every bit of progress helps you become more effective at achieving even more progress even more rapidly. Inspired by some other similar strategy games at the time, I created the game you see here called Swarm, which is about swarming your enemies, taking over other planets, and expanding your empire.

But which programming language should I use? I had used various languages/environments in the past that focused on video-game development, such as Blitz Basic, but unfortunately these languages fell into relative obscurity later on, discouraging me from going back to improve or even play them. I had worked a lot with C++ as an undergrad, and even developed a few games, but it always seemed to be an overly cumbersome environment for game design. Finally, throughout my graduate career, I had been working with Python a lot more, usually to develop scripts for data parsing/analysis. Python was obviously an incredibly easy and intuitive language to use, but I was worried about it's ultimate performance capabilities and amenability to game development. After a bit of research though, I discovered that the language had advanced a lot since I first learned about it, was seeing wider and wider adoption for tasks beyond just scripting, and had a slew of great libraries to help with all sorts of things, including Pygame for easily making video games.

So using Python, I created some interesting mechanics, some basic AIs to play around with, and a few demo levels. Unfortunately though, my attention eventually drifted to other projects/work, and I stopped working on it after the first few months. More recently, I decided to show it here publicly, so I went back into the code to clean some stuff up, update it to Python 3, and set it up with a decent set of 8 levels to show everything off in an easy way. You can download the code off GitHub here to start playing the game and/or experimenting with the code. You can read the included readme file for instructions on how to get started. Using the included launch script with command-line options, you can select what Ais you want to fight, choose what level you want to start at, and then launch a game window to start playing.

Gameplay

The goal of the game is to take over planets until you're the only one left. Every planet under your control generates fighters. You can send these fighters to enemy planets to fight and take them over, or send to your own planets for reinforcement. When starting a new level, you and your enemy will have small armies with only 1 or 2 planets. There will also be many other neutral planets just waiting to be conquered. Expand your empire rapidly by prioritizing larger, closer planets with fewer supporting fighters. The more you grow, the faster you can conquer new planets and grow even faster. But be careful, because your enemies will be doing the same!

Controls

  • A, W, S, D ➜ Pan the view around.
  • Q ➜ Slow down time.
  • E ➜ Speed up time.
  • Left Mouse ➜ Click to select/deselect a planet. Drag to select a group of planets. Double click in empty space to deselect all.
  • Right Mouse ➜ Click to send fighters from the selected planet/s to another planet.
  • Left Shift ➜ Hold to keep the selected planets even while selecting or deselecting anther planet. Useful to grow or selectively shrink your selected group.

Helpful Tips

Here's some more helpful info on some things you'll find in the game.

Planets

The bigger a planet is, the more fighters it can support and the more quickly it produces them. The growing bars around a planet indicate how full it is. At 75% capacity, the bars start pulsing, indicating that fighter production is halved because the planet is so full. At 100%, production stops. If reinforcements arrive to push a planet beyond its capacity (indicated by the new white bar on top), they will quickly die off due to starvation.

When you tell a planet to send its fighters, half of the fighters will be sent, leaving the other half to stay behind and defend the planet. You can send multiple groups rapidly to send almost every fighter. Be careful though, as this may leave the planet undefended against a counterattack.

Lasers

Sometimes planets will have lasers, which will destroy fighters if they get the chance. Lasers on neutral planets will target all fighters, but if you conquer the planet, then its lasers are your and will only attack your enemies! Lasers vary in their power, range, and speed, so you'll need different strategies to either avoid or attack them.

Walls

You'll also encounter walls out in space (somehow a thing), that destroy any fighters that cross their paths. The walls have a certain health though, so if you pull a Zap Brannigan and send enough of your fighters to their doom, you'll eventually defeat the wall. Whether that's an acceptable cost or not is up to you. You can tell how close you are to defeating a wall by observing how infrequent and weak its lighting arcs are.

Navigator
Table of Contents
Table of Contents