Strategic Multiplayer Dev Log 2

Airships: Conquer the Skies
19 Dec 2017, 5:43 p.m.

So after the initial rapid success of getting conquest multiplayer to work, it was time to see how much the multiplayer really kept in sync. It looked like it was in sync, but not every small divergence would be visible, and those small divergences could spiral into larger ones.

As an aside, idle googling has just led me to a horrible discovery: The daft Ashton Kutcher vehicle The Butterfly Effect somehow spawned two sequels. Yay.

Anyway, to make sure that the versions of the world on multiple players' computers were exactly the same, I wrote a checksumming system. At regular intervals, the system would take the game state, save it to disk, and take a checksum of it. It would add this checksum to a backlog, and send it across to the other players.

Upon receiving a checksum, the system would call up its own checksum for that point in time from the backlog. If the checksums disagreed, it would output the point in time where this divergence had happened and exit.

This system was very useful, as it let me do a detailed comparison (a diff) between the game states at the point of divergence. It also created a vast amount of data, because it had to write a full save game multiple times a second. It will definitely be deactivated for the release!

And indeed, it led me to find a number of problems: The names of pre-generated ships didn't match. That one was easily fixed. Another problem was that the road data wasn't quite the same, which turned out to be because the game wasn't looping over city pairs to build roads between in a consistent fashion. Looking for other such inconsistent loops also let me find what would have been a rare and subtle bug in the monster nest code.

So with the game state looking synchronous, what's next? Well, it's all the unglamorous GUI stuff. Allowing players to choose the map size and difficulty, their empire name and their coat of arms. A chat system.

Then, allowing for multiplayer conquest games to be resumed, which turns out to have lots of corner cases. What if the game is resumed with a set of players that isn't clearly identifiable as the previous players? Or with more or fewer players. What if someone exits setup at a weird moment?

I'm still working on getting all of these scenarios figured out and accounted for, but a basic GUI for resuming games exists.

And once that's done, I can make available a very early version of multiplayer conquest. It will be very rough: you can't design ships, or look at city defences. Combats start right away with no setup phase and no warning. There's no diplomacy beyond what happens in the chat. The world setup is probably really unfair. But it's something that can be tried out and iterated upon.