Jump to content





Now With Mazes

Posted by vdub_bobby, 06 February 2012 · 674 views

BEEN PRETTY BUSY WITH RL over the last week, but found a few hours here and there to work out the code to generate mazes programmatically:
Attached Image Attached Image Attached Image
Attached File  TankMaze20120205.bin (4KB)
downloads: 58

To my surprise, I was able to get something working that actually doesn't look too bad. The algorithm is roughly based on the so-called "sidewinder" algorithm, though with some tweaks. To geek out about this for a minute, it is a pet peeve of mine that every maze-generation algorithm i've ever seen always works on the assumption that the walls have no width, and it takes a lot of hacking and messiness to get them to work with mazes where the walls have width. But anyway, after a lot of hacking and messiness I did get it to work, and it ain't too bad. ;)

EDIT: Forgot to mention :dunce: press RESET to switch through mazes.




Looks very good - I assume you have 8 seeds hardcoded at the moment?
How are you going to protect the home base - will this have a wall around it also?

Chris
  • Report
Here is a semi-random Pac-Man-ish maze with 4,096 possible combinations:

http://www.atariage....maze-test-2011/

Just hit reset for a new maze.
  • Report
it is a pet peeve of mine that every maze-generation algorithm i've ever seen always works on the assumption that the walls have no width

Yep, I ran into the same issue when trying to create mazes for Skeleton. I ended up creating my own algorithm to fit my particular requirements (e.g. no open areas & wrap around).

One trick I used is to have two starting points for the "random walk" which then became the starting points for the player and the skeleton. You might want to do the same.
  • Report
Not sure about protecting the base. As the kernel is written, it isn't possible to have walls to the left/right of the base. My plan was to leave it completely open, but that might make the game too difficult.
  • Report