Floor Generation Overview

From PMDOWiki
Revision as of 20:29, 10 August 2025 by Imbion (talk | contribs) (it's kind of important to remove the information you've delegated to other pages :nothoughts:)

Floor generation is performed as a list of steps, which allows a developer to customize their floor layout at every part of the pipeline. This page covers the basics of what each step is responsible for and why it is needed.

For information on what steps are required to create a floor from scratch, see Creating Dungeons from Scratch.

Overview

A dungeon map can be generated without items, enemies, or traps. But at a bare minimum, a dungeon map must generate terrain (plus entrance/exit) in order to complete without errors. There are 4 main options on how to do this.

Type Example Description Usage
Grid of Rooms Generation Frameless Rooms generate inside of a grid with cells. Most dungeon floors
List of Rooms Generation Frameless Rooms generate freely, spreading out from defined halls and rooms. Uncommon, but used for some dungeon floors
Stairs Floor Generation Frameless Tiles are generated directly on a base of walls. Rare, primarily debugging
Load Generation Anything! Load a pre-made map. Secret rooms, final floor treasure rooms

To learn more about the technical details of how they generate, visit their pages.

Priority System

Floor generation is broken down into an ordered list of steps, each assigned a priority. The priority determines at what point in the generation process the step should be performed, with a lower number means a step will execute earlier. While these priority numbers do not need to be obeyed for modding, they are the numbers that base PMDO uses. Priority becomes especially handy when using Zone Steps to plan out dungeon features across multiple floors instead of a single one.

Steps Summary

While the Overview section covers the bare minimum steps to generate without error, you may notice that generating a map only with those steps will have no name, no music, no time limit, and even no textures, forcing you to rely on the minimap to understand the terrain.

General Steps

Below is a table of commonly used steps, what priorities PMDO places them in, and what they are used for.

Priority Step Description
-6 MapDataStep Sets the music, time limit, and darkness of the floor.
-6 MapNameIDStep Gives the map a name.
-6 MapTitleDropStep Makes the map name show up before fading in.
-6 MapEffectStep Sets event data for the floor.
-6 DefaultMapStatusStep Sets the base map status of the map.
-2.2 AddDisconnectedRoomsStep Adds disconnected rooms to the map.
-1 DrawFloorToTileStep Creates a grid of tiles and draws onto it based on the list of rooms and halls from a RoomFloorGen or GridFloorGen.
0.1 UnbreakableBorderStep Adds a border of unbreakable tiles at the edge of the map.
0.1 TileBorderStep Adds a border of the specified tiles at the edge of the map.
1 MoneySpawnStep Sets the spawn table for money on this floor.
1.1 ItemSpawnStep Sets the spawn table for items on this floor.
1.2 MobSpawnStep Sets the spawn table for mobs on this floor.
1.2 MobSpawnSettingsStep Sets the rules for enemies respawning on the floor.
1.3 TileSpawnStep Sets the spawn table for traps on this floor.
2 FloorStairsStep Places the start point and the end stairs on different rooms of the floor, for RoomFloorGen or GridFloorGen.
3 AddTunnelStep Digs tunnels into the walls starting from a room.
3 PerlinWaterStep Adds water/lava/etc. using Perlin Noise.
3 BlobWaterStep Adds water/lava/etc. by placing several blobs made from cellular automata.
3 RoomTerrainStep Sets terrain in a number of rooms to a certain value.
3.1 DropDiagonalBlockStep If blobs of terrain are touching diagonally, then they are merged together.
3.2 EraseIsolatedStep Isolated terrain of the specified type is erased.
4 MapTextureStep Defines the textures for floors, walls, and water.
4 MapDictTextureStep Defines the textures in a more advanced way, needed if the layout uses grass.
5 RandomRoomSpawnStep<?, EffectTile> Spawns traps in random rooms.
5 SpacedRoomSpawnStep<?, EffectTile> Spawns traps in random rooms, taking care not to place in the same room or adjacent rooms.
5 Pattern Spawn Step Places placeables on a room in specified patterns.
6 TerminalSpawnStep<?, MoneySpawn> Spawns money in dead-end rooms.
6.1 DueSpawnStep<?, InvItem, MapEntrance> Spawns items based on how far they are from the starting room.
6.2 PlaceRandomMobsStep Randomly places enemies on the map.

