Let’s build… a Castle!

Space Map

Design the Space Map as shown below:

This setup has 3 rows. From top to bottom:

  • 1st Row: one Ceiling Tile
  • 2nd Row: one or multiple Tiles for the Areas
  • 3rd Row: one or multiple Tiles for the Corridors

That’s it for the generation. Feel free to put invisible Events for background effects, e.g., screen toning or weather.

Additional Maps

At this time, this algorithm does not provide any additional maps.

JavaScript Call

Using this code, you can enter your map and have a first look.

const args = { }

$mapGenerator.custom("roomsAndCorridors", args)
.withExit("top")
.withExit("bottom")
.spawnPlayerAt("bottom")
.generate()
.finalize()

Arguments

You can add arguments to the „args“ instance in the code above. All arguments are optional.

ArgumentExample(s)Description
n_roomsToBuild5
[4, 5]
Number of rooms to build, either as a fixed value or as an array [min, max] (both inclusive)
roomWidth8
[7, 9]
Width of each room, either as a fixed value or as an array [min, max] (both inclusive)
roomHeight5Height of each room, either as a fixed value or as an array [min, max] (both inclusive)
allowOverlappingtrue
false
Rooms can overlap each other. Default: false
n_randomEdges1
[0, 2]
Additional corridors to create alternative solutions to the map, either as a fixed value or as array [min, max] (both inclusive)
thickness3
[3, 5]
The thickness of every corridor, either as a fixed value or as an array [min, max]. Only values from 1 to 5 (inclusive) are supported.
const args = {
  n_roomsToBuild: [4, 5],
  thickness: 4
}

$mapGenerator.custom("roomsAndCorridors", args)
.withExit("top")
.withExit("bottom")
.spawnPlayerAt("bottom")
.generate()
.finalize()

Let’s continue

Now you can continue by drawing e.g., Walls, decorations, or events.