Creating Mazes with Blender and BJS Update 3

Mazes created with a Blender Add on

While working on my Merlin and Morgana project I became interested in Maze creation and I spent some time wandering through history of mazes in computer games. I had never realized how far back mazes go in computer games. According to Wikipedia, the first computer maze game was back in 1959(!) The computer I gather was room sized.

The Wikipedia list describes them as “video” games so I’m not sure if text based computer games are included in the list eg. Colossal Cave Adventure . The first maze games that I played and created were probably on my Timex1000 back in the 1980s.

The maze, in various forms, became a feature of many, many games from the stone wall corridors I played in The 7th Guest to the ghost chasing paths of Pac-Man,

My young grand daughter is a fan of solving mazes and will show how I can create mazes for her also. So as a Blender user this thread will show different methods that can be used to create mazes with Blender and scripts to include in a Babylon game. The first method is with Blender addons and the exporting in the.babylon format.

The first addon I found is called Mesh Maze. Latest release is for Blender 3.2 and I use Blender 3.3. On installing it warns that it was created in an earlier version and may have problems. The add on allows you to remove the outer wall, and if you do, you can’t get it back (a 3.2 vs 3.3 problem ?). Any way, I remove that outer wall after the maze has been created and I move onto the relatively simple, but tedious, method of texturing the walls.

This page shows some examples of mazes that you can generate - though the texturing may become a problem with some of them.

And here is my result : 2 mazes.

You can view the maze from above or within, show the path though the maze, and switch mazes at will. The white sphere indicates camera position, the red sphere the end of search.

There is another add on I found Maze Generator built for Blender 3. No warnings on installation but it seems to crash if maze gets to 20x20 size.

Just the start of my exploration of maze creation.

Cheers, gryff :slight_smile:


Update 1 : Mazes from Generated SVG images with Solutions

The second approach I took to creating mazes in Blender was to use an online “Maze Generator”. It generates mazes of various types that can be saved in various formats with or without solutions. For Blender I save as an SVG file with a solution. That SVG file van be imported into Blender → converted to a path → converted to a mesh.

Once the mesh is created it can be positioned and scaled appropriately, the solution separated from the maze itself. The resulting meshes have lots of vertices which can be reduced with Mesh->dissolve vertices. Then the resulting maze mesh can be extruded vertically then solidified. The solution can be used to create the solution path by extruding a triangle along the path.

Again the texturing is an easy but tedious affair.

Here are my two mazes : 2 Mazes SVG

Same buttons usage as previous post above.

The Maze Generator also allows export in a .pdf format which I can print out and give to my grand daughter to solve (with no solution!).

Mazes are for personal use only - though it seems you can purchase a commercial license :slight_smile:

Cheers, gryff :slight_smile:

1 Like

Update 2 : Mazes with Blender Geometry Nodes and Python Script

One of the features of Blender that has grown in popularity since Blender 3.0 is the Geometry Nodes feature. So I wanted to try and see if mazes could be created in Blender using Geometry Nodes. I found a number of videos on YouTube claiming to create mazes - but none produced the results of popular maze creation algorithms. (In the image 1 below there are almost more unvisited than visited cells and the path does not wind very much!!)

Then, I found a video by someone called “StoatPaws” which uses Blender, Geometry Nodes and a small Python script (that uses the Depth First Search algorithm). Video here You will also find a link for a free download of the file he uses so no need to type out the Geometry Nodes or the Python script :slight_smile:

So here is the result : 2 mazes

Two buttons, 1: changes the maze, 2 : changes the camera from overview to play - essentially giving you a map of your progress as you switch back and forth.

More to come in near future.

Cheers, gryff :slight_smile:

Image 1 Geometry Nodes with NO algorithm


1 Like

Update 3 : Mazes created with Javascript using a few blender meshes for walls

This is not about creating the maze in Blender, but rather creating the maze in javascript and then drawing the walls and corridors with a couple of simple meshes from Blender, walls, arches and doors (see image below).

The maze is first created with a recognized "recursive backtracker" algorithm (see Update 2 for link) and then the wall and arch meshes added as “Instances

Result : Scripted Maze

Click the Camera button to switch views from the walking camera to the overhead camera and back again. The solid walls have a black material top - to help you with finding a solution while in the overhead view.

The benefit of this method is that you get a different maze every time the script runs (just “Refresh” the web page) and you could , if a better coder than I am, create a solution each time using something like the A* algorithm.

So a maze that is mainly scripting with some simple meshes from Blender.

Cheers, gryff :slight_smile:

Image : Blender Parts - vertical and horizontal wall, arches and doors.

Update 4 : New version of the add on for Blender 3.6

Can be found here : GitHub - elfnor/mesh_maze: Blender add-on to generate a maze on any mesh Just click green button (“CODE”) at the top of screen and download the zip file.

cheers, gryff :wink: