1. What is a game loop, and why is delta time important?
A strong answer covers:
- Loop of input, update and render every frame
- Frame time varies across machines and scenes
- Delta time makes movement and timers frame-rate independent
- Physics often uses a fixed timestep
- Target frame budget, for example 16.6 ms for 60 FPS
Show model answer
The game loop is the heart of a game. Every frame it reads player input, updates the game world, such as movement, AI, physics and timers, and then renders the frame. It repeats until the game quits. Frames do not all take the same time; a fast PC might run at 144 FPS and a phone at 30 FPS, and a busy scene can be slower. Delta time is the time since the last frame. By multiplying speeds and timers by delta time, things move in units per second instead of per frame, so the game behaves the same on all machines. Physics usually runs on a fixed timestep instead, for stability. At 60 FPS the whole loop has about 16.6 ms, which is our frame budget.