Andrew Kelley

programming language

Sponsor @ $5/month

Pillagers! 7dRTS Game Development Journal

22 July 2013 - 29 July 2013

I have decided to participate in the 7-Day Real Time Strategy Challenge, July 2013 edition.

I am working with Michael Weber who will create sound effects, music, and be in charge of the "atmosphere" of the game.

Day 1

Cross-posted on

I am using chem, a canvas-based game engine I made for rapid development occasions such as this. It has been working out quite well and I think it has been playing a large role in my productivity today.

The game is codenamed "pillagers". The idea is to mix space physics with real time strategy and see what comes out. Instead of creating a carefully planned out base, you will be campaigning through levels, pillaging for resources.

That's the idea, anyway. We'll see how it pans out.

Here's a list of the things that work right now:

The code is open source, hosted on GitHub. It's 941 lines of JavaScript:

   46 src/bullet.js
   33 src/explosion.js
  432 src/main.js
   19 src/militia_ship.js
  241 src/ship_ai.js
  165 src/ship.js
    5 src/uuid.js
  941 total

Screenshot of a squad of ships under attack:

Short video of me playing around with some elements of the game

It was a fun challenge to write the AI to get the ships to stop at the intended destinations. As is it's not optimal, but I think that's okay. Maybe later classes of ships will have better AI.

You can actually play this game right now. Since it's web based, you don't even have to download anything.

Here's what the TODO list looks like currently:

Well, I'm off to bed to get some rest. Looking forward to Day 2!

Day 2

Cross-posted on has been very good to me. I think this will be my new go-to game dev art supply. So far I've found everything I've wanted on that site, except for a meteor sprite. Maybe I'll make one and contribute back.

Michael made a lazer sound and a ship thrusting sound, and I added the sound effects to the game. In addition to that, I made a ton of progress today:

Here's the title screen:

Here's a screenshot of a battle underway:

Battles can get hectic and chaotic, but it is fun to watch it play out. Here's a video of me demoing a battle:

Again, you can playtest this game in your browser right now using the same url as Day 1. Feel free to give me feedback or advice.

I came up with some ideas on what bigger picture gameplay will look like which I am pretty pleased with. There will be a bunch of different classes of ships, for example:

Basic cheap unit. Has short range. Agile. Actually doesn't shoot lazers, shoots a short range but powerful lightning attack out the front. It must resort to charging other ships to attack them.
Short range weak lazers. Less agile. Less defense. In a level, a Militia should be able to overtake a Ranger and kill it.
Slower, shoots big lazers. Slow moving, weak defense.
Does not attack. Has high defense. Moves very slowly.
Stationary lazer shooter.
Heals other ships.

There will be some obvious deficiencies with the ships targeting systems and AI. These can be helped with upgrades, such as:

You will start with only a flagship, and as you progress throughout the campaign, you will start to build up a convoy that gets ever bigger and more powerful. You'll need it to be bigger and more powerful to get through later levels, in fact.

Here's what's next on the TODO list:

I'm at a pretty good checkpoint right now. I'm calling it a night.

Day 3

Cross-posted on

Today Michael gave me the first music track he composed for the game and I am impressed. I am excited to have professional sounding music for a change.

That being said, the first thing I did after inserting the music into the game was program a mute button so that I could keep listening to techno while I coded.

Michael also delivered an electric explosion sound effect that works perfectly.

I mentioned yesterday that I could not find a meteor graphic to use on I actually did end up finding art that works really well by searching for "rock".

You can see the three rock types in the current spritesheet for the game which is autogenerated by chem:

The first thing I did today was create a electrical disintegration animation, and I'm pretty pleased with the result:

I wonder if this is considered good enough to submit to

After I finished that animation, I worked hard and had a productive day:

The source tree has grown quite a bit since last time I checked, up to 2,704 lines:

   49 src/bullet.js
   77 src/credits_screen.js
   43 src/flag_ship.js
   30 src/fx.js
   73 src/game.js
   34 src/game_over_screen.js
  178 src/level_complete_screen.js
   20 src/main.js
   81 src/meteor.js
   58 src/militia_ship.js
   91 src/physics_object.js
   82 src/portal.js
   60 src/ranger_ship.js
   37 src/sfx.js
  449 src/ship_ai.js
  177 src/ship.js
    7 src/ship_types.js
   57 src/squad.js
  933 src/state.js
   23 src/team.js
  105 src/title_screen.js
   35 src/turret_ship.js
    5 src/uuid.js
 2704 total

I actually feel pretty good about the code organization right now. I have only had to pause progress and refactor 2-3 times and each time it was mostly painless.

Enough of the technical stuff. Let's see some screenshots.

Here's one of the meteor field level you start out in:

Here's what it looks like when you finish the level:

And here's me giving a walkthrough of the progress made today:

My TODO list is getting a bit unruly. I've divided it into "next steps" and "nice-to-have"s:

Next steps:


And now I must rest. I am exhausted.

Day 4

Cross-posted on

It has been wonderful relying only upon circles in this physics engine. The math is simple and beautiful, and it's easy to write fast code. Who needs polygons anyway?

Today was a good day. Pillagers is now actually a game. What I got done:


Screencast demo:


Day 5

Cross-posted on

I spent a good chunk of the day trying to solve a performance problem. After approximately 100,000 bullets were fired, the framerate would drop to an excruciating 16 FPS.

I was able to figure it out by using Google Chrome's heap profiling tool. Here's what the heap snapshot looked like:

I found out that there was a memory leak in the game engine - every time a sprite was created it called setInterval but it did not call clearInterval when the sprite was deleted. Ever since I fixed the issue, FPS has stayed at a nice and smooth 60, no matter how many objects are created and destroyed.

Here are some other things I got done today:

Here's a screenshot of Sandbox mode:

Here's me playing through Dogfighting Mode and messing around in Sandbox Mode a bit:

I have only 2 days left to work. The last day will be primarily reserved for gameplay tweaking, bugfixes, touchups, and testing. That leaves only 1 more day to make actual progress.

These are my goals for tomorrow:

Thanks to the folks in the #7dRTS IRC channel for helping me playtest today. Specifically Zapa and Orava.

Day 6

Cross-posted on

Today I worked on making the level format and core engine more robust. I added a bunch more dogfighting levels. There are 11 now, and they get pretty crazy at the end.

The cool thing about them is that the core game engine does not even know that you are in "Dogfighting Mode". There's no dogfightingMode variable that tells the engine that's what you're doing. Instead, the level format supports trigger conditions, events, and groups, and the logic of dogfighting is done in the level JSON file.

Michael gave me the battle music today as well. It sounds amazing. I made it so that the game automatically detects when you are entering or exiting a battle and transitions the music appropriately. I'm pleased with the effect.

Here's a list of what I got done today:

I did not accomplish most of what I set out to today. Regardless, I am really happy with Dogfighting Mode right now. It's almost certainly more fun than Campaign Mode currently.

Here's a video of me playing through it:

This version of the game is going to be pretty close to the final one that I submit for 7dRTS. I will probably only spend about 6-8 more hours on this debugging on Firefox and bugfixing. I will not be supporting Internet Explorer.

Day 7

Today was short. I added more sound effects that Michael provided, and lowered the difficulty on several levels. The game is in a stable state and I don't want to screw it up before submitting.

I experimented with adding aiming hints when manually piloting a ship, but I found that it actually made the game more difficult because it tricks the player into aiming directly at the enemy ships instead of compensating for relative velocity.

I tried to make my girlfriend play the game, but she said it was too hard. It probably is too hard. I like hard games.

Either way, I'm submitting.

View my entry on

Play the game in your web browser.