Kaillera Game
Represents a game instance on the server.
Synchronization Handshake
The game uses a lock-step synchronization model with an initial handshake to establish lag compensation. The handshake consists of three phases verified by E2E tests:
Buffering (Frames 1-6): The server buffers incoming packets from the client to build up a delay buffer (determined by
totalDelay). During this phase, the server sends back "Zero Packets" (packets of the same size as input but zeroed) to the client.Draining (Frames 7-12): Once the buffer is full, the server begins "draining" the buffer. It processes and fans out the old packets stored during Phase 1. Crucially, strictly "new" inputs received during this draining phase are DROPPED to allow the stream to align with the buffered history.
Synced (Frames 13+): The buffer is now managing the flow. The server fans out packets in real-time order, effectively delayed by the buffer size.
Received[T] == Sent[T](relative to the shifted timeline).
Constructors
Properties
The total duration that the game has drifted over the lagstat measurement window.
Record of all game log events.
Whether the game is holding data for the current frame, waiting on one or more players before fanning out.
If waitingOnPlayerNumber[playerNumber - 1] is true, we are waiting on data for that player.
Functions
Adds data and suspends until all data is available, at which time it returns the sends new data back to the client.
Checks if any user has a full set of new data to send.
Sets the game framerate for lag measuring purposes.