Nothing Special   »   [go: up one dir, main page]

Skip to content

A demo app using Odin and Raylib to show different ways of simulating a game with a fixed timestep update loop

License

Notifications You must be signed in to change notification settings

jakubtomsu/fixed-timestep-demo

Repository files navigation

⏲️ Fixed Timestep Demo

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.

Overview

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.

Build

  • 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 executes fixed_timestep_demo.odin

Controls

  • 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

Credit

About

A demo app using Odin and Raylib to show different ways of simulating a game with a fixed timestep update loop

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages