Re:Game Timers: Issues and Solutions (2012)
by meheleventyone on Tuesday August 17, 2021 @07:56AM
(#28208908)
The inner loop can take as little time as it likes to actually do the update but it is accounted in simulated time by adding 16 to the timer and accounting for that in the update by passing in 16 as the amount of time to update for.
Real time is updated once at the start of the step then simulated time catches up in 16ms increments. So you get as many update calls as there are 16ms increments to simulated time before it exceeds real time.
This is all very simple but also pretty finicky to think through. I’d replicate the code in the language of your choice and step through it.
Re:Game Timers: Issues and Solutions (2012)
by certeoun on Wednesday August 18, 2021 @02:24AM
(#28218214)
I think I finally got it now. I set myself up with roadblocks preventing me from seeing the tree in a forest.
After learning what delta time (and variable timesteps) are, I finally understood what the core issue (frame rate independence) is and why you need a fixed timestep for it.
Can't the inner while take 1 ms or 1 ns for an iteration? I don't see how the inner while's execution time is at roughly 16 ms. Okay, if my number of sub-steps is wrong, then I am really missing something here. Just trying to understand what exactly is wrong with my thinking.
It is supposed to be so simple, yet I have real trouble understanding it currently. I am basically stuck now.