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