Boarding Three

Airships: Conquer the Skies
17 Sep 2014, 2:22 p.m.

In the last two installments on boarding, I covered all the phases of boarding except for how to get your crew across from your ship to the enemy's. The marines are able to leave your ship and hang on to the outside, and once on the other ship, they can enter and start fighting. What remains is the leap across.

This means the marines need to figure out where to jump from, and in what direction, to end up landing on the enemy ship rather than plummeting to the ground. This is a projectile trajectory calculation - which is pretty much what computers were made for originally. One short trip to Wikipedia and I had the correct formula to calculate the angle of launch for a particular target position.

To find a suitable jumping spot, marines examine likely locations on their current ship. At each such potential jumping spot, they attempt to do the trajectory calculation for a bunch of locations on the enemy ship. Assuming they find a place where it's safe to jump across, they move towards it. I pretty heavily constrained both the jumping-off and landing spots each marine considers, since otherwise the number of possible trajectories to consider would be huge: tens of thousands, potentially.

Once a marine arrives at a suitable jumping spot, he makes the trajectory calculation and then jumps in the resulting direction. There's no guarantee that the jump will succeed, of course - if the enemy ship moves at just the wrong moment, he might fall to his death.

At this point, the boarding sort of worked, with marines moving between ships and making nice jumps, except that they were still magically phasing through solid walls. It was time to introduce a minor new game concept: hatches. Until this point, airships simply didn't have doors. The question of how crew and supplies actually got into the ship wasn't really relevant. But now, with boarding, I wanted ships to have specific points where they were vulnerable to enemy marines coming in.

Hatches are pretty simple: certain modules, such as crew quarters and ammo storage, now have a supply cost that has to be met by hatches or large cargo doors somewhere on the ship. This means that the larger the ship, the more points of entry it must have. But you are free to put the hatches where you want - specifically, you can put them well away from the parts of the ship vulnerable to boarding, and perhaps right next to a barracks!

Having added hatches, I then limited the ability of crew to move between the inside and outside of ships to places where there was a hatch or a hull breach. Finally, I added pathing code so that the crew would find such a spot when needed. Now the cycle was complete! When given the order to board, marines would move inside their ship to the nearest hatch, pop out to the outside, move along the outside to a jumping-off spot, jump across to the enemy ship, move along the outside of the enemy ship to the nearest hatch or hull breach, enter the ship, and start fighting.

This concludes part three of the series on boarding. There will be one final installment, dealing with cool extra stuff I needed to add: guard posts and grappling hooks.