VIDEO PREVIEW (Depth of 6 (so its HUGE) and a wait() so it wont timeout )
Hey there, I’ve recently been looking at various maze games, which don’t tend to have much variation in gameplay, by that I mean the mazes are usually the exact same every time just with a big creature following you, or the mazes change by a few walls.
So, I began experimenting with “generative” mazes and I believe I’ve found a possible way to spice up Maze Games, or possibly Dungeon Games.
The method I’ll be talking about uses some semi-simple math.
Firstly, the fractal recursive equation known as the “Hilbert Curve”, a space filling fractal used in an area with a Height and Width that are equal and powers of 2.
Once used, the equation should generate a “Path” of sorts, it should hit every space in the given area.
Using this “Path” you can follow it with some simple logic that does the following:
-
Gathers ALL (or just Right/Left/Up/Down) parts
-
Filters out ALL parts that occur previously in the path generated earlier
-
Chooses a random part from the remaining parts
Once you do that recursively (so re-using the most recent part to get the next one) you should have a random path.
Here are some visuals!
Hilbert Curve Path:
Chosen Path:
Now, a second test:
Hilbert Curve Path:
Chosen Path:
As you may notice, the paths that are generated SHOULD be different.
In context to a maze/dungeon game, the gray points represent closed off areas whereas the yellow points represent open rooms, so the gray would be walls and the yellow would be the open path
If you’d like more information or some code snippets, please feel free to comment on this post!
Sorry if this post wasn’t constructed 100% accurately or some information isn’t perfect, it was rushed <3