🎮Delta Time
Also known as Frame Time, deltaTime, dt
How long the last frame took. Multiply moves by it to keep speed fair.
Think of it like
Think of it like walking by the clock, not by steps. You get there on time, fast legs or slow.
Example
Emma's car moves too fast on her new laptop. She multiplies the speed by delta time, and it is right on both.
Why it matters
Players have fast and slow computers. Delta time makes the game feel the same for all of them.
Definition
Example code
python
speed = 200 # pixels per second
x += speed * dtCommon mistake
Key takeaways
- 1Time per frame. It is how long the last frame took.
- 2Multiply moves. Speed times delta time gives the step.
- 3Fair on all machines. The game runs at the same speed everywhere.