Debug Steps

These steps are for debug or testing purposes.

Priority Step Description
0 SpecificTilesStep Sets the floor to specific tiles. Only used for debug.
7 DetectIsolatedStairsStep Testing step: Looks for a path from start to end and throws an error if none can be found.
7 DetectTileStep Testing step: Checks to see if a certain tile can be found on the map and throws an error if none can be found.


GridFloorGen Steps

These steps are used exclusively for GridFloorGen.

Priority Step Description
-5 InitGridPlanStep Initializes a grid for GridFloorGen.
-4 GridPathBranch, GridPathCircle, GridPathTwoSides, etc. Generates a path of rooms and halls for GridFloorGen.
-4 SetGridDefaultsStep Turns some rooms into halls (1 tile size), for GridFloorGen.
-4 ConnectGridBranchStep Connects some adjacent rooms, for GridFloorGen.
-4 CombineGridRoomStep Combines some rooms into larger rooms, for GridFloorGen.
-4 SetGridPlanComponentStep Tags all rooms in the grid plan as the specified components.
-4 SetGridInnerComponentStep Tags all rooms on the interior of the grid as the specified components.
-3 DrawGridToFloorStep Initializes a list of rooms and halls and populates it with the grid from GridFloorGen.

RoomFloorGen Steps

These steps are used exclusively for RoomFloorGen.

Priority Step Description
-3 InitFloorPlanStep Initializes a list of rooms and halls for RoomFloorGen.
-2 FloorPathBranch Generates a path of rooms and halls for RoomFloorGen.

LoadGen Steps

These steps are used exclusively for LoadGen.

Priority Step Description
-7 MappedRoomStep Loads a dungeon map to use as this floor's layout, including its entities and properties.

StairsFloorGen Steps

These steps are used exclusively for StairsFloorGen.

Priority Step Description
-1 InitTilesStep Sets the floor dimensions and initializes a grid of tiles, for StairsFloorGen.
2 StairsStep Places the start point and the end stairs on different tiles of the floor, for StairsFloorGen.

Typical Priority Usages

The sections below go into more detail of what each priority is typically used for, as well as less commonly used steps used in those priority brackets.

Floor Data

Priority -6

Examples:

  • MapDataStep
  • MapEffectStep
  • MapNameIDStep
  • DefaultMapStatusStep
  • MapTimeLimitStep

Grid Creation

Priority -5

Examples:

  • InitGridPlanStep

Grid Path Generation

Priority -4

Examples:

  • GridPathBranch
  • GridPathCircle
  • GridPathTwoSides
  • GridPathGrid
  • GridPathBeetle
  • GridPathTiered
  • SetGridDefaultsStep
  • ConnectGridBranchStep
  • CombineGridRoomStep

Room List Creation

Priority -3

Examples:

  • InitFloorPlanStep
  • DrawGridToFloorStep

Room List Generation

Priority -2

Examples:

  • FloorPathBranch

Tiles Creation

Priority -1

Examples:

  • InitTilesStep
  • DrawFloorToTileStep

Tiles Generation

Priority 0

Examples:

  • SpecificTilesStep

Spawn Tables

Priority 1

Examples:

  • MoneySpawnStep
  • ItemSpawnStep (Priority 1.1)
  • MobSpawnStep (Priority 1.2)
  • TileSpawnStep (Priority 1.3)


Exits

Priority 2

Examples:

  • FloorStairsStep
  • StairsStep

Water

Priority 3

Examples:

  • PerlinWaterStep
  • BlobWaterStep

Textures

Priority 4

Used to be here because textures were actually placed here, but now only assigns textures to the map itself and lets the map compute them after ALL steps are done. Thus, this step is the least dependent on its current position in the steps.

Examples:

  • MapTextureStep
  • MapDictTextureStep

Tile Spawns

Priority 5

Examples:

  • RandomSpawnStep
  • DueSpawnStep
  • TerminalSpawnStep

Spawns

Priority 6

Examples:

  • All steps in Tile Spawns
  • PlaceRandomMobsStep
  • PlaceDisconnectedMobsStep
  • PlaceNoLocMobsStep

Debug Checks

Priority 7

These gen steps are used to check the dungeon for issues, and throw an error if they're found. Useful for stress testing.

Examples:

  • DetectIsolatedStairsStep
  • DetectTileStep