Skip to content

Instantly share code, notes, and snippets.

View rcmagic's full-sized avatar

Chase LaCas rcmagic

  • Shobu Games
  • Lexington, KY
View GitHub Profile
Readme: In the following pseudo code, [] indicates a subroutine.
Sometimes I choose to write the subroutine inline under the [] in order to maintain context.
One important fact about the way rollbacks are handled here is that we are storing state for every frame.
In any real implementation you only need to store one game state at a time. Storing a game
state for every frame allows us to only rollback to the first frame where the predicted inputs don't match the true ones.
==Constants==
MAX_ROLLBACK_FRAMES := Any Positive Integer # Specifies the maximum number of frames that can be resimulated
FRAME_ADVANTAGE_LIMIT := Any Positive Integer # Specifies the number of frames the local client can progress ahead of the remote client before time synchronizing.

Note: This is excerpt from a larger document and does not contain the introductory material required to fully understand all the concepts listed below.

Determinism

Now I wish to dive into the concept of determinism in our game. For us, determinism means that the game state is entirely determined by the behavior of the game tick.

Let's think carefully about what can effect the