Codesnippets > Code Snippets

2D maze generation algorithms...

<< < (2/2)

dreamerman:
Just for testing I have added modified version of Prim algorithm to generate more straightforward maze - tiles can be either empty/passable or blocked, it may simplify uses in some cases and shows how easily it can be modified.
Another thing that could be interesting for more complex algorithms are tunnels, yet it would complicate drawing, as such should be easy to differentiate from dead ends - just matter of proper sprites.

Qedo:
Very interesting dreamerman here there is to study hard  :nw:
I didn't think there were so many algorithms on this topic
Thanks so much for sharing :booze:

dreamerman:
There are more of them but quite similar, some completely inefficient, and some have slightly different use cases like mazes on infinite maps, but it's good to see how they works and adopt something from them to proper game oriented code.
Of course more interesting are different shapes of cells and grid itself, for example circular maze - polar grids, but this would require vector drawing routines, I know that there was some small lib for that here on forum, but at moment I've other priorities. Yet I will try to add some simplified maze generation routine for 3d cube, it shouldn't be hard.

Navigation

[0] Message Index

[*] Previous page

Go to full version