Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Increasing ET accuracy in fix-your-timestep

Sign in to follow this  
Norman Barrows


Increasing ET accuracy in fix-your-timestep

The typical implementation of fix-your-timestep looks something like this:while ! quitgame { start_timer render ET = elapsed_time process_input update_all(ET) }
But to run physics at a constant speed, what you really want is the elapsed time since the beginning of the last update - not just the time spent rendering.

Which would lead to something like this:start_timerwhile ! quitgame { render process_input ET = elapsed_time start_timer update_all(ET) }
Here ET captures the total elapsed time since the last update - except for the time required to start the timer - IE saving the current value of QueryPerformanceCounter.

Happy coding! :)

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!