top of page
Specialization

Maze Generation

The Algorithm used for generating the Maze are Depth-First Search. It starts at a random node in the new Maze grid. Then selecting nodes that are next to it that has not been selected. When there are no nodes left, then it backtracks until it is. This process will continue to run until all nodes has been selected. Then the algorithm backtracks through the route that has been generated and removes walls to make a path.

Procedural Generation & Optimization

If the player walks close enough to another Maze Node than the Current Maze Node that the player are in, Then the Program checks if that Maze Node in that direction have been made. At the same time it checks all surrounding mazes if they exist. If any of those mazes are not existing then it will be generated and created. At the beginning i had so the program generated only the maze in that direction and not the surrounding ones, but i realised that if the Player was unlucky with the Maze Generation, then the Player could see outside of the whole big maze all together and that was not my intention. Later i made it generate and create the surrounding mazes aswell

Overall overview of the Project:

In the beginning i just iterated over all existing mazes to find if the surronding mazes has been generated but after a while when a lot a Maze Chunks has been generated, the performance went down by a lot. Then i realized i could make it faster for searching through larger amount of Maze Chunks using Binary Search. Of course depending where in the List the Maze Chunk that the Program is trying to find, then iterating can be a little faster from time to time, but in overall binary will be faster when the amount of existing Mazes gets larger and larger.

  • Multi threading

Later i realised because many mazes could be generated at the same time, will affect the Performance a lot. I decided to use Multi threading, so the Mazes are generated and created on diffrent threads. Every time the program will generate a maze, it is assigning that task to a random thread.

  • Mesh Instanced Rendering

At first i just loaded a new model of the Maze Wall for every wall in newly created Maze Chunk. Afterwards i notice that the performance went down pretty quickly, more and more for every Maze Chunk that was being created. Instead The Program renders the same Maze Wall model at the Matrices where the Maze Wall is supposed to be every frame.

bottom of page