Game dev
Saved & recent

Delta time

Also called: dt

Related terms: fixed timestep

The time that passed since the previous frame, in seconds. Multiply every movement by it and things move at the same speed on a fast machine and a slow one. Without it, a faster computer runs the game faster.

Physics is usually stepped with a fixed timestep instead, for example always 1/60 s, because simulations become unstable when the step size varies.

position += velocity * dt

Further reading
Glenn Fiedler: Fix Your Timestep!
60 frames/s smaller steps 20 frames/s larger steps same endpoint 0 m 0.2 seconds of game time
At 5 m/s, 60 frames per second takes twelve small steps in 0.2 s. At 20 frames per second, four larger steps cover the same metre.

View in the full Game dev collection