easyGame Developer interview question
What is a game loop, and why is delta time important?
What the interviewer wants to hear
- 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
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.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Game Developer questions
- In Unity, what is the difference between Awake, Start, Update, FixedUpdate and LateUpdate?
- How do you use vectors, dot product and cross product in game development?
- How does collision detection work in a game engine, and what is the difference between a collider and a trigger?
- Tell me about a game or game feature you built. What was the hardest problem and how did you solve it?
- Why do game engines like Unity and Unreal favour components over deep inheritance trees for game objects?
- How would you set up version control for a small game team with programmers and artists?
- What do you do as a programmer to make a game "feel" good to play?
- What are coroutines in Unity, and when would you use them instead of Update or async/await?
- How do you use prefabs, nested prefabs and prefab variants to keep a Unity project organised?