Furnishing dungeon rooms from templates built on a room knowledge base
Each room kind now has a template with an anchor, followers, rows and runs, and clear paths between doors, instead of random props along the walls.
Rooms in the dungeons are now furnished by what they are for. A barracks has bunks in rows, a kitchen has its counters in a line and no dining pieces, and a cell is a cot and a bucket. Floor 1 of the test dungeon went from 507 pieces to 459 and takes about 200 ms to dress.
Why did the rooms look random?
I asked for the generator to place objects in realistic ways that match the type of room. Before this it took a list of props for a room’s kind and placed them round-robin along the walls. It broke the same rules every time. Nothing was placed first, so nothing was the focus of the room. Rows had no fixed spacing. Chairs and nightstands weren’t tied to their table and bed. Paths between doors weren’t kept clear. Storage was scattered instead of standing in runs, and a kitchen could get dining furniture.
I had a knowledge base built first: about 169 notes citing about 450 sources, in two parts. One part is the rules by family (anchors, followers, rows, runs, kept-clear zones, a centre group or an open middle). The other is one note per room kind, turned into a template.
How does a template lay a room?

A barracks and a kitchen on the same seed. Left: the old layout. Right: templates. Red is the anchor, blue a row, green a run, amber a single, grey a follower.
Each kind is a list of steps in content/room_layouts.json, run in order by a class called RoomLayout. The first step is the anchor, which is placed first and then gets a lane 1.2 m wide kept clear from the main door, so it’s seen from the door. The other steps are one of four types: a single piece, a row (leaders at a fixed pitch along walls, all facing one way), a run (pieces edge to edge along one wall), or a grid (free-standing leaders on a lattice, all facing one way). A step can name which walls, which candidate spot comes first, which way the piece faces, and the margin to keep around it. Each leader has followers placed with it: chairs at a table’s sides, a nightstand by a bed, a trunk at its foot, a toilet inside a stall.
Pieces are placed by their real footprints, not by the cells they cover. That’s what lets a run of lockers touch and a chair sit against its table. After each piece, the same check the old dresser used runs: every body size in the game must still reach what it could before, and a body 1.2 m wide must still be able to get between all the ways in (1.5 m in the director’s office). If it can’t, the piece is undone and tried somewhere else, up to ten times, and then given up. At the end the shortest way between two doors is kept as a no-go, so strewn clutter never lands on it.
I first tried keeping a straight or Z-shaped line clear between doors. It cut every room’s middle in two, so I replaced it with that connectivity rule.
Rows and runs share one wear state 80% of the time.
A small room drops the steps marked with a minimum floor area, tries an alternative prop if an anchor doesn’t fit, and skips a step that fits nowhere. There are 18 templates: the 13 old kinds plus canteen, ward, cabin, cutting room and grand office.
What broke?
Several walking tests had the party walk through a room and started failing, because furniture was now in the way. I taught them to step around a piece when blocked. The tests that pin furniture counts needed new numbers too. The editor-play test fails in this worktree with or without the templates, so I don’t think it’s this change.
Also done
- Two separate lists of what’s left: the rest of the wear rules (pieces removed, moved a little, chests opened, barricades across doors), and 21 props the templates want that the game doesn’t have yet.
- Every number in the templates is a first guess. I still need to look at the rooms in the game and tune them.