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

Increasing ET accuracy in fix-your-timestep

Sign in to follow this  
Norman Barrows

2313 views

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  


0 Comments


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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!