🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Avoiding Framerate Dependency.

Started by
2 comments, last by frob 3 years, 5 months ago

What are some of the best ways I can keep my game from being framerate dependent? I know it's not a good thing to do, but I have no idea any way to avoid the issue.

Advertisement

Conceptually, don't have a single loop doing both game-progress computing and rendering.

Instead, have 2 loops. One loop that updates the game data, and one that does rendering. A great article about it is

https://www.gafferongames.com/post/fix_your_timestep/

If you are using an existing game engine like Unity or Unreal, the engine provides it as an option out of the box.

In Unity this can mean functions like Update() and FixedUpdate(), with Update() being run every frame (usually), and FixedUpdate() run at regular intervals regardless of framerate. In Unreal this can mean Tick() and enabling/disabling the Tick Substepping options and tick rate options; by default it runs every frame but can be adjusted to run at frequencies better suited to you, either with substeps that are smaller, or custom tick rates longer/slower than a frame. Or it can mean implementing something yourself that adjusts how often they are run.

This topic is closed to new replies.

Advertisement