Skip to content

Lay out a building as its own kind when it has one, as a floor already is - #102

Merged
calebl merged 2 commits into
mainfrom
fm/ta-town-s1-kind
Dec 3, 2026
Merged

calebl merged 2 commits into
mainfrom
fm/ta-town-s1-kind

Conversation

@calebl

@calebl calebl commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

What changes

A place's own kind (locations.kind) now decides the word each of its rooms is dealt whenever that kind is a building word (kind::buildings()), floor or not. Before, only a floor's own kind counted; every other place was laid out as whatever building the place call's place_kind named. A world that seeds "The Shrine, kind: temple" now gets a temple's rooms even when the place call answers warehouse.

One clause in lay_out (src/turn/told/realize.rs):

// before
kind: match floor_row {
    Some(_) => own_kind.or(building),
    None => building,
},
// after
kind: own_kind.or(building),

A place with no own kind, or with an own kind that is not a building word, is laid out from place_kind as before.

A side effect on stubs the model writes. A stub that an exits answer wrote carries one of the room kinds (kind::kinds()). Three of those are building words too: workshop, shop and ruin. Such a stub is now laid out as that building, whatever place_kind says. No existing golden or records file moved because of this. The one sweep stub it touches, The Lamp Yard, says workshop in both answers.

Nothing a model is sent changes

The place call's prompt, its schema and every other request are unchanged. tests/seeded_kind.rs::the_place_call_is_sent_the_same_request_whatever_the_stubs_own_kind walks into The Shrine twice, once with kind: temple and once with no kind, and asserts that the place-call request bodies are equal.

Tests

tests/seeded_kind.rs uses the new world, The Shrine on the Square. The place call always answers warehouse.

  • a_seeded_temple_is_laid_out_as_a_temple_whatever_the_place_call_answers: the entry room is shrine, not a warehouse's office. Every other room is dealt from a temple's bands, and one of them is a study. This test fails with the old clause.
  • a_stub_with_no_kind_of_its_own_follows_the_place_call: the rooms are office, then storeroom for the rest.
  • a_stub_whose_own_kind_is_not_a_buildings_follows_the_place_call: own kind square, entry room office.
  • the_place_call_is_sent_the_same_request_whatever_the_stubs_own_kind: the test above.

Sweep

  • New world parity/worlds/the-shrine-on-the-square.sql. It holds The Square (realized, the opening) and The Shrine, a stub with a 12×10 footprint, kind: temple and population: nobody.
  • New script parity/scripts/a-seeded-temple-keeps-its-rooms.yml, listed in PASSING with a golden and a records file. It types /move The Shrine, and the place call answers warehouse with a cellar. The records hold the rooms as dealt: shrine, shrine, study on storey 0 and storeroom, storeroom on storey −1. With the old clause they would be a warehouse's office and storerooms. The golden's here is the shrine kit (altar, bench, candle, candle stand, dried flowers, prayer card, small bell, statue). With the old clause it is the office kit, and the check then fails on that script.
  • No existing golden or records file moved. parity --write parity wrote only the new script's files.

Gate (offline, both provider keys unset)

  • cargo fmt --check: clean.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
  • cargo test --workspace --locked: 534 passed, 0 failed. This includes the shape check over every world, the new one too, and the doctor tests over the three checked-in worlds.
  • parity --check parity: 111 of 115 agree. The four that do not are the PASSING_WITH_RUNNER scripts, the same as on main.
  • fight --check sim: all 10 fight goldens agree.
  • Game runner and engine:rust_gates: run in a scratch copy of the game at bf35540, with the changes listed below and the extension built from this branch. parity/runner.sh: all 115 listed scripts agree. engine:rust_gates: all 115 pass (goldens, invariants, doctor and audit) once the new script's checks file is written. The doctor reports the new world as "playable, 2 warnings": no_arc and room_without_a_layout for The Square.

What the game needs (paired PR in renderedstep/server)

