Procedural Maze Generator – Starter Guide

Step 3: Decoration Map, Entrance and Exit

This step will define the entrance, exit, and decorations. While using decorations is optional, having an entrance and exit is required. (At least in this tutorial, later we will look for alternatives)

  1. We create a Map called „Decoration“, with exactly this name, default settings, and again the same tileset as we set in the Snippets map.
  2. In this Map, we define any objects which will be spawned by the generator. These can be simple objects, rocks, plants, and the entrance and exit.
  3. Before we continue, let’s get a feeling of how the Decoration Map works and what purpose it has. Imagine, if we would just put some objects, one entrance and the exit on this map, this plugin would never have the idea of how things belong to each other, not even it would see how big some objects are. The Maker is a little bit limited, so we have to help it out.

    On this Map, we will define a lot using Region Ids. On the very left of the Map, from top to bottom, we draw Region Ids using different numbers. Each area of one number defines the dimensions of the respective object, which are drawn right next to them. So the plugin knows, which objects are assigned to which id and how large they are.

    Below you see an example of a Decoration Map, and we will look at all the details now.

  4. We start with the entrance. The entrance will always be at the bottom and not remarkable, so we will just draw a little piece with the size of 1×1. By default, the entrance is assigned to region ID 5, so we first draw a 1×1 Region Tile with this id in the top-left corner.
  5. Right next to it, we draw the entrance itself. I just a little light here, actually you even could leave this tile empty.
  6. Go back into region Tab, select region ID 6, and put in on exactly this tile. This will be the spawning point for the player. Well, when the tile has the size of only 1×1, it is logical that only this place can be the location to spawn the player, however what if you want to have an entrance that is larger? Then the plugin would not know where exactly to start.

  7. Now we define the exit. Here we want to have a 1×2 tunnel. Go into the Region tab, select region Id 13 (the red one), and put them below region 5 with the same dimensions. Then draw the tunnel itself just next to the region tiles.
  8. Create an event at the exit, so the player can continue his journey. We fill its command list later.

  9. Let’s define decorations! Just add new region Ids to the left, below the ones we already have, and draw objects next to them. The numbers not only exist to distinguish objects from entrance and exit, but they fulfill another function: They group objects into sets. You can draw multiple objects next to the same id, as long they have the same dimensions. Just don’t use Region Id 5, 6, 13, or 61 as their functions are reserved.
  10. The Plugin guesses the number of objects for each line. If you wish to manually set this number because you want to draw empty objects on purpose, select region Id 61 and put it right next to the last element of each line.

  11. By the way, here we can become very creative. You want some mysterious special object to appear less frequently? Just draw it 3 times, place the stopper region Id 61 and then remove 2 of the objects. My very first dungeon contained pillars, whereas some are broken and some are not. There are a lot of possibilities here.
  12. By the way, you can even create events here, e.g torches or loot chests.

Step 4: Connecting Maps

  1. Go into your Snippets Map.
  2. Now it comes to defining where the entrance, exit, and decoration will spawn later.
  3. Let’s first talk about entrance and exit. Every dungeon will have exactly one of each. Those will be placed randomly, which means they can spawn on a dead-end, straight, crossing… In the next steps, we are going to define locations where the entrance and exit could spawn. We do this on the snippets.
    One could easily spam possible locations on every snippet, but that’s not needed. It’s just important, that on the generated map later, there’s at least one possible spawn location for the entrance and one for the exit. Example: When you only define locations on dead ends, but your map later won’t have any (and yes, this is possible) then your game will abort.
  4. TL;DR: Entrance:
    We make it easy. We assume that the player starts at the bottom and the exit will always be at the top. Let’s start with possible locations for the entrance. Every snippet where the way downwards is blocked must have one location where the entrance could spawn. Mark this position with region ID 5.
  5. Exit:
    Same for the exit. All snippets where the way upwards is blocked must have one location where the exit could spawn. Use region ID 13.

    This Screenshot was taken from an older version which worked with a different arrangement.
  6. Decoration:
    Last but not least, we insert our decoration objects. Just the same way we inserted the entrance and exit, we add other region IDs everywhere we wish to let the generator spawn respective decorations later. For each spawning point, the generator will insert one object from the respective set.

    This Screenshot was taken from an older version which worked with a different arrangement.