SFML community forums

General => General discussions => Topic started by: sezium on November 27, 2023, 01:25:58 pm

Title: Is deltaTime precise?
Post by: sezium on November 27, 2023, 01:25:58 pm
I'm trying to create Super Mario Bros but I think there is something wrong with deltaTime
When I change the FPS_LIMIT to 20, Mario goes higher than normal (like 20px more).
Can someone explain?
This is the code:
Title: Re: Is deltaTime precise?
Post by: eXpl0it3r on November 27, 2023, 04:22:15 pm
A simple delta time can be enough for some games and when having a consistent framerate, but it can lead to different behavior with different framerates indeed.

That's where you'd use a fixed timestep for all the physics calculations, so you can ensure a consistent movement.

See also: https://gafferongames.com/post/fix_your_timestep/