Step 5: Map Arrangement
Now when we have all the required Maps, we need to arrange them. All we have to do is to make the Space Map become the parent map of the maps we created in this tutorial. As soon as the player enters the Space Map, the plugin will scan its child maps and load them.
Each Space Map owns only the Snippet Maps which really belong to the individual dungeon. When you want to add a whole new generated dungeon, create a new Space Map and move all its required maps below it.
Step 6: Start Command
Finally, we can write the event command to start the generator.
To keep our project and events more tidied up, we decide to use Common Events here. Let’s create a new Common Event (in the Database) and call it “generate Dungeon”.
MV & MZ
MZ only: Plugin Commands
This Plugin provides a set of Plugin Commands. We are going to use more than only one to generate a Dungeon. Fortunately, the commands are sorted in the way we need to call them. Below you see the list of Commands that we will do.
In this Tutorial, we start with the “Create Maze with Finetuning” Command. You can play around with the parameters if you wish.
The merge dead ends function helps to lower the number of dead ends in the maze while it creates new tunnels between dead ends and other parts of the maze. This also leads to circulations in the maze and the fact, that there will exist more than one way to the escape. Experts call this an imperfect maze. The parameter sets the probability that a tunnel will be made, while 1.0 means everytime and 0.0 means never.
The cut off dead ends function will (as the name says) cut off dead ends, while the number defines the number of iterations. Setting it to eg. 2, a gangway with the length of 3 will later have the length of 1. This leads to blank spaces on the map, which I really appreciate.
The next Plugin Commands to call are “Place Entrance” and “Place Exit”. Just keep the Default parameter values.
Next, we call “Draw Decorations”. Leave the parameter empty to let all Decorations be drawn.
Last but not least, we call “Finalize”.
Not-Programmers, don’t be afraid. You don’t need any programming knowledge.
We make a Script command and copy-paste this:
$dungeonGenerator.prims() .mergeDeadEnds(0.3) .cutOffDeadEnds(2) .generate() .placeEntranceOn("bottom") .placeExitOn("top") .drawDecorations() .finalize()
Close the Database.
Now, we let the Player enter the Dungeon. On any map (eg. World Map if your game has one) create an event with this commands:
- Screen Fade-Out
- Transfer Player to any Position on the “Space” Map, use instant Transition Fade
- Call our Common Event
- Screen Fade-In
For the Exit we do almost the same. We can leave out the Transfer command as we are already on the Space Map. Eventually, you should think about a counter to let the player escape the dungeon after he found the exit x times.
Using this plugin to generate dungeons is a tricky exercise. However, it provides great power to design good-looking maps. When steps are unclear, feel free to look into my demo project.