Member-only story
Game DevelopmentTypescriptCanvasPhysicsSimulation Metronome Physics: Fixed Timestep Game Loops and Render Interpolation in TypeScript
Mustafa Morbel
20 min read1 day ago
--
We upgrade our variable-dt loop into a fixed-timestep, deterministic physics engine — physics behaves identically across every machine while rendering stays silky-smooth at native display refresh rates.
Press enter or click to view image in full size
Last week, I launched the exact same game on two different computers. My desktop has a 144 Hz gaming monitor; my aging laptop struggles to hit 40 FPS on a good day. I launched the ball from the exact same coordinates at the exact same angle.
On the two machines, the ball landed in two completely different places.
In game development, this is a nightmare.
A physics simulation should never depend on the screen’s refresh rate. Whether a player sees 60 FPS, 30 FPS, or 144 FPS must not dictate where a projectile lands.…