[PR #487] [MERGED] Pixelforge 0.9.0: cast bindings, a city scale, and four placement bugs (#486) #994

Closed
opened 2026-10-20 17:33:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/487
Author: @kolacheee
Created: 8/21/2026
Status: ✅ Merged
Merged: 8/21/2026
Merged by: @kolacheee

Base: staging ← Head: feat/pixelforge-cast-bindings


📝 Commits (10+)

  • c04d713 feat(pixelforge): a brief can say where somebody works
  • 1caca57 fix(pixelforge): a named worker holds their post through the day
  • 832b683 fix(pixelforge): nobody loses their bed to somebody who is also leaving
  • 4c02453 feat(pixelforge): living in a building the brief named is keeping it
  • b088a21 fix(pixelforge): one head per building, not everyone under its roof
  • 6b9f41c fix(pixelforge): a household number is an id space, not an occupancy bound
  • 2242db9 feat(pixelforge): a city scale, and settlements keep the features they were given
  • 21822fb chore(pixelforge): open 0.9.0, and an unknown room purpose throws
  • e717875 Merge remote-tracking branch 'origin/staging' into feat/pixelforge-cast-bindings
  • 03c94d7 fix(pixelforge): a named workplace no longer switches off the night watch

📊 Changes

10 files changed (+1334 additions, -157 deletions)

View changed files

➕ artifacts/pixelforge-0.9.0.zip (+0 -0)
📝 packages/pixelforge/client.js (+312 -72)
📝 packages/pixelforge/docs/brief-schema.md (+25 -8)
📝 packages/pixelforge/manifest.json (+3 -3)
📝 packages/pixelforge/src/18-brief.js (+53 -22)
📝 packages/pixelforge/src/20-world.js (+185 -20)
📝 packages/pixelforge/src/25-schedule.js (+26 -2)
📝 packages/pixelforge/src/30-sim.js (+47 -27)
📝 packages/pixelforge/test-brief.mjs (+682 -2)
📝 scripts/build-pixelforge-package.mjs (+1 -1)

📄 Description

Linked issue

Closes #486

Why this change

0.8.0 gave the world somewhere for people to be — interiors, beds, rooms, floors. This release is about who is actually in them.

Only one relation could put a person inside a building: ownership. Ownership is structurally one building per person and one person per building — seenSpecial dedupes the special, b.owner is a single reference. So every named building had room for exactly one working adult and no staff. A sanctuary with two acolytes, a market with several sellers, a shop with an assistant: none of it was expressible at any price, and everyone past the owner stood in the plaza. Walk into a church at noon and it was empty by construction.

What changed

A brief can say where somebody works. workplace resolves exactly like home — exact, then Unicode-folded, never substring, because a guessed binding is forever. It differs in one deliberate way: unresolved falls to none rather than to the settlement root, since "works at the settlement" is not a box anyone can stand in, and the drop is recorded in _repairs instead of vanishing. Emitted only when it resolves, so a brief that never names one compiles byte-identically.

And they stay there. Six of the twelve cast kinds have no schedule row at all and fall to *:resident, whose day entry is the plaza — so a named worker held their post at dawn and dusk and left it for the eleven hours of daylight. A worker tier fixes that, keyed on having been named rather than on a kind, the same way the keeper tier is keyed on holding a building. It sits below the per-kind rows: the review caught that placing it above silently switched off a guard's night watch.

Keeping a building is not sleeping in it. PLACE_BOUND_SPECIALS was {sanctuary}, so exactly one keeper was possible in an entire world; everyone else the brief housed in a named building walked out at dawn. Widened to any building-kind zone, then narrowed to one head per building — first resident in cast order — because the first version held ten lodgers indoors around the clock, two of them standing on their own bunks.

A household number is an id space, not an occupancy bound. One constant was answering two unrelated questions — which group you are in, and how many may share it — which made a convent, a barracks and a boarding house inexpressible.

A city scale, 96×72: the first scale where the ground outruns the cast, so scale.buildings can finally bind.

Bugs fixed on the way — three of four were not what this release set out to do

  • Nobody loses their bed to somebody who is also leaving. Placement asked "is this tile taken" against the previous daypart's positions, in one pass, while half those people were on their way out. A sleeper whose bed was still warm under a housemate got shunted to the nearest free tile and stayed there while the housemate walked off. Ordering-dependent, so a different NPC order stranded a different person, and jumping straight to a daypart never triggered it at all.
  • A live contract violation. The oversized-household split escaped its own cap and sealed household numbers above the maximum schema() itself publishes — 263 members across 400 seeds — and mutated a Map while iterating it. Deleting the pass retired both.
  • Settlements silently dropped the features the model authored. With four declared together: outpost 2/4, hamlet 2/4, village 0/4, town 2/4, city 4/4 — the roomiest map was the only one that worked. Two causes: the four corners were the only candidates, and the 9×6 footprint they were tested against was a fiction (market-stalls paints three tables on one row; landmark-stone paints a single tile). Now 3/4, 4/4, 3/4, 4/4, 4/4.
  • An unknown room purpose throws, as an unknown feature tag already did at startup. It used to carve the walls, cut the door, and furnish nothing — a sealed empty box that looks deliberate.

Package and security impact

  • Affected package IDs: pixelforge only. Engine compatibility unchanged (2.4.3 ≤ v < 4.0.0), no new permissions or entrypoints.
  • No save-format change and zero new save fields. _sched is runtime-only and re-baked every compile; the save snapshot is untouched. A 0.8 save reopens and rebuilds, and the existing solid-tile rescue already covers a stored position landing inside a newly-placed feature.
  • World Maps: unchanged. No new exported rows; the additive-with-no-delete route is not touched.
  • Catalog: unchanged — pixelforge is marked incomplete (#410), so its rebuild writes no catalog entry.

Validation

  • node packages/pixelforge/test-brief.mjs passes — brief validator + compiler: all cases passed
  • Prettier and ESLint clean on every touched packages/pixelforge/src/*.js
  • client.js sha256 and byte count match manifest.json (all 11 entries)
  • Determinism: same seed + brief rebuilds byte-identically, including across theme alternation
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Live-playtested in a running Engine. The maintainer walked the first compiled city and confirmed on screen: the map's larger footprint and building count, four named features at the corners, a three-person household sharing one house, and floors, cellars and the bell tower all working.

Every change ships with a regression verified failing before the fix, and where a case could have passed on a technicality it was re-run with its schema or flag assertions stripped so the behavioural assertion had to fail on its own.

This branch also went through a dedicated pre-PR review gate, which measured rather than read: ~2,600 builds and 430+ schedule resolutions across scales, prosperities, seeds and themes. It found no correctness bugs and no regressions, and confirmed the bedding invariant (every resident gets a distinct sleeping place) holds at the widened household cap. It found one reachable behaviour nobody had decided — a guard given a workplace stopped keeping the night watch — which is fixed in the final commit, and seven comments left false by this branch's own changes, also fixed there.

Known gap: no harness case runs the full checkWorld invariant sweep on a city world. City invariants were covered by review probes rather than by the tracked suite.

Documentation impact

  • Updated packages/pixelforge/docs/brief-schema.md — the workplace field, the city scale and its numeric bucket tier, the household range, the guest-berth range, and the lot enumeration.
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

Screenshots of the first compiled city are in #486.

Summary by CodeRabbit

  • New Features

    • Added a city-scale map option supporting 96×72 dimensions and up to 40 buildings.
    • NPCs can be assigned workplaces, with schedules keeping workers at work during the day and home at night.
    • Expanded household identifiers to support up to 10 members without splitting larger households.
    • Increased city capacity for lots and inn guest berths.
  • Bug Fixes

    • Improved NPC placement during schedule changes while preserving valid positions and home beds.
    • Enhanced feature placement to avoid buildings and roads and use available space more reliably.
    • Unresolved workplace references are safely cleared.
    • Prevented empty rooms when no suitable furnishing is available.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/487 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/21/2026 **Status:** ✅ Merged **Merged:** 8/21/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/pixelforge-cast-bindings` --- ### 📝 Commits (10+) - [`c04d713`](https://github.com/Pasta-Devs/Marinara-Agents/commit/c04d713bd285e4f8af89ce68136f788503f46c72) feat(pixelforge): a brief can say where somebody works - [`1caca57`](https://github.com/Pasta-Devs/Marinara-Agents/commit/1caca57bcf5bc012da288ee115d777ffbdbbeac2) fix(pixelforge): a named worker holds their post through the day - [`832b683`](https://github.com/Pasta-Devs/Marinara-Agents/commit/832b683c36368481d2c9b684488fc7808836580a) fix(pixelforge): nobody loses their bed to somebody who is also leaving - [`4c02453`](https://github.com/Pasta-Devs/Marinara-Agents/commit/4c024532581f794ce30ab7292d1ae24a308f22ea) feat(pixelforge): living in a building the brief named is keeping it - [`b088a21`](https://github.com/Pasta-Devs/Marinara-Agents/commit/b088a21429842b1a0648d95b09e74b2fc9dc3fac) fix(pixelforge): one head per building, not everyone under its roof - [`6b9f41c`](https://github.com/Pasta-Devs/Marinara-Agents/commit/6b9f41c0055a9435b486d2c6688c5011ff07f5f6) fix(pixelforge): a household number is an id space, not an occupancy bound - [`2242db9`](https://github.com/Pasta-Devs/Marinara-Agents/commit/2242db93b5f90397101306c221ec92ecbb25f423) feat(pixelforge): a city scale, and settlements keep the features they were given - [`21822fb`](https://github.com/Pasta-Devs/Marinara-Agents/commit/21822fb4520f7748f08921319ca620b2bf5f7666) chore(pixelforge): open 0.9.0, and an unknown room purpose throws - [`e717875`](https://github.com/Pasta-Devs/Marinara-Agents/commit/e7178758067d1874525d4eb3c7bf34312eda0804) Merge remote-tracking branch 'origin/staging' into feat/pixelforge-cast-bindings - [`03c94d7`](https://github.com/Pasta-Devs/Marinara-Agents/commit/03c94d79e36e6cc117cc04712ad9d69e35111a8c) fix(pixelforge): a named workplace no longer switches off the night watch ### 📊 Changes **10 files changed** (+1334 additions, -157 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/pixelforge-0.9.0.zip` (+0 -0) 📝 `packages/pixelforge/client.js` (+312 -72) 📝 `packages/pixelforge/docs/brief-schema.md` (+25 -8) 📝 `packages/pixelforge/manifest.json` (+3 -3) 📝 `packages/pixelforge/src/18-brief.js` (+53 -22) 📝 `packages/pixelforge/src/20-world.js` (+185 -20) 📝 `packages/pixelforge/src/25-schedule.js` (+26 -2) 📝 `packages/pixelforge/src/30-sim.js` (+47 -27) 📝 `packages/pixelforge/test-brief.mjs` (+682 -2) 📝 `scripts/build-pixelforge-package.mjs` (+1 -1) </details> ### 📄 Description ## Linked issue Closes #486 ## Why this change 0.8.0 gave the world somewhere for people to be — interiors, beds, rooms, floors. This release is about who is actually in them. Only one relation could put a person inside a building: ownership. Ownership is structurally **one building per person and one person per building** — `seenSpecial` dedupes the special, `b.owner` is a single reference. So every named building had room for exactly one working adult and no staff. A sanctuary with two acolytes, a market with several sellers, a shop with an assistant: none of it was expressible at any price, and everyone past the owner stood in the plaza. Walk into a church at noon and it was empty by construction. ## What changed **A brief can say where somebody works.** `workplace` resolves exactly like `home` — exact, then Unicode-folded, never substring, because a guessed binding is forever. It differs in one deliberate way: unresolved falls to **none** rather than to the settlement root, since "works at the settlement" is not a box anyone can stand in, and the drop is recorded in `_repairs` instead of vanishing. Emitted only when it resolves, so a brief that never names one compiles byte-identically. **And they stay there.** Six of the twelve cast kinds have no schedule row at all and fall to `*:resident`, whose **day** entry is the plaza — so a named worker held their post at dawn and dusk and left it for the eleven hours of daylight. A `worker` tier fixes that, keyed on having been *named* rather than on a kind, the same way the keeper tier is keyed on holding a building. It sits **below** the per-kind rows: the review caught that placing it above silently switched off a guard's night watch. **Keeping a building is not sleeping in it.** `PLACE_BOUND_SPECIALS` was `{sanctuary}`, so exactly one keeper was possible in an entire world; everyone else the brief housed in a named building walked out at dawn. Widened to any building-kind zone, then narrowed to **one head per building** — first resident in cast order — because the first version held ten lodgers indoors around the clock, two of them standing on their own bunks. **A household number is an id space, not an occupancy bound.** One constant was answering two unrelated questions — which group you are in, and how many may share it — which made a convent, a barracks and a boarding house inexpressible. **A `city` scale**, 96×72: the first scale where the ground outruns the cast, so `scale.buildings` can finally bind. ### Bugs fixed on the way — three of four were not what this release set out to do - **Nobody loses their bed to somebody who is also leaving.** Placement asked "is this tile taken" against the *previous* daypart's positions, in one pass, while half those people were on their way out. A sleeper whose bed was still warm under a housemate got shunted to the nearest free tile and stayed there while the housemate walked off. Ordering-dependent, so a different NPC order stranded a different person, and jumping straight to a daypart never triggered it at all. - **A live contract violation.** The oversized-household split escaped its own cap and sealed household numbers above the maximum `schema()` itself publishes — 263 members across 400 seeds — and mutated a Map while iterating it. Deleting the pass retired both. - **Settlements silently dropped the features the model authored.** With four declared together: outpost 2/4, hamlet 2/4, **village 0/4**, town 2/4, city 4/4 — the roomiest map was the only one that worked. Two causes: the four corners were the only candidates, and the 9×6 footprint they were tested against was a fiction (`market-stalls` paints three tables on one row; `landmark-stone` paints a single tile). Now 3/4, 4/4, 3/4, 4/4, 4/4. - **An unknown room purpose throws**, as an unknown feature tag already did at startup. It used to carve the walls, cut the door, and furnish nothing — a sealed empty box that looks deliberate. ## Package and security impact - Affected package IDs: `pixelforge` only. Engine compatibility unchanged (2.4.3 ≤ v < 4.0.0), no new permissions or entrypoints. - **No save-format change and zero new save fields.** `_sched` is runtime-only and re-baked every compile; the save snapshot is untouched. A 0.8 save reopens and rebuilds, and the existing solid-tile rescue already covers a stored position landing inside a newly-placed feature. - **World Maps:** unchanged. No new exported rows; the additive-with-no-delete route is not touched. - Catalog: unchanged — `pixelforge` is marked incomplete (#410), so its rebuild writes no catalog entry. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [x] `node packages/pixelforge/test-brief.mjs` passes — `brief validator + compiler: all cases passed` - [x] Prettier and ESLint clean on every touched `packages/pixelforge/src/*.js` - [x] `client.js` sha256 and byte count match `manifest.json` (all 11 entries) - [x] Determinism: same seed + brief rebuilds byte-identically, including across theme alternation - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes **Live-playtested in a running Engine.** The maintainer walked the first compiled city and confirmed on screen: the map's larger footprint and building count, four named features at the corners, a three-person household sharing one house, and floors, cellars and the bell tower all working. Every change ships with a regression **verified failing before the fix**, and where a case could have passed on a technicality it was re-run with its schema or flag assertions stripped so the behavioural assertion had to fail on its own. This branch also went through a dedicated pre-PR review gate, which measured rather than read: ~2,600 builds and 430+ schedule resolutions across scales, prosperities, seeds and themes. It found no correctness bugs and no regressions, and confirmed the bedding invariant (every resident gets a distinct sleeping place) holds at the widened household cap. It found one reachable behaviour nobody had decided — a guard given a workplace stopped keeping the night watch — which is fixed in the final commit, and seven comments left false by this branch's own changes, also fixed there. **Known gap:** no harness case runs the full `checkWorld` invariant sweep on a *city* world. City invariants were covered by review probes rather than by the tracked suite. ## Documentation impact - [x] Updated `packages/pixelforge/docs/brief-schema.md` — the `workplace` field, the `city` scale and its numeric bucket tier, the household range, the guest-berth range, and the lot enumeration. - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) Screenshots of the first compiled city are in #486. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a city-scale map option supporting 96×72 dimensions and up to 40 buildings. * NPCs can be assigned workplaces, with schedules keeping workers at work during the day and home at night. * Expanded household identifiers to support up to 10 members without splitting larger households. * Increased city capacity for lots and inn guest berths. * **Bug Fixes** * Improved NPC placement during schedule changes while preserving valid positions and home beds. * Enhanced feature placement to avoid buildings and roads and use available space more reliably. * Unresolved workplace references are safely cleared. * Prevented empty rooms when no suitable furnishing is available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-20 17:33:03 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#994
No description provided.