• Advertisement
Sign in to follow this  

Randomly Generated Maze

This topic is 4828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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. . .

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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




Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement