Maze Generator Game

A visually and conceptually simple unity maze game that uses 3 different maze generation algorithms to generate the mazes.

In the project, the main task was to implement different maze generation algorithms to generate game levels. The idea of the game is to control a ball through the keyboard input, and guide it through the maze towards the coin. The challenge was making sure that the maze was actually solvable.

Three algorithms were used in this project,

  • The recursive backtracker
  • Prim's algorithm
  • Kruskal's algorithm

The recursive algorithm works with a simple 2d array, where it recursively searches for walls to remove in random directions.

Prim's and Kruskal's algorithms make use of a 'cell' class, that had a row number, column number, a boolean variable to determine if it is a wall, and a parent cell.

Prim's algorithm converted the cell class into a 2d array and then cubes based on this array are spawned within the game to generate the maze.

Kruskal's algorithm uses the disjoint set data structure that I implemented myself. The disjoint set is a data structure that tracks a set of elements partitioned into a number of non-overlapping subsets.  The algorithm eventually turns the data into a 2d array to generate the maze.

Detailed documentation and the code for this project can be found on my GitHub, here.