Fixed vs Variable Timestep
A quick comparison between using variable timesteps and fixed timesteps made in Godot.
Beware: this comparison may not apply to native games. For example, I don't think V-Sync does anything in a Web build.
The default integration method is Semi-Implicit Euler (v += a * dt, p += v * dt). You can switch to Velocity Verlet instead and see the difference. The integration method has no effect on horizontal movement, as there is no acceleration horizontally. There is vertical gravity acceleration downwards.
Depending on whether you apply the gravity acceleration before or after you set the jump velocity, the player will either jump way too high or way too low at low framerates using Semi-Implicit Euler.
Read more about integration in gamedev at:
https://jdickinsongames.wordpress.com/2015/01/22/numerical-integration-in-games-...
https://gafferongames.com/post/integration_basics/
https://gafferongames.com/post/fix_your_timestep/
Feel free to debate the points for or against fixed timesteps. Personally, this test has convinced me to NOT use a fixed timestep and instead use a better integration method where it matters, but I understand why a fixed timestep can be better if you want more reliable physics.
Also feel free to download and check the source code.
Status | Released |
Category | Tool |
Platforms | HTML5 |
Rating | Rated 5.0 out of 5 stars (4 total ratings) |
Author | Donitz |
Genre | Educational |
Made with | Godot |
Tags | framerate, Game Design, gamedev |
Comments
Log in with itch.io to leave a comment.
5 Hz with interpolation looks really fun