The world dump came from the game's loader in a scratch copy of the game at bf35540. That copy had the three changes below, which the game needs for real:

  1. Location::Generator#realize! (app/models/location/generator.rb, around line 437): the same change for the Ruby loop the tests still play.
    own_kind = location.kind if Location::Kind::BUILDINGS.include?(location.kind)
    lay_out_interior!(detail["parameters"], place_kind: own_kind || word(detail, "place_kind", Location::Kind::BUILDINGS))
  2. The loader has to admit a building word on a place stub. WorldSeed::Loader#validate_kinds! (lib/world_seed/loader.rb, around line 1854) admits Location::Kind::BUILDINGS only on a location with floor:. It refuses kind: temple on The Shrine. The scratch copy admits KINDS + BUILDINGS on a location with width, depth and no parent (a place), and only KINDS everywhere else:
    kinds = if attributes.key?("floor")
      Location::Kind::BUILDINGS
    elsif attributes["width"] && attributes["depth"] && attributes["parent"].blank?
      Location::Kind::KINDS + Location::Kind::BUILDINGS
    else
      Location::Kind::KINDS
    end
    Location#a_building_word_is_a_floors (app/models/location.rb, around line 529) also needs || place? on its early return. Its comments, the one above validate_kinds! and the one above validates :kind both say that only a floor carries a building word, and they need rewording.
  3. The world and the script. The world file is lib/engine_sweep/worlds/the-shrine-on-the-square.yml. The script, with its why: notes, is lib/engine_sweep/scripts/a-seeded-temple-keeps-its-rooms.yml. Both are below. The script is this PR's parity/scripts file before its comments and why: notes were taken out.
  4. The pin. Move ext/renderedstep/Cargo.toml to this PR's merge commit. Vendor parity/goldens/a-seeded-temple-keeps-its-rooms.json, parity/records/a-seeded-temple-keeps-its-rooms.json and parity/worlds/the-shrine-on-the-square.sql. Add test/engine_parity/a-seeded-temple-keeps-its-rooms.checks.json (SCRIPT=a-seeded-temple-keeps-its-rooms bin/rails engine:checks). Below is the one the scratch copy wrote.

SERVER_COMMIT in .github/workflows/ci.yml still names cfe509a. That commit has neither the script nor the loader change, so runner.sh reports the new script as absent there. It moves to the game branch that carries items 1–3 once that branch exists.

lib/engine_sweep/worlds/the-shrine-on-the-square.yml
# A square and one building the file seeds as a stub with a footprint and its
# own `kind: temple`. The building is not written yet: walking into it sends
# the place call, and whatever building the model names there, the engine lays
# the inside out as the file's temple (`a-seeded-temple-keeps-its-rooms.yml`).
# Nobody is born in it, so the walk's replies name no one.
format: 2
universe:
  physics: Ordinary physics.
  technology: Lanterns, iron keys and hand tools.
  weapons: Short blades and cudgels.
  geographies: A small town around one square.
  civilizations: Townsfolk who keep a shrine on their square.
  history: The shrine is older than the square around it.
  economics: Coin and barter.
  politics: A town council keeps the peace.
  religion: The town leaves candles at the shrine.
  races:
  - name: Townsfolk
    description: Ordinary people of the town.
story:
  title: The Shrine on the Square
  genre: town adventure
  start_time: '2026-12-03T08:00:00Z'
  preface: A shrine stands on one side of the town square.
  summary: Wren goes into the shrine.
opening_scene:
  location: The Square
  characters: [Wren]
  description: You stand on the square facing the shrine's door.
  summary: Wren arrives on the square.
characters:
- fullname: Wren
  nickname: Wren
  race: Townsfolk
  age: 31
  sex: female
  is_protagonist: true
  is_companion: false
  backstory: She grew up on the square and has never been inside the shrine.
  personality: Curious and careful.
  appearance: A grey coat and a lantern.
  likes: Quiet mornings.
  dislikes: Locked doors.
  fears: The dark under the shrine.
  stats: {level: 3, hit_die: 8, strength: 12, dexterity: 12, will: 12}
locations:
- name: The Square
  detail_level: realized
  opening: true
  population: nobody
  description: A cobbled square with a well in the middle and the shrine's door on its north side.
  teaser: The town square.
  lore: Market days are held here.
- name: The Shrine
  detail_level: stub
  kind: temple
  population: nobody
  width: 12
  depth: 10
  teaser: A stone shrine with its door standing open.
connections:
- between: [The Square, The Shrine]
  distance: adjacent
  travel_method: walking
