MGMattia Golino.

Apple Developer Academy · Degree thesisCase study

Rob: The Game: procedurally generated levels.

A first-person shooter with roguelike elements, where level structure is built from a grid of cells. My main contribution was the random dungeon-generation algorithm, based on randomised DFS and backtracking.

Apple Developer Academy2023Unity · C#
Original Rob: The Game gameplay screenshot, normal level

Original gameplay image from the degree thesis, in the project section.

Grid + graphMap representation
DFSRandomised traversal
StackBacktracking
01 / The game

An FPS with roguelike structure.

Rob: The Game is a first-person doomer shooter developed with Unity as an Apple Developer Academy project and explored further in my degree thesis. Players move through levels made of connected rooms, fight enemies and bosses, and collect resources and items to progress.

02 / Algorithm

Generate a dungeon, not a predefined map.

The map is modelled as a grid of cells. Rooms represent graph nodes and corridors represent the edges connecting them. The algorithm explores the grid with Depth-First Search (DFS), randomly selecting neighbours and using a stack for backtracking.

Initialise the board

Create the grid, choose a starting cell and mark it as visited.

Explore neighbours

Check adjacent unvisited cells and select one at random.

Backtrack

Store the current path on a stack. When no neighbours remain, step back until another branch can be explored.

Build the rooms

Use visited cells to instantiate room prefabs and configure walls and doors.

The thesis also describes an initial randomised DFS version and the subsequent adoption of backtracking to handle dead ends and resume exploration from cells with remaining options.
03 / Implementation

From a sequence of cells to a Unity scene.

The generator goes beyond graph traversal: it turns the resulting path into a scene made of GameObjects and prefabs. Room configuration exposes the correct openings and prepares the elements required by the level.

DungeonGenerator

Search and construction

The thesis describes a flow based on creating the board, finding neighbours, managing the stack and generating rooms from visited cells.

The methods discussed include MazeGenerator, CheckNeighbors and GenerateDungeon.

DungeonBehaviour

Room topology

Each room uses GameObject arrays for doors and walls. The UpdateRooms method receives the values that determine which elements should be visible based on the generated path.

04 / Integration

The dungeon as part of the gameplay.

The generated layout is connected to game systems: player position, minimap, boss room and the distribution of items and enemies.

Level setup

Spawn and minimap

Generation determines a player position, initialises the minimap and disables enemy spawning in the starting room.

Dynamic content

Boss and items

The boss room is prepared next to the final room in the path. Items in the rooms are generated and positioned randomly.

This case study focuses on the dungeon generator, which was my main individual contribution. Other mechanics are described as part of the overall game.
05 / Contribution

My contribution: procedural generation.

My main responsibility was the algorithm for random dungeon generation, based on randomised DFS and backtracking. This case study explores that component without attributing the entire game development to me.

Personal responsibility

I worked on the core of level generation.

My contribution focused on the logic that explores the grid, selects connections between cells and backtracks when a branch reaches a dead end. The resulting structure is then used to populate the scene with rooms, passages and content.

Depth-First SearchRandomised neighboursStackBacktrackingProcedural generation
06 / Technology

Technologies and tools.

The game and its generator were developed with Unity and C#, using engine components for scene construction and agent navigation.

UnityC#MonoBehaviourGameObjectPrefabCoroutinesInput SystemNavMesh SurfaceNavMesh AgentApple GameKit
Technical source: degree thesis, Chapter 3, especially Section 3.4 on random map generation (pp. 50–58). The screenshots are taken from the original project documentation.