Desync Recovery and Instant Replay

I’ve discovered a few unintended and exciting benefits of the key frame recording system I developed for the replay seeking.

As mentioned in the previous post, the game engine is deterministic. Or at least, it’s supposed to be. In some (increasingly rare) situations different clients can diverge, meaning they have different ideas about where things are. When this happens the game is for all intents and purposes unplayable. Although the difference may be small, like a butterfly flapping its wings, a hurricane soon develops and the behavior of other players appears nonsensical. It’s called a ‘desync’ (dee-sink).

I have added tools to help solve these bugs, and fixed many of them, but they still crop up. We’re at the stage where we have to balance the game and lock down features, which means playing the game to win amongst our friends Tim and Nart (who have been developing the excellent Assault Android Cactus). When you are halfway through a game it is extremely frustrating to have the game freeze and debug info cover the screen.

The game running on each client can now record key frames at regular intervals, and as long as they are taken at exactly the same point in time the key frames will be identical. When a desync is detected by the host, it sends a message to all clients notifying them of the fact. The host and all the clients then restore the last key frame recorded and resume the game as if nothing had happened, for the most part. There is an opportunity to make this recovery happen manually, giving me the opportunity to inspect what went wrong. I hope any released versions will be desync free, but in the meanwhile this means our play testing can run to a conclusion with only a minor interruption.

Another feature I’ve added is instant replay. This is only available when a game has been won. All players can independently decide to start watching an instant replay, which stops the simulation, switches to replay mode, and rewinds time to a key frame so many seconds before the last reactor went critical. The player can pause, skip, and adjust the rate of time as in a normal replay, allowing them to instantly dissect what went wrong or revel in their victory!

There are a few more features to add revolving around this, but I’ll write about them another time. Nick has made some new graphics for the replay HUD, see image below.