Generating dungeons of several floors with ladders and an exit
The dungeon generator now makes a dungeon of up to four floors, joins them by a lift and a ladder, and gives a dungeon you go down into a one-way quick exit past its boss.
The dungeon generator’s last step is in. Ask it for “three floors”, or for a giant dungeon, and it writes one sheet a floor, passes each floor through the checker alone and the three as one dungeon. Between floors there is a lift and now also a ladder, and a dungeon you go down into has a quick exit from the boss’s room back up to floor 1.
How does it ask for several floors?
floors_asked reads “three floors” (two to six; levels, storeys and decks count too), “goes down into”, “deep” and “descends” (two floors), and any size with more rooms than 25. At most four floors are made, which is what the Breakout Site has. The old cap of 35 rooms on a sheet is gone: giant is 35 to 50 rooms and is spread over two floors, 25 a floor at most.
Rooms are dealt out evenly, the odd ones to the deeper floors, at least six a floor. Rooms the words name go a floor each in turn from floor 1. The cycle the words ask for (a code, a flood, a lock) is on the last floor, because that floor holds the goal. Difficulty rises a step a floor, to at most 5, and the last floor’s goal room is the boss’s, with the dungeon’s strongest pack. The stocking now breaks a tie by name, so the same words and seed give the same dungeon whatever Python’s hash seed is.
The game already built a dungeon of several floors: floor 1 at the foot of its ramp, each floor under it slid until its entrance stands straight under the floor above’s lift. So the generator draws each floor with the single-floor generator, given its level, and puts floor n’s lift where floor n+1’s entrance will be. A square of floor n sits in the dungeon at its sheet square plus the floor’s offset, so squares of two floors at the same place stand one over the other. That is all a ladder needs.
Why is there a ladder as well as a lift?
I said “yes” to a second way between floors. A ladder is a shaft with no car, a new importer class, DungeonLadder. For each pair of floors, second_way digs a tunnel of at most 14 squares from a room’s edge on each floor, and picks a square both can reach that is at least 6 squares from the lift, scoring distance from the lift less 0.6 times the two tunnel lengths. The two stops are ladder things with one uid, the upper leads: "down" and the lower leads: "up".
At import, each upper stop takes the nearest lower stop straight under it. A lonely stop is refused, and so is a column that would pass through an open square, or the walls round one, on a floor between. The lower stop’s node builds rungs up its back wall, a tube through the rock, a hatch at the top and two grips on E. A climb takes the party out of its own hands and moves it 1.2 m a second of game time, so a stopped clock stops it. Nothing of it is saved, because a climb is over before a save can be made.
It is built from the dungeon kit’s plain boxes with one lamp, and makes no sound. A model through the pipeline, a sound and a look per theme are on the work list.
What is a quick exit past the boss?
I wrote that a dungeon you go down into should have a quick exit after the boss room: a lift to a secret door that opens from one side, or a hidden ladder. The game has no true one-way door or secret door yet, but it has a switch that works a door. So the quick exit is a ladder from the nook off the boss’s room straight up to floor 1, which comes out in a tunnel shut by a door no key opens. A lever on the ladder’s side of the tunnel opens it, and it stays open. The door’s note says it has no handle on the near side.
quick_exit searches a tunnel on the last floor from the nook (at most 60 squares), and on floor 1 from room edges, dearer the farther the room is walked from the entrance with every lock shut, and never next to floor 1’s lift. The chosen square must be reachable from both, and rock_between must say the column is rock on every floor between. The cheapest total wins. On floor 1 the path’s first square gets the door, its second the lever, and its last the top of the ladder.

The three floors as maps, then the party going down by lift, climbing the ladder, out through the hatch on floor 1, up the 16 m quick exit, at the door with no handle, and through it once the lever is thrown.
How does it know the floors fit together?
Each floor passes checks H1 to H12 alone; a ladder’s stop counts as a way in on a floor checked alone. The dungeon as a whole is walked by walk():
- D1: every floor is reached from floor 1’s entrance.
- D2: the boss’s room and its quick exit are reached.
- D3: every ladder has its partner.
- D4: from the quick exit’s top, floor 1’s entrance is reached, because the lever opens the door.
- D5: from floor 1’s side the quick exit is shut.
- D6: a long ladder’s column is rock on every floor between.
The designer page writes one document a floor, named for the dungeon and the floor number, with of pointing at the first, a level, and its own draft note. Its palette gets a lift and a ladder.
What are the numbers?
- The work commit changed 34 files, 2206 insertions and 34 deletions, including a 712 line
tools/dungeon_floors.pyand a 325 linedungeon_ladder.gd. tests/dungeon_ladderspassed 44. The generator, page, checks, rooms and catalog tests had 0 failures, and so did a 14 test subset of the suite.- In the film the first ladder is 6 m and 5 s of game time; the quick exit is 16 m and 13 s.
Also done
- The notes the generator writes beside a ladder and the quick exit’s door and lever count as “to do” in the importer’s report, so a generated floor can read as unfinished. Filed, not fixed.