IT lexicon › Programming › Game loop

Game loop

Programming På svenska → Updated: 2026-10-02

The loop that drives everything in a game: read input, update the world, draw a frame, repeat.

The naive version ties the simulation to how fast the machine can draw, which was the norm in the 1980s — hence every DOS game that became unplayably fast on newer hardware. The standard fix since then is a fixed timestep: physics always advances by the same increment (often 1/60 s) while rendering runs at its own rate, with intermediate frames interpolated from the two most recent simulation states.

Keeping the step fixed is not merely cosmetic. Variable timesteps make collision detection unreliable — a fast object can tunnel straight through a wall between two updates — and make the simulation non-deterministic, which rules out rollback in networked play. Glenn Fiedler's 2004 article "Fix Your Timestep!" is still the text everyone points to.

← Back to the lexicon