How would you procedurally generate dungeon levels that are always playable?
What the interviewer wants to hear
- Choose an approach: rooms and corridors, BSP, cellular automata, or handmade room templates
- Use a seeded random generator for reproducibility
- Guarantee connectivity with a graph or spanning tree and validate with pathfinding
- Place start, exit, keys and loot using rules and distance
- Mix authored pieces for quality and test many seeds automatically
Model answer
I usually combine authored room templates with a procedural layout, because pure randomness often looks messy. The generator uses a seeded random number generator so any level can be reproduced from its seed for bug reports or sharing. I place rooms with a method such as BSP splitting or random placement with overlap checks, then build a graph of rooms and connect them with a minimum spanning tree plus a few extra edges for loops. That guarantees every room is reachable. Then I place the start, the exit as the farthest room, and keys before their locked doors by walking the graph. Finally, a validation step runs pathfinding from start to exit and rejects bad seeds, and an automated test generates thousands of seeds to catch rare failures.
Can you answer it under time pressure?
Take a timed medium round and get scored on every answer.
More medium Game Developer questions
- Your game runs at 40 FPS but must hit 60 FPS. How do you find and fix the problem?
- How would you design a save game system?
- How would you build the AI for an enemy guard that patrols, notices the player, chases and attacks?
- How would you choose between Unity, Unreal and Godot for a new project?
- How do you make game systems easy for designers to tune without changing code?
- How would you build a third-person camera that follows the player smoothly and does not clip through walls?
- Players report that their character sometimes falls through the floor. How do you investigate and fix it?
- How would you design input handling that supports keyboard, gamepad and touch, plus key rebinding?
- Describe how you would design a reusable object pool and what trade-offs it has.