How would you build a replay system that lets players rewatch a match, and what makes it hard?
What the interviewer wants to hear
- Two approaches: record inputs and re-simulate, or record state snapshots
- Input replays need full determinism: fixed timestep, seeded RNG, ordered updates, float consistency
- Snapshot replays are larger but robust; use delta compression and keyframes for seeking
- Version the replay format; old replays may break after patches
- Interpolate for smooth playback and support scrubbing
Model answer
There are two main designs. The first records only player inputs per tick plus the starting state and seed, then re-runs the simulation. Files are tiny, but the simulation must be fully deterministic: fixed timestep, seeded random generators, a stable update order, no dependence on frame rate, and consistent floating-point maths, which is hard across platforms. Any patch that changes gameplay breaks old replays, so you need versioning or to keep old logic. The second records state snapshots of relevant objects, such as transforms, animations and events, a few times per second, with delta compression. It is larger but much more robust and easy to scrub. I usually add periodic full keyframes so seeking to any point is fast, and interpolate between snapshots for smooth playback. Many games, including Unreal's demo system, use the snapshot style.
Can you answer it under time pressure?
Take a timed hard round and get scored on every answer.
More hard Game Developer questions
- How would you design the networking for a fast-paced online multiplayer shooter?
- Design a flexible ability and buff system for an RPG with hundreds of skills.
- How do you manage memory in a large game that ships on consoles with fixed memory?
- Explain how a modern real-time rendering pipeline draws a frame, and where the common performance costs are.
- How would you reduce cheating in an online game?
- The game averages 60 FPS but players complain about hitches every few seconds. How do you find and fix them?
- How would you architect world streaming for a large open-world game?
- How do you use multiple CPU cores in a game without race conditions and with real speed-ups?
- How would you design the backend for an online game with matchmaking and dedicated servers?