How can i make a randomly generated maze

4.3
i want to make a 3D backrooms type game where there will be randomly generated mazes- the size of the mazes can be changed thru difficulty settings- and for it to generate a maze with an exit for each level. i want this to happen ingame, so it technically has infinite hours of content lol
any help would be greatly appreciated!!
edit: basically something like https://www.youtube.com/watch?v=TaQly10bDME but with size changing, 3d and with navmesh (for enemies)

The github repository for the maze generator is linked in the youtube video you posted. This maze generator will probably give you some 2d array, a grid of data about what is floor and what is a wall.

You can then use this data to replace what this guy is doing at 02:00:

In that video he is manually painting a maze, but you want to replace the manual work with the procedural generation from the video you posted. In order to do this, you’d have to investigate what the output of the maze generator is and how to integrate it into the system from the video I posted.

As for the navmesh, you can bake one using procedural geometry: Procedural geometry — Godot Engine (stable) documentation in English
The surfacetool will probably be convenient here. However it’s going to take a long time to bake during runtime if you make large mazes.

As a first step, try loading the project from the github repository that is linked in your youtube video and see what you can do with it.

1 Like

ty!! ima try this and see if it works

also-- to fix the navmesh issues, couldnt i use the path automatically created in the maze gen? idk if its possible to convert that into a navmesh but i feel like it would save loading time

Yeah you can use the path generated by the maze generator. Either:

  1. Use the path to generate the mesh that is also used to display textures and bake the navemesh with that
  2. Create a separate mesh from the 3d map and bake the navmesh with that.

I recommend option 2 since you only need the floor for the navmesh. Each cell in the grid generates 4 vertices that will make up the entire mesh for the navmesh.