Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is deltaTime precise?  (Read 260 times)

0 Members and 1 Guest are viewing this topic.

sezium

  • Newbie
  • *
  • Posts: 1
    • View Profile
Is deltaTime precise?
« 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:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10779
    • View Profile
    • development blog
    • Email
Re: Is deltaTime precise?
« Reply #1 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/
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/