lib/engine_sweep/scripts/a-seeded-temple-keeps-its-rooms.yml
# A BUILDING THE WORLD FILE SEEDS KEEPS THE KIND THE FILE GAVE IT.
#
# The Shrine is a stub in its world file with a footprint and its own
# `kind: temple`. Walking into it sends the place call, and the fixed answer
# names a different building, `warehouse`. The engine lays the inside out as
# the file's temple all the same: the entry room is dealt `shrine` (a
# warehouse's would be `office`), and every other room takes its word from the
# temple's bands, as a floor's rooms already take theirs from the floor's own
# kind. A place with no own kind, or one that is not a building's, still
# follows the model's answer (`a-building-dealt-its-rooms.yml`).
#
# WHAT THIS WALK PINS IS THE ROWS. The engine's records for it hold every
# location row each step wrote, column for column, so each room's `kind` is a
# fact a regression would move; the entry room is furnished from the shrine
# kit as it is written, and `here` asserts that furniture.
story: The Shrine on the Square
why: a seeded building's own kind decides how its inside is laid out, whatever building the model names
steps:
- id: into-the-shrine
  type: /move The Shrine
  why: the place call answers warehouse, and the rooms are a temple's
  browser:
    token: into-the-shrine
    realizes: The Shrine
    replies:
    - purpose: location
      content:
        description: A stone hall under a low dome, candles guttering in niches.
        lore: The townsfolk built the shrine before they paved the square.
        place_kind: warehouse
        parameters:
          inside: a few rooms
          storeys_above: ground floor only
          storeys_below: a cellar
          danger: safe
          gradient: the same throughout
          hazard: none
    - purpose: location
      content:
        description: A plain stone room with a shelf of candles under a carved panel.
        lore: Everyone who comes in stops here first.
        items: []
        people: []
    - purpose: arrival
      unavailable: true
  expect:
    location: The Shrine room 1 (realized)
    exits:
    - The Shrine room 2 (stub)
    - The Shrine room 4 (stub)
    - The Square (realized)
    here:
    - altar
    - bench
    - candle
    - candle stand
    - dried flowers
    - prayer card
    - small bell
    - statue
    changed: true
    refused: false
test/engine_parity/a-seeded-temple-keeps-its-rooms.checks.json
{
  "script": "a-seeded-temple-keeps-its-rooms",
  "doctor": {
    "headline": "playable, 2 warnings",
    "findings": [
      [
        "no_arc",
        "warning",
        "this story has no arc, so no playthrough of it can ever reach an ending: there is no quest for a beat to belong to and no outcome to select. A world file's `quests:` block is where one is written",
        "manual"
      ],
      [
        "room_without_a_layout",
        "warning",
        "\"The Square\" has no layout: nobody can be given a spot in it, so what is within reach there cannot be measured",
        "manual"
      ]
    ]
  },
  "audit": {
    "headline": "1 scenes, nothing to report",
    "flags": [],
    "unjudged": []
  }
}

…y is

A place's own kind (locations.kind) now decides the sort each of its rooms
is dealt whenever that kind is a building word, floor or not: a world that
seeds "The Shrine, kind: temple" gets a temple's rooms even when the place
call answers warehouse. A place with no own kind, or one that is not a
building word, is laid out from the place call's place_kind as before.
Nothing a model is sent changes: the place call's prompt and schema are
the same, and a test holds the request byte for byte equal with and
without the stub's own kind.

A stub an exits answer wrote carries one of the room kinds, and three of
those (workshop, shop, ruin) are building words too, so such a stub is now
laid out as that building whatever place_kind says. No existing golden or
records file moved.

New world the-shrine-on-the-square (the game's loader with a building word
admitted on a stub with a footprint) and script
a-seeded-temple-keeps-its-rooms, in PASSING with a golden and records: the
place call answers warehouse, and the records hold the rooms dealt shrine,
shrine, study, storeroom and storeroom.
@calebl
calebl merged commit 1041056 into main Dec 3, 2026
4 checks passed
calebl added a commit to renderedstep/server that referenced this pull request Dec 3, 2026
The engine PR merged; between its head (4a27bc8) and the merge commit only
the engine's own CI workflow changed, so no golden, script or vector portion
moves.
calebl added a commit to renderedstep/server that referenced this pull request Dec 3, 2026
Pin renderedstep/engine#102's merge commit: a seeded building's own kind decides how its inside is laid out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant