It's that time again!
The Global Game Jam this year was at the Art Institute of Houston again, catered thanks to Microsoft and sponsored by the folks over at 6ft (remember Grey Goo, that RTS from 2015?)
I went in intending to explore lock step synchronization, essentially a way of allowing multiplayer games with a lot of simulated damage or movement (RTS and MOBA games generally use this) to communicate without using a lot of latency or desyncing.
What it comes down to is every client connected to the server running its own version of a simulation (where the simulation predicts actions for all AI entities on the screen, which can include zombies like those in Left 4 Dead or minions in League of Legends). Functional game data (like the coordinates, targets, cooldowns, etc. of an entity) is sorted and hashed every second or so and sent to the server. By hashing the data, a unique string is compiled for validation on the server and the client is only sending a small amount of information without having to forward its entire gamestate.
The server then compares the hashes from the clients to a hash of what the gamestate should be (either from a designated client - a "host" - or the server itself if it's running an instance of the game). If the hashes are different, a copy of the correct gamestate is pushed to the out-of-sync client.
The mistake I made when implementing this over the weekend was not accounting for latency. I only had the server check the current correct hash instead of remembering, say, the last 3 or 4 and then comparing to all of them to compensate for late hashes. The result is the more entities and players there are on the screen, the more the game lags because the server is always updating everyone with new full gamestates because after a few iterations, the hashes get desynced.
I want to rebuild this architecture from scratch again using PlayerIO. Maybe make an RTS? Maybe make a 2D (top down) Left 4 Dead style game?
We'll see. I learned a lot and, as usual, you can find the source at the bottom of the live demo page.