Refactored all of the periodic tasks and TTimers into a single "main loop" in TKMMain.DoIdle. It handles:
Game tick
Render
UpdateState
UpdateStateIdle
Sleeping until the next deadline when there's nothing to do
Periodic tasks like game ticks and render are scheduled so they occur at a consistent interval and we don't lose time (time slip) like we were with TTimer.
This code will not attempt to "catch up" if we something takes too long and we miss the scheduled tick (it will simply skip ahead to the next future tick schedule). The existing code in TKMGame will take care of catching up lost ticks, however it should now only occur when processing takes too long and we miss a tick.
This fixes the "jumpy" movements every ~1 second when interpolated render is on, which was caused by the TTimer not firing at a consistent rate and the "catch up" logic running two ticks at the same time to compensate.
Refactored all of the periodic tasks and TTimers into a single "main loop" in TKMMain.DoIdle. It handles:
Periodic tasks like game ticks and render are scheduled so they occur at a consistent interval and we don't lose time (time slip) like we were with TTimer.
This code will not attempt to "catch up" if we something takes too long and we miss the scheduled tick (it will simply skip ahead to the next future tick schedule). The existing code in TKMGame will take care of catching up lost ticks, however it should now only occur when processing takes too long and we miss a tick.
This fixes the "jumpy" movements every ~1 second when interpolated render is on, which was caused by the TTimer not firing at a consistent rate and the "catch up" logic running two ticks at the same time to compensate.