Increasing ET accuracy in fix-your-timestep

posted in Gamedev info
Published February 03, 2017
Advertisement

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! :)

1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement