Game Loop Fixed Timestep: Steps per Frame and Interpolation Error (2D)
The same shared game loop model in 2D: a spring with a crate, a queue of physics steps per frame, and live plots of rendered versus exact position, backlog and energy.
Drive a spring-mass oscillator from a game loop and see why engines use a fixed physics step. Feed it jittery frame times, change the step, the cost of one step and the frame cap, and watch the accumulator decide how many steps run each frame, interpolation smooth the leftover fraction, and the spiral of death start when a step costs more than its own duration. Compare with a variable step and unstable explicit Euler, with numerical checks built in.
The same shared game loop model in 2D: a spring with a crate, a queue of physics steps per frame, and live plots of rendered versus exact position, backlog and energy.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install