I created a "maze randomizer"

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

I created a "maze randomizer"

Post by MrChoke »

For dungeons I make, I want them to be as dynamic as I can make them. The reason is to increase replayability not just for others for but for me as well. The one limiting factor in what we can customize is the map layouts themselves. I want to have some of my levels have different paths to walk each time I play. The limitation is when you lay down a wall tile in the editor, it is a wall in game and you cannot change it at run time.

So how can I make a dynamic map? I thought of two ideas. The 1st idea is to start with a completely open map, all floor. And then you dynamically build paths. The 2nd idea is a more controlled version of the 1st and that is what I went with. You specify all possible paths in the map and you tell the game which areas of the map you want to "link" to. The requirement is that the finished map must link all places you specify without making any extra paths to do it. It will use a subset of the paths you specify from the map layout and just enough of them to link the rooms, no dead ends. After the paths are done, it spawns invisible walls, wall textures and calls setAutomapTile() to close off paths not used for the run.

So I got it working. In doing this I can truly say I know LUA now. I am a C++ and Java guy and was brand new to LUA and modding until now. LUA is a very different animal to say the least.

Below are screen shots of the map layout (it can be almost any layout you want). Note how there are far too many open paths than you would want in-game. Then I show two different "runs" of what the game actually chose. You will notice that in my map I have 5 2x2 rooms and 4 exits. The maze randomizer MUST link all of these to work.

Image

Image

Image
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: I created a "maze randomizer"

Post by NutJob »

~bows to the master~ Impressive!
MrChoke wrote: LUA is a very different animal to say the least.
You can say that again (came from C++ myself).
User avatar
Lark
Posts: 178
Joined: Wed Sep 19, 2012 4:23 pm
Location: Springfield, MO USA

Re: I created a "maze randomizer"

Post by Lark »

Very nice! I can't wait to see where you go with this... it has lots of potential! -Lark
Ixnatifual

Re: I created a "maze randomizer"

Post by Ixnatifual »

I suspected you were up to this type of shenanigans. Good job!
Post Reply