Generating Mazes
healeycodes.com
Generating Mazes
1–10 of 33 posts
Re: Generating Mazes
#2Re: Generating Mazes
#3https://weblog.jamisbuck.org/2011/2/7/maze-generation-algori...
Code for generating mazes in different languages can be found here:
Re: Generating Mazes
#4I did some searching, and the paper at [1] (2022) studies the problem. Based on the paper, a naive combination of the two algorithms can generate uniform spanning trees on complete graphs, but more work is needed for arbitrary graphs. [2] apparently cites this when discussing their hybrid maze generating algorithm, but I haven't been able to find a copy to check.
[1] https://arxiv.org/abs/2206.12378 [2] https://www.spiedigitallibrary.org/conference-proceedings-of...
Re: Generating Mazes
#5For those interested in maze generation, I highly recommend "Mazes for Programmers": http://www.mazesforprogrammers.com/
I've been posting my progress with it on mastodon. Generating animated GIFs of the generation and traversal to solve it has been a whole fun sub-topic I've been working on too. I render each computation step to a PNG, and get ffmpeg to build GIFs or MP4s.
https://mastodon.social/@lloydjatkinson/media
The same author also has a book on raytracing. My wife got me both books for Christmas and I didn't realise just how much building/hacking/creativity/fun I'd get out of them.
Re: Generating Mazes
#6i wrote a minimal roguelike a couple of weeks ago in forth: http://canonical.org/~kragen/sw/dev3/wmaze.fs (2-minute asciicast at https://asciinema.org/a/672405, or you can run it in gforth) and tried to generate the level as a perfect maze with an algorithm related to these, but just visiting the walls in a random order, which doesn't produce an unbiased maze
however, in rogue, and in wmaze, walls occupy a whole grid cell. so i decided to remove walls unless they either connected an open cell above to one below that it was already connected to, or an open cell to the left to one to the right that it was already connected to, because i had decided to not permit diagonal movement. but this turned out to have two unexpected effects:
1. sometimes it would connect a cell, say, to the left with one above it that it was already connected to. this results in a maze that isn't quite perfect, which i think is an improvement
2. sometimes a cell will occur with walls on all four sides of it which are not removed. this is fine unless treasure or the player spawns there, in which case the game is impossible
so i need to tweak the algorithm, but i otherwise really like the meandering mazes it produces, and i think the extra connections from point 1 above give the dungeons a desirable nonuniformity and keep the mazes from being too difficult
visiting walls in random order has the same effect as prim's algorithm with random weights (or equivalently kruskal's), but in my case obviously i broke that correspondence because my walls aren't graph arcs. i can recommend doing that on a proper graph as a perfect maze generation algorithm, which is what i did in 02018 in http://canonical.org/~kragen/sw/dev3/unimaze.go, which is much more readable, if a bit repetitive and longwinded
Re: Generating Mazes
#7https://www.amazon.com/Olavsweg-Gedichte-Gedanken-lyrische-I...
Re: Generating Mazes
#8I've generated mazes for the cover of my poetry book https://www.amazon.com/Olavsweg-Gedichte-Gedanken-lyrische-I...
Re: Generating Mazes
#9Re: Generating Mazes
#10Ok, after rereading I think I'm starting to understand. The walls of the cells are generated after, based on the path the generator went through? I feel stupid for not understanding this later but will leave this in case I still don't understand something