Sign in to follow this  
ImperfectFreak

Randomly Generated Maze

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this