Starting on boarding

Airships: Conquer the Skies
1 Sep 2014, 10:37 a.m.

I'm now getting started on airship-to-airship boarding, which is the major new feature in the next development release. With boarding, you can send air marines to enemy ships to disrupt them and even take them over.

The actual sending over part is a bit tricky, because crew members move inside the grid of their airship. This means there is currently no way to represent someone not inside a ship. To allow air marines to jump or glide or grappling-hook across the gap between two ships, I will have to introduce a second system of tracking people's position. The second system will be in the same coordinate system as the ships itself, and will have to deal with physics, collision detection, etc.

So for now, I'm just going to ignore all that and make the crew teleport over! I even added a completely pointless particle effect for it.

Why? Because I want to get to the more fundamental part first: what happens during boarding?

Air marines boarding an enemy ship should try to disrupt its operation, and if there are enough of them, even take it over. These two goals are somewhat at odds, since the fastest way of disrupting an airship would be to make its suspendium chambers stop working, making it fall out of the sky. But I doubt that the air marines would be inclined to make the ship they're in crash. Instead, I decided that the marines will target weapons systems, propulsion, and command centers, rendering the ship harmless but still afloat. So once an air marine has boarded a ship, he will path to the nearest "interesting" module - a gun or propeller or bridge, and start shooting the crew in there.

The other question is how taking over a ship happens. Airships are complex entities, so what does it mean for one to be taken over? The rule I decided on: if there are no crew members of the current owner in any of its command centers (bridges or cockpits) and at least one crew member (air marine) of the opposing side in a command center, the ship's owner flips. The invading marines get added to the crew list while any surviving defending marines are now considered the new invaders. The normal air sailors are set to be "under occupation", which means they will only perform a subset of duties needed to keep themselves alive: they will put out fires and run suspendium chambers, but nothing more. The occupying air marines will have to do any fighting duties.

Having figured things out, it was time to start building!

Air marines will have to perform normal crew duties in occupied ships (and they can also help out in your own), so they should be a type of crew. So first off, I introduced a concept of "crew type" to distinguish between marines and sailors. These have different sprites and different competencies: sailors are more efficient at working in airships, but much weaker in combat.

Next, I added a new module type, the barracks, which was pretty straightforward.

The game also has to keep track of whether someone is on board a ship as an invader or as a crew member, so I added a separate list of boarders, and got to work on rewiring the crewmember and airship classes to make this difference clear. A lot of questions like "how many crew are in this ship" had to be made more precise.

Next, I implemented a "board" command for airships, borrowing liberally from the existing "target" command and fiddling in GIMP until I got a decent-looking grappling hook for an icon.

So I got to the first tests: the marines would teleport over to random locations on the other ship - and then just stand there, going "Oh, that is a nice cannon you have here. And it is indeed shooting at my ship. oh well, carry on!".

I needed them to actually go and do some mayhem, so next up was pathing: identify the modules of strategic interest and move there. Pathfinding was already available from the code for air sailors, so this was pretty quick. And of course, once they got to their targets, it was time for them to shoot things!

The game already has a concept of shots from ship-to-ship fights, so I reused and extended this. It's cleaner than introducing another mechanic, plus it potentially allows for things like boarders shooting ships, ships shooting boarders, etc. This meant extending the shot class so it can come from a crew member as well as a weapon, and differentiating whether it comes from inside the ship or not. (Shots from inside the ship don't get held up by armour.)

Now I just had to tell boarders to shoot crew and vice versa, and a fight for the ship finally happened! And, as it turns out, a rather silly bug: I forgot to tell marines that they can't move when badly injured or dead, so now I had casualties and corpses sliding around on the floor and impossibly climbing ladders while prone, slowly moving to the next place to conquer.

Having fixed that, combat now proceeds reasonably: the boarders go and shoot up the bridge and cannons of the enemy ship, weakening it. Next up will be the takeover phase: boarders converging on the bridge, and the ship's allegiance switching over.

No doubt boarding will need a lot of balancing work. Right now, it feels way too powerful, but this may be because it's very easy thanks to the temporary teleporting. In the end, boarding should be one tactical option in your arsenal that works in certain circumstances, much like ramming, sniping with rifles from high up, grounding your ship, forcing down an enemy, and so on.

Join me next time when I put in the ship takeover mechanic and start figuring out how to make the marines move between ships!