Shooting

Airships: Conquer the Skies
2013-10-18 11:02

The code reorg I mentioned in the last development update is now pretty much complete: the editor has been relegated to a sub-module, and work on the combat mode is underway. Right now, you can spawn two ships who will shoot at one another, doing damage, but the damage has no effect yet.

To get the game better-organised, I introduced the concept of "screens", one of which can be active at any time. The game starts out in the main menu screen, from which you can go into the editor and combat setup screens. Since pretty much everything is handled in the screens, the main game loop is now very short and sweet:

I've also created a JSON-based format to save airships, which will come in very handy for multiplayer as well. The format's pretty straightforward, though it does have to be saved and loaded in the right order: Airships basically consist of modules, tiles, and crew, but tiles reference modules and crew reference both modules and tiles, so it's not a tree structure. I solved this by using indexes where needed, so for example, a tile entry doesn't contain the entry for its module, but rather the index of that module in the ship's list of modules.

Finally, this meant that I could get on to actually making the airships fight! I decided that this would be more fun if I could quickly see the effects of the damage, so I first drew increasingly damaged versions of all the armour:

Next, I set up the combat entity and combat screen and wrote the code for projectiles being created, moving, and impacting. With some added particle effects, it's starting to look like a fight:

Next up? Right now, damage doesn't actually do anything bad, so that's the most important thing to put in. Modules that take damage should work less effectively and eventually stop working all together. Modules should catch fire, requiring water buckets, and eventually explode, doing additional damage. Crew should also be able to repair modules, and be injured by impacting shots.

Once those are in place, combat will be for reals.