This is a demo to show a number of different ways to render a game with a fixed-timestep simulation.
You can read my article to learn more about the methods I implement in the demo. I also recommend Fix your Timestep! article by Glenn Fiedler.
This is a short overview of the most important methods in the demo:
- Interpolation: Always smooth. Needs a way to interpolate two game states, this can be a pain to implement. Always lags one tick behind - this means worse latency, especially with low TPS.
- Render Tick: No added latency, matches real time "perfectly". Very easy to implement, especially if your game state and tick is set up in a nice way. However the single render tick can get inaccurate with low TPS because each update step is linear.
- Accumulated Render Tick: More accurate in low TPS simulations, however because of the input frequency is so different between the predicted and the fixed ticks it can get out of sync.
- Set up the Odin Compiler, either from Github Releases or by compiling it yourself
- run
odin run .
from the root folder of this project. This builds and executesfixed_timestep_demo.odin
- Use WASD to move the player, space to dash and M to shoot a bullet.
- Use left/right arrow keys to change the simulation mode
- Use up/down arrow keys to change the TPS