In this tutorial we focus on another algorithms to generate dungeons: Those to create dungeons with large areas.
Create more Snippets
To draw those dungeons we first need some new snippets.
- Those to draw large areas, including edges, corners, inner corners
- Those to draw the connections between tunnels and areas, called Transitions
Let’s create the snippets for the areas. We create a new Map with the width of
3 * snippets_width + 4 and height of
5 * snippets_height + 6, in our case this will be
25 x 41.
Draw snippets as shown in this picture.
The first 9 snippets are straight-forward. Then, then snippets within the two bottom rows define inner corners and two double inner corners as special case.
Now, create another Map in which we create the Transitions. This map will have the same dimensions as the map in which we drew our tunnels, so let’s just copy-paste this map. Erase all the snippets and draw new ones as shown below.
Well, I admit, this map looks confusing. On this map there are all the snippets having an area and a tunnel. A tunnel can fade into an area at its corner or edge, horizontal or vertical, or even two tunnels can fade into an area at the same spot, leading to many possibilities.
Placing some doors will look really cool for sure 😉
Entrance and Exit
Add some region Ids to place entrance and exit as we already did before.
Set the Space Map’s as the Parent Map for the other Maps.
By the way, it is possible to create multiple maps for area and/or transitions, just as we did before with the tunnel snippets.
Now, when we write the command to finally generate our dungeon, we use this command:
$dungeonGenerator.randomWalk() .generate() .placeEntranceOn("bottom") .placeExitOn("top") .drawDecorations() .finalize();
You probably noticed, the 2nd command is the only one which really is different towards the ones we used before. In the future more algorithms with more optional arguments will be provided.
When everything went right, you will now create a dungeon using a Random Walk algorithm. Don’t forget you can always check out my thread in the forum and you can always contact me via PM when you encounter any issues 😉