Procedural Random Dungeon Generator – Tutorial Part 1

Step 3: Additional Maps

In this step we will define the entrance, exit and decorations.

  1. We create a Map called “Entrance Exit“, with default settings and again same tileset as we set in the snippets map.
  2. In this Map, we define how the entrance and exit should look like. They will just be 2 snippets with same width / height (which we will define later, but not here).

    Left one is for the entrance, right one for the exit.
    Tip: When designing decorations, by default only the B-Layer will be used by the plugin. However, if any of the entrance’s or exit’s tiles has a defined Ground Layer, the Ground Layer of all tiles is used too. In other words: Either only draw on the B-Layer or set a Ground Tile for every tile.
  3. Create an event at the exit, so the player can continue his journey. We fill its command list later.
  4. Go into regions tab, select region ID 5, and put it on exactly one tile, which will be the starting position of your hero.
  5. Let’s define decorations! We create a map called “decoration
  6. In this map, we define various B-layer objects (whereas all objects will have the same width / height). For our first set of decorations we chose 3×2.You can create as many objects as you wish. Tip: If you want one object to appear more frequently, create it multiple times.
  7. By the way, you can even create events here, e.g torches, and use region tiles eg. for Lightning Plugins.
  8. To determine what the last object is, we put a Region ID 1 Tile right next to the last object.
  9. We can create more maps and repeat the last few steps to build more decorations with individual sizes, eg. you have one map for small objects, dust and one map for large objects. Maybe another map for loot chests?

Step 4: Connecting Maps

  1. Go into your snippets Map.
  2. Now it comes into 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, that 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 plaer starts at the bottom and the exit will always be at the top. Let’s start with possible locations for the entrance. Every snippet in line 1 and 3 (in other words, 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 in column 1 and 3 (where the way upwards is blocked) have one location where the exit could spawn. Use region ID 13.
  6. Decoration:
    Last but not least, we insert our decoration objects. For every created decoration map, we define its individual region ID (except 5 and 13). Now we can set region IDs as placeholders everywhere we want. The generator will insert one object from the region ID’s associated map.

Leave a comment

Your email address will not be published. Required fields are marked *