Randomly Generated Maze

Started by
4 comments, last by RPGeezus 19 years, 4 months ago
Im trying to make a randomly generated maze, but am having a great deal of diffuculty. . .I have no idea where to start could someone give me and idea. . .
Advertisement
I never thought about this...

I'll give it a shot.

How about, you create an empty map, define the start and end points randomly, then start with one path from the start point and start defining a path radomly. Then randomly fork the path into two or three paths, do this until you can't draw anything anymore.

Now you can't draw anymore, BUT some air pockets might have remain, so you backtrack the paths back to the origin a step at a time, if you find an empty space next to a path you start generating random paths from that point, until you can't anymore and backtrack again. When you backtrack ALL paths back to the origin, you should have an intire maze map(i think).

In the end if the exit is blocked by some wall, just delete it.
The tutorials discussed in this thread might be of some help. If they don't give the results you want, I could explain some other methods, but really you should be able to find all that you need using Google.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
It depends what kind of maze your trying to make. You could use the perfect maze algorthim to create a maze that has only one path between any two points.
roguelikedevelopment.org probably has a couple of articles about maze generation.
Ad: Ancamnia
It depends on what type of maze you want to make.

I have an _old_ electronic Dungeons and Dragons game that I reveresed engineered one day. It is a special type of maze where each square is accessible from any other square.

The maze algorithm it uses looks like this:

---
Each square in the maze has either a west or south wall.
For each square, randomly turn on the west OR south wall, but never both.
---

You can adjust the odds of either wall being on to change the openness and type of maze. A high probability of a wall will make a maze with lots of corridors. Lowering the probablility of a wall will create 'room's.

You'll need to tweak the algorithm to make the edges of your maze work properly.

Before you laugh at the simplicity give it a shot. It makes nice mazes.

Will




------------------http://www.nentari.com

This topic is closed to new replies.

Advertisement