Skip to content

Orientation and cell values ​

Axes ​

Every output of the package uses the same orientation:

  • North is up. Row 0 is the northern edge, the last row the southern one.
  • x is the column, counted from the western (left) edge. East is x + 1.
  • y is the row, counted from the northern (top) edge. South is y + 1, north is y - 1.
  • The cell at (x, y) is cells[y * width + x]; width is the number of columns, height the number of rows.

The compass directions in a design (N, NE, E, SE, S, SW, W, NW) follow the same picture: N points to smaller y, E to larger x. The map options width and height count columns and rows, so a map of width: 160, height: 80 is wider than it is tall.

Upstream axes

The C++ library stores the map as Map[x * dimY + y] and calls the row index x and the column index y; its north is x--. The package hides that: read linearly, the library's array is already north-up row-major, so D dimY is the width and D dimX the height of a design. The 2014 demo transposed the map; this package does not.

Cell values ​

A dungeon has 20 cell values. In the code they are the Cell constants, in the dungeon file the legend names:

ValueCellJSON legendASCIIrows charColour
0Openopenspacespace #f0f0f0
1Closedclosed## #303030
2GuaranteedOpenguaranteedOpenspace~ #f0f0f0
3GuaranteedClosedguaranteedClosed#% #303030
4NonJoinOpennonJoinOpen.. #f0f0f0
5NonJoinClosednonJoinClosedxx #303030
6NonJoinGuaranteedOpennonJoinGuaranteedOpen__ #f0f0f0
7NonJoinGuaranteedClosednonJoinGuaranteedClosedXX #303030
8InsideRoomOpeninsideRoomOpen'' #f0f0f0
9InsideTunnelOpeninsideTunnelOpen,, #e8e8e8
10InsideAnteroomOpeninsideAnteroomOpen^^ #e0e0e0
11HorizontalDoorhorizontalDoor== #a04000
12VerticalDoorverticalDoor|| #a04000
13Mob1mob111 #ff0040
14Mob2mob222 #f00030
15Mob3mob333 #e00020
16Treasure1treasure144 #ffff00
17Treasure2treasure255 #f0f000
18Treasure3treasure366 #e0e000
19Columncolumn@@ #00ff00

The first eight values are open and closed cells in four flavours (plain, guaranteed, non-join and both) that the generator distinguishes while it runs; once a dungeon is done, an open flavour is floor and a closed one is wall. The three inside… values mark open cells that belong to a room, a tunnel or an anteroom. Doors, mobs, treasure and columns are placed during generation; mobs and treasure only with the entity output ('baked' writes them into cells, 'list' keeps them in the separate entity list).

Collapsing to tiles ​

Most games do not care about 20 values. toTiles from dungeonmaker-js/render collapses a dungeon to six tile classes in the same layout as cells:

TileCells
Floor (0)Open, GuaranteedOpen, NonJoinOpen, NonJoinGuaranteedOpen, the three Inside…Open cells
Wall (1)Closed, GuaranteedClosed, NonJoinClosed, NonJoinGuaranteedClosed
Door (2)HorizontalDoor, VerticalDoor
Column (3)Column
Mob (4)Mob1 … Mob3
Treasure (5)Treasure1 … Treasure3

The ASCII export is lossy in a different way: it merges cells that share a character (a space for Open and GuaranteedOpen, # for the closed variants). The rows encoding of the dungeon file uses a lossless alphabet instead; both are listed in the table above.

DungeonMaker 2.05 © Peter Henningsen. WebAssembly port, package and site created by spearwolf. Released under GPL-3.0-or-later. About · License