
2D Procedural Dungeon Generator
C#
1
12 weeks
‘Task to create a dungeon that procedurally generates all rooms and corridors.’
First Year Trimester 2 University Project
Grade awarded: A
Random room placement with corridor connection
Procedural Generation tool
Dungeon takes user input for size, room count, and difficulty then generates rooms by getting random coordinates and checking if there would be any overlap with existing rooms, if no overlap it generates the room.
Rooms are picked from a set of predefined rooms including a garden, library, armoury etc.
Enemies, chests and items are then placed in rooms.
Corridors are finally placed to link all rooms together. Rooms are sorted roughly on the x axis so the dungeon progresses left - right.
A*
AI Pathfinding
A* pathfinding implemented for the enemies to find the shortest path to the player, this activates once the players is within a distance threshold.
Nodes are spawned on all walkable tiles, then it checks all neighbouring tiles and measures the new distance to the target, if it is closer it checks the neighbouring tiles of the new tile until a valid path is found. This recalculates every few frames to track the target as it changes position.
Simple character controller, weapons system, health system
Gameplay
WASD movement with a small weapons arsenal demonstrating a few different weapon types. A pistol, SMG, and rocket launcher are implemented.
The player spawns in a start room and has to navigate to the end of the dungeon, there are enemies to fight through.
UI implementations include main menu, HUD, pause screen, victory/game over screens.