These functions are normally used for layouts.
This list is taken from l_dgnbld.cc.
For information on layout types and specific layouts, see Layout Types. For layout proposals and information on layout styles for branches, see Level Generation Algorithms.
Several of these functions allow the passable glyphs to be set as an optional parameter. You will need this if you are using KFEAT
to make previously-passable glyphs impassable or vice versa. The default set of traversable glyphs is specified around line 68 of mapdef.cc:
.+=w@{}()[]<>BC^TUVY$%*|Odefghijk0123456789
Note that glyphs without a standard meaning are considered impassable by default.
Layouts are placed like vaults, so the normal considerations for vaults apply. Some important notes:
All coordinates specified with mapgrd
measure from the top left corner of the map. However, we want them to simply index places in the layout. To do this, we must extend our layout to cover the entire map. You can change the size of a vault as it runs, but it erases the contents and is thus only really applicable for layouts. Start your layouts with:
local gxm, gym = dgn.max_bounds() extend_map{width=gxm, height=gym, fill='x'}
Sometimes a vault (called a primary vault) is placed before the layout. This happens, for example, at branch ends where the end vault is placed with the PLACE:
command. If there is a primary vault, the layout can detect it and alter its design accordingly. Detection of the primary vault is a per-cell query (dgn.in_vault(x, y)
) and can be specified as a parameter to some functions. However, these queries are performed before the layout is rotated and mirrored. If you want to uses these, your layout MUST have the no_rotate
, no_hmirror
, and no_vmirror
tags. It should also contain no directional bias (e.g. usually placing more open area along the left side than the right).
People have to play on your layouts. If it is inconvenient while playing the game, take it out. This applies even if it is a really cleaver implementation of a really cool idea and looks really good in the minimap.
Specifics:
layout_cross
, players will hate it.Syntax:
count_feature_in_box ({ x1 = ???, y1 = ???, x2 = ???, y2 = ???, feat = ???})
Parameters (passed as a LUA table):
x1
(int): The minimum x coordinatey1
(int): The minimum y coordinatex2
(int): The maximum x coordinatey2
(int): The maximum y coordinatefeat
(string): The glyphs to countReturns: int
This function checks of glyphs in the area from position (x1, y1)
to position (x2, y2)
and returns the number that appear in feat
.
Syntax:
count_antifeature_in_box ({ x1 = ???, y1 = ???, x2 = ???, y2 = ???, feat = ???})
Parameters (passed as a LUA table):
x1
(int): The minimum x coordinatey1
(int): The minimum y coordinatex2
(int): The maximum x coordinatey2
(int): The maximum y coordinatefeat
(string): The glyphs to countReturns: int
This function checks of glyphs in the area from position (x1, y1)
to position (x2, y2)
and returns the number that do NOT appear in feat
.
Syntax:
count_neighbors ({ x = ???, y = ???, feat = ???})
Parameters (passed as a LUA table):
x
(int): The x coordinate to count aroundy
(int): The y coordinate to count aroundfeat
(string): The glyphs to countReturns: int
This function checks the glyphs at position (x, y)
and the 8 cells around it and returns the number that appear in feat
.
Syntax:
count_passable_neighbors ({ x = ???, y = ???, feat = ???})
Parameters (passed as a LUA table):
x
(int): The x coordinate to count aroundy
(int): The y coordinate to count aroundpassable
(string, optional): The glyphs to treat as passableReturns: int
This function returns number of passable glyphs in the 8 cells adjacent to position (x, y)
. This does NOT include position (x, y)
itself.
Using this function to count the number of glyphs of other types is considered bad practice because it leads to confusing code. Use count_neighbors
instead.
Syntax:
make_circle ({ x = ???, y = ???, [radius = ???], [fill = ???]})
Parameters (passed as a LUA table):
x
(int): The x coordinate of the centery
(int): The y coordinate of the centerradius
(int, optional): The radius of the circlefill
(character, optional): The glyph to fill the circle with
This function makes an filled circle centered at position (x, y)
. If radius
is specified, the circle has that radius. Otherwise, the circle has a radius of 1
. If fill
is specified, the circle is filled with that glyph. Otherwise, the circle is filled with glyph 'x'
.
Example Circles
Radius: 1 Radius: 2 Radius: 3 Radius: 4 ......... ......... ......... ..xxxxx.. ......... ......... ...xxx... .xxxxxxx. ......... ...xxx... ..xxxxx.. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ......... ...xxx... ..xxxxx.. xxxxxxxxx ......... ......... ...xxx... .xxxxxxx. ......... ......... ......... ..xxxxx..
Syntax:
make_diamond ({ x = ???, y = ???, [radius = ???], [fill = ???]})
This function behaves the same as make_circle
, but makes a diamond shape (i.e. a square rotated 45 degrees).
Example Diamonds
Radius: 1 Radius: 2 Radius: 3 Radius: 4 ......... ......... ......... ....x.... ......... ......... ....x.... ...xxx... ......... ....x.... ...xxx... ..xxxxx.. ....x.... ...xxx... ..xxxxx.. .xxxxxxx. ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ....x.... ...xxx... ..xxxxx.. .xxxxxxx. ......... ....x.... ...xxx... ..xxxxx.. ......... ......... ....x.... ...xxx... ......... ......... ......... ....x....
Syntax:
make_rounded_square ({ x = ???, y = ???, [radius = ???], [fill = ???]})
This function behaves the same as make_circle
, but it makes a rounded square. A rounded square is like a square, but with the 4 corner cells removed. Note that a rounded square of radius 1
contains no glyphs.
Example Rounded Squares
Radius: 1 Radius: 2 Radius: 3 Radius: 4 ......... ......... ......... .xxxxxxx. ......... ......... ..xxxxx.. xxxxxxxxx ......... ...xxx... .xxxxxxx. xxxxxxxxx ....x.... ..xxxxx.. .xxxxxxx. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ....x.... ..xxxxx.. .xxxxxxx. xxxxxxxxx ......... ...xxx... .xxxxxxx. xxxxxxxxx ......... ......... ..xxxxx.. xxxxxxxxx ......... ......... ......... .xxxxxxx.
Syntax:
make_square ({ x = ???, y = ???, [radius = ???], [fill = ???]})
This function behaves the same as make_circle
, but makes a square shape.
Example Rounded Squares
Radius: 1 Radius: 2 Radius: 3 Radius: 4 ......... ......... ......... xxxxxxxxx ......... ......... .xxxxxxx. xxxxxxxxx ......... ..xxxxx.. .xxxxxxx. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ...xxx... ..xxxxx.. .xxxxxxx. xxxxxxxxx ......... ..xxxxx.. .xxxxxxx. xxxxxxxxx ......... ......... .xxxxxxx. xxxxxxxxx ......... ......... ......... xxxxxxxxx
Syntax:
make_box ({ x1 = ???, y1 = ???, x2 = ???, y2 = ???, [floor = ???], [wall = ???], [width = ???]})
Parameters (passed as a LUA table):
x1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinatefloor
(character, default: ”.”
): The glyph to fill the inside of the box withwall
(character, default: “x”
): The glyph to make the wall of the box withthickness
(int, default: 1
): The thickness of the box wall
This function makes a hollow box from position (x1, y1)
to position (x2, y2)
. The box has walls of glyph wall
that are thickness
thick glyphs thick. Inside the walls, the box is filled with glyph floor
.
Syntax:
make_box_doors ({ x1 = ???, y1 = ???, x2 = ???, y2 = ???, [number = ???]})
Parameters (passed as a LUA table):
x1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinatenumber
(int, default: 1
): The number of doorsthickness
(int, default: 1
): The thickness of the box walldoor
(character, default: ”+”
): The glyph for the doors at the outside of the wallinner_door
(character, default: ”.”
): The glyph to use for the doors at the inside of the wallbetween_doors
(character, default: ”.”
): The glyph for the passage through the wall between the outer and inner doorpassable
(string, optional): The glyphs to treat as passableveto_gates
(boolean, default false
): Whether to prevent doors joining into large gates
This function adds number
doors to a hollow box from position (x1, y1)
to position (x2, y2)
with wall thickness thickness
. There is an equal chance of placing a door at any legal position on the edges of the box. Doors are only placed where they will border a passable
glyph. If veto_gates
is true
, doors are never placed adjacent to another door
glyph.
If thickness
is greater than 1
, there are additional complexity. A passageway is placed inward from each door through the wall for distance thickness
. Glyph inner_door
is used for the inmost cell in this passageway, while glyph between_doors
is used for the other glyphs. Doors are only placed so that the passageway reaches the open portion of the box.
This function does not generate the box itself.
Example Doors for a Thick Box:
xxxx+xxxxxx number: 3 xxxx~xxxxxx thickness: 4 xxxx~xxxxxx door: '+' xxxxWxxxxxx xxxx...xxxx < xxxx...W~~+ < Doors can place here xxxx...W~~+ < xxxxxxxxxxx xxxxxxxxxxx inner_door: 'W' xxxxxxxxxxx between_doors: '~' xxxxxxxxxxx veto_gates: false
Syntax:
make_irregular_box ({ x1 = ???, y1 = ???, x2 = ???, y2 = ??? floor = ???, wall = ???, door = ???, door_count = ???, div_x = ???, div_y = ???, in_x = ???, in_y = ??? })
Parameters (passed as a LUA table):
x1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinatefloor
(character, default: ”.”
): The glyph for the inside of the boxwall
(character, default: “x”
): The glyph for the box wallsdoor
(character, default: ”+”
): The glyph for the doors in the box wallsdoor_count
(int, default: 1
): The number of doors to adddiv_x
(int, default: 1
): The maximum number of segments the x-aligned walls are divided intodiv_y
(int, default: 1
): The maximum number of segments the x-aligned walls are divided intoin_x
(int, default: maximum possible): The maximum distance an x-aligned wall segment can be from the box edgein_y
(int, default: maximum possible): The maximum distance an x-aligned wall segment can be from the box edge
This function makes an irregular hollow box from position (x1, y1)
to position (x2, y2)
. The box is irregular in the sense that the edges are not simple straight lines. Instead, each edge is divided into up to div_x
or div_y
segments (depending on the edge direction), and the segments can be different distances inward from the specified box edge. div_x
or div_y
are the maximum number of segments; the actual number varies widely, with much smaller values not uncommon.
Each edge if the box has at least one segment along the specified outside. The edges of the box are also guaranteed to never intersect (which creates isolated “rooms”) or touch (which creates double-thick walls). The edge segments can be up to in_x
or in_y
inward from the specified box edges, but cannot be so far in that they block the room.
The walls of the room are of glyph wall
and contain up to door_count
doors with glyph door
. These doors may be adjacent to each other, forming gates. If door_count
doors fit on the walls, that many doors will be placed. Otherwise, as many doors as possible will be placed.
The floor of the inside of the room is set to glyph floor
. The area inside the specified bounds of the room, but outside the room itself is not set. It will keep whatever glyphs it had before the make_irregular_box
function was called. This makes it possible to e.g. set a room with a '.' floor partially in a sea of lava.
Example Irregular Box
1 division Floor glyph: '.' 2 segments Wall glyph: 'x' max in: 1 Door glyph: '+' +---+-+ Door count: 2 xxx + + x+xxx.x | 1 division | x.....+ | 0 divisions 2 segments | x.....x | 1 segment + xx.....x | max in: 1 | x......x | max in: N/A | x..xxxxx + + xxxx +--+---+ 1 division 2 segments max in: 1
Another Example Irregular Box
xxxxxx xxxxxx x....x x....x +....x x....x Possible Parameters for this box: x....x+xxxx....x x..............x door_count = 3 x..............x div_x = 3 x............xxx div_y = 3 x............x in_x = 2 x............x in_y = 3 x............x x............x xxxxxxxxxx+xxx
Syntax:
make_round_box ({ x1 = ???, y1 = ???, x2 = ???, y2 = ??? floor = ???, wall = ???, door = ???, door_count = ???, passable = ???, veto_gates = ???, veto_if_no_doors = ??? })
Parameters (passed as a LUA table):
x1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinatefloor
(character, default: ”.”
): The glyph for the inside of the boxwall
(character, default: “x”
): The glyph for the box wallsdoor
(character, default: ”+”
): The glyph for the doors in the box wallsdoor_count
(int, default: 1
): The number of doors to addpassable
(string, optional): The glyphs to treat as passableveto_gates
(boolean, default false
): Whether to prevent doors joining into large gatesveto_if_no_doors
(boolean, default false
): Whether to cancel placing the entire room if no doors can be placedReturns: boolean
This function makes a hollow ellipsoid box from position (x1, y1)
to position (x2, y2)
. The walls of the box uses the wall
glyph and the floor uses the wall
glyph. door_count
doors are added with the door
glyph if possible. Doors are only placed in straight wall segments and only if they border a passable
glyph. If veto_gates
is true
, no doors are placed adjacent to another door.
If veto_if_no_doors
is true
, and no legal doors can be placed, nothing is placed for the entire room and false
is returned. Otherwise, true
is returned.
Example Round Boxes (allowing gates):
x+xxx xxx+x xxxxx xx+xx xxx...xxx xxx...xxx xxx...xxx xxx...xxx x.......x +.......x x.......x x.......x xx.......xx xx.......xx xx.......xx xx.......xx x.........+ x.........x +.........x x.........x xx.......xx xx.......xx xx.......xx xx.......xx x.......x x.......x x.......x x.......x x+x...x+x xxx...xxx xxx...xxx xxx...xxx xxxxx xxxxx x++xx xxxxx
Example Round Boxes (vetoing gates):
x+x+x xxxxx xxx+x xxxxx xxx...xxx xxx...x+x xxx...xxx x+x...x+x x.......x x.......x x.......x x.......x xx.......xx xx.......xx xx.......xx xx.......xx x.........x x.........x x.........x x.........x xx.......xx xx.......xx xx.......xx xx.......xx x.......x x.......x x.......+ x.......x xxx...xxx xxx...xxx xxx...xxx xxx...xxx xxx+x xxxxx xx+xx xxxxx
Syntax:
make_octa_room ({ x = ???, y = ???, [radius = ???], [fill = ???]})
Parameters (passed as a LUA table):
x1
(int): The minimum x coordinatey1
(int): The minimum y coordinatex2
(int): The maximum x coordinatey2
(int): The maximum y coordinateoblique
(int, optional):outside
(character, optional):inside
(character, optional):replace
(string, optional): The glyphs to replace
If replace
is not specified, all glyphs are replaced.
These functions replace some or all glyphs in an area the map.
Syntax:
replace_closest({ x = ???, y = ???, find = ???, replace = ???, required = ??? x1 = ???, y1 = ???, x2 = ???, y2 = ??? })
Parameters (passed as a LUA table):
x
(int, default: 0
): The center x coordinatey
(int, default: 0
): The center y coordinatefind
(character, required): The glyph to findreplace
(character, required): The glyph to replace it withrequired
(boolean, default: false
): Whether to print an error if the glyph cannot be foundx1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function replaces the glyph find
closest to (x
, y
) with glyph replace
. Only glyphs in the box between (x1
, y1
) and (x2
, y2
) with are considered. If there is no such glyph and required
is set to true
, an error message is printed.
These call powerful layout generation functions implemented in C++. They do not, however, generate an entire layout on their own.
Syntax:
join_the_dots({ x1 = ???, y1 = ???, x2 = ???, y2 = ???, [passable = ???], [fill = ???] })
Parameters (passed as a LUA table):
x1
(int): The starting x coordinatey1
(int): The starting y coordinatex2
(int): The ending x coordinatey2
(int): The ending y coordinatepassable
(string, optional): The glyphs to treat as already passablefill
(character, optional): The glyph to make the path with
This function makes an open path one cell wide connecting position (x1, y1)
to (x2, y2)
. If a value for fill
is specified, the path is generated with that glyph. Otherwise, the path is generated with glyph '.'
. Passable glyphs are not replaced.
Syntax:
remove_isolated_glyphs( find = ???, replace = ???, percent = ???, boxy = ???, x1 = ???, y1 = ???, x2 = ???, y2 = ??? })
Parameters (passed as a LUA table):
find
(string, default ””
): The glyphs to removereplace
(character, default: '.'
): The glyph to replace withpercent
(int, default: 100
): The fraction of glyphs to be replacedboxy
(boolean, default: false
): Whether to consider diagonal connectionsx1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function replaces the glyphs specified in find
in the box between (x1
, y1
) and (x2
, y2
) with replace
if they are entirely surrounded by glyphs not in find
. If percent
is specified, each qualifying glyph has that chance of being replaced. If boxy
is set to true
, diagonal connections are considered; otherwise only straight connections are.
Syntax:
widen_paths( find = ???, replace = ???, passable = ???, percent = ???, boxy = ???, x1 = ???, y1 = ???, x2 = ???, y2 = ??? })
Parameters (passed as a LUA table):
find
(string): The glyphs to removereplace
(character, default: '.'
): The glyph to replace withpassable
(string, optional): The glyphs to treat as passablepercent
(int, default: 100
): The fraction of glyphs to be replacedboxy
(boolean, default: false
): Whether to consider diagonal connectionsx1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function replaces the glyphs specified in find
in the box between (x1
, y1
) and (x2
, y2
) with replace
if they are bordered by passable glyphs. Each glyph in find
has a chance of percent
of being replaced for each passable it borders. If boxy
is set to true
, diagonal connections are considered; otherwise only straight connections are.
For example, suppose percent
is set to 50
. A glyph in find
that borders one passable glyph has a 50% chance of being replaced. If it bordered two passable glyphs, it would have a 50% chance of being replaced for the first glyph and a 50% chance of being replaced for the second, giving a total chance of 75%. If it bordered 3 passable glyphs, the chance would be 87.5%, and if it bordered n
passable glyphs, the chance would be (100 * (1 - ((1-percent)/100)^n) * 100
)%.
Syntax:
connect_adjacent_rooms({ wall = ???, floor = ???, replace = ???, max = ???, min = ???, check_distance = ???, x1 = ???, y1 = ???, x2 = ???, y2 = ??? })
Parameters (passed as a LUA table):
wall
(string, default: “x”
): The glyphs for the walls between roomsfloor
(string, default: ”.”
): The glyphs for the open portions of the roomsreplace
(character, default '.'
): The glyph for the connections to addmax
(int, default: 1
): The maximum number of positions to considermin
(int, default: max
): The minimum number of positions to considercheck_distance
(int, default: 9999
): How far along the wall to look for another doorx1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function checks a number of positions in the box between (x1
, y1
) and (x2
, y2
). The exact number of positions is chosen randomly from the range [min
, max
] inclusive. Each position is checked to see if it on glyph in wall
, between two glyphs in floor
. If so, that glyph is deemed to be on a wall, and is considered to become a connection between the two rooms on either side of it. The connection will only be added if there are wall
cells for at least check_distance
cells on either side of the position.
Some Example Situations:
'O' is the position being considered
Original .x.......x .x.......x .x.......x .x.......x .x.......x Situation: xxxxOxxxxx xxx+Oxxxxx xx+xOxxxxx xxxxxO..xx xxxxOxx+xx x.......x. x.......x. x.......x. x.......x. x.......x.
Decision if check_distance
is 0
Accept Reject Accept Reject Accept next to '+' next to '.'
Decision if check_distance
is 2
Accept Reject Reject Reject Accept '+' on wall '+' on wall next to '.' '+' is too far
Decision if check_distance
is 9999
Accept Reject Reject Reject Reject '+' on wall '+' on wall next to '.' '+' on wall
Syntax:
smear_map({ onto = ???, smear = ???, boxy = ???, iterations = ??? })
Parameters (passed as a LUA table):
onto
(string, default: ”.”
): The glyphs to smear ontosmear
(character, default: 'x'
): The glyph to smearboxy
(boolean, default: true
): Whether to smear diagonallyiterations
(int, default: 1
): How many spots to smearx1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function replaces iterations
glyphs of type onto
with the glyph smear
. Glyphs are only considered if they are in the box from position (x1, y1)
to position (x2, y2)
and already have a neighbor with value smear
. If boxy
is true
, diagonal neighbours are allowed, otherwise they are not.
Note that that a cell smeared into for one iteration can be the neighbor for the next iteration. This means that the smearing can travel quite a ways from the original wall.
Note that this function often leaves unattached cells with glyph onto
. This can cause problems if e.g. a stairs places in that cell.
Syntax:
spotty_map({ replace = ???, fill = ???, boxy = ???, iterations = ??? })
Parameters (passed as a LUA table):
replace
(string, default: “x”
): The glyphs to replace with “spots”fill
(character, default: '.'
): The glyph for the “spots”boxy
(boolean, default: true
): Whether the “spots” are 9-cell squares instead of 5-cell plusesiterations
(int, default: random2(boxy ? 750 : 1500)
): How many “spots”x1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function places iterations
“spots” on the map, each positioned so they overlap or are adjacent to a cell that does not have glyph replace
. In each spot, all glyphs of type replace
are replaced with glyph fill
. If boxy
is true
, the “spots” are 3×3 squares. Otherwise, the “spots” are 3×3 pluses. Only cells in from position (x1, y1)
to position (x2, y2)
are considered.
The effect of this function is to cause the open areas on the map to grow outward into the replace
glyphs irregularly. This produces cave-like areas. No potion of the new are is disconnected from the original area. Starting with two disconnected areas does not guarantee that they will connect.
Note that there must be at least one glyph that is not in replace when this function is called. Otherwise, it will have no effect (except taking CPU time).
Syntax:
add_pools({ contents = { [???] = ???, [???] = ???, ...}, replace = ???, border = ???, pool_size = ???, seed_separation = ???, x1 = ???, y1 = ???, x2 = ???, y2 = ??? })
Parameters (passed as a LUA table):
contents
(table, default: {[”.”] = 1}
): The glyphs to fill the pools withreplace
(string, default: ”.”
): The glyphs to replaceborder
(character, default: '.'
): The glyph to fill the pool borders withpool_size
(int, default: 100
): The desired average pool area in cellsseed_separation
(int, default: 2
): The minimum separation for pool “seeds”x1
(int, default: 0
): The minimum x coordinatey1
(int, default: 0
): The minimum y coordinatex2
(int, default: vault max): The maximum x coordinatey2
(int, default: vault max): The maximum y coordinate
This function replaces the glyphs specified in replace
in the box between (x1
, y1
) and (x2
, y2
). The area is divided into an number of irregular “pools”, each with an approximate area of pool_size
. Each pool is filled with a random glyph chosen from contents
using the weights specified, which each pool having a single type of glyph. A 1-cell border of border
glyphs is placed between each pool and around the edges of the filled area. Pools are all grown form seed positions, which must be separated by a distance of at least seed_separation
. seed_separation
must be at least 2
to allow for the border between the pools.
The contents
field must be a LUA table (yes, as an element of the main table). The keys for the table are the glyphs to use for filling pools, and the values are the frequencies.
For example:
contents = { ["."] = 7, ["w"] = 2, ["l"] = 1 }
would give each pool a 70% chance of being filled with empty floor ( '.'
), a 20% chance of being filled with (deep) water ( 'w'
), and a 10% chance of being filled with lava ( 'l'
). There would be no mixed pools.
This function needs a avoid_primary_vaults
option.
Syntax:
delve( ngb_min, ngb_max, connchance, cellnum, top )
Parameters:
ngb_min
(int, default: 2
): The minimum number of neighbouring floor cells that a wall cell must have to become a floor cellngb_max
(int, default: 3
): The maximumconnchance
(int, default: 0
): The percent chance a new connection is allowedcell_num
(int, default: it's complicated): The total number of cells to digtop
(int, default: 125
): The number of recent cells to consider building fromRestrictions
<
=
ngb_min <
=
3<
=
ngb_max <
=
8;
This function digs a path of cell_num
cells into the map. The path will not intersect pass through vaults. connchance
determines how likely it is to connect to itself, with 0
meaning never. top
influences how likely it is to branch, with a higher vale giving more branches.
The full (and somewhat confusing) documentation is included at the top of dgn-delve.cc:
These call layout generation functions implemented in C++.
layout_basic
layout_bigger_room
layout_chaotic_city
layout_shoals
layout_swamp
This changes the size of the map. There is a maximum size of 80×70 cells (at the time of writing) including a border.