I created a "maze randomizer"
Posted: Sat Nov 08, 2014 5:25 pm
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.



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.


