top of page

Maze Generation

Made in Jan/2023.
Github:

github.png
Screenshot_20230115_075817.png
Screenshot_20230115_080000.png

Team size: 1
Tools used: Unity C# visual studio (2019), Github.

Description: My Maze Generation works using an Depth First Search Algorithm which checks the amount of nodes are needed to generate the maze. From there the maze nodes start to spawn in, you can choose to make the maze generate instantly or slowly to see how the DPS algorithm works it's way through the maze. 

 

Uneven Generation:

In this project it is also possible to generate a node maze uneven such as shown in the pictures on the right. This is possible by using an tryparse method to check using booleans rather or not the maze can be generated a sertain way so it's always possible to make an uneven maze but then the algorithm crashes as soon as it tries to remove the walls on the side to make a way for the maze. For this I had to use a TryParse method which checks if left or ride or forward is possible if not it switches direction instead of crashing.

Uneven Maze.png
Uneven Maze Done.png

Code Snippets

destroysa current nodes on screen and uses a list to generate a new maze.png
choosing dirrection for nodes.png

Here you can see the code snippets of the scripts I made for this project all these scripts are also available on my Github page! 

The code you see here shows how the script counts the maze size and if there are any nodes left on the screen when you generate the maze again, it automatically clears the map and generates the new maze with the right sizes. by using a list it shows which direction is still possible to move this way the script won't crash while generating, even if the maze is uneven.

when you set the new size of the maze it will calculate the width and height. Then it uses a TryParse method to check the maze X and Y size. 

codeSnippet tryparse.png
bottom of page