[PR #413] [MERGED] Pixelforge 0.7.0: NPC daypart schedules, a slower walk-only clock, and playtest fixes (#412) #957

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

📋 Pull Request Information

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

Base: staging ← Head: feat/pixelforge-npc-schedules


📝 Commits (9)

  • ba6b1b0 feat(pixelforge): 0.7.0 — NPC daypart schedules and a slower package clock
  • 6299de2 fix(pixelforge): make NPCs actually walk, stop them stacking, drop door-less interiors
  • d7df41d feat(pixelforge): playtest fixes and two QoL controls for 0.7.0
  • f77ca75 fix(pixelforge): stop scheduled NPCs stacking, and free the narration class on teardown
  • a4f179d Merge remote-tracking branch 'origin/staging' into feat/pixelforge-npc-schedules
  • 6605d3b fix(pixelforge): search the zone when a schedule box overflows, instead of dumping on spawn
  • 607e6a7 fix(pixelforge): take the collapsed narration panel out of the tab order
  • ac7a407 fix(pixelforge): validate the last-resort placement tile instead of assuming it
  • a00e4bf test(pixelforge): enforce the floor invariant walkableIn's totality rests on

📊 Changes

11 files changed (+1765 additions, -89 deletions)

View changed files

➕ artifacts/pixelforge-0.7.0.zip (+0 -0)
📝 packages/pixelforge/client.js (+533 -43)
📝 packages/pixelforge/manifest.json (+3 -3)
📝 packages/pixelforge/src/00-prelude.js (+4 -1)
📝 packages/pixelforge/src/20-world.js (+67 -20)
➕ packages/pixelforge/src/25-schedule.js (+159 -0)
📝 packages/pixelforge/src/30-sim.js (+147 -14)
📝 packages/pixelforge/src/60-save.js (+21 -3)
📝 packages/pixelforge/src/70-hud.js (+131 -3)
📝 packages/pixelforge/test-brief.mjs (+699 -1)
📝 scripts/build-pixelforge-package.mjs (+1 -1)

📄 Description

Linked issue

Closes #412

Why this change

Pixelforge NPCs stood at one anchor forever: the smith was at the forge at midnight, the square was as busy at 3am as at noon, and the inn filled up with nobody. The standing axis shipped in 0.6.x gave every NPC a predictable rest spot; this makes them use it, so the settlement reads as a place with a daily rhythm rather than a diorama.

Two of the fixes below are older bugs this work exposed rather than caused — most notably that NPCs have never actually moved, in any released version.

What changed

Schedules (src/25-schedule.js, new). A sparse kind × standing table maps each daypart to a location handle. The compiler bakes the handles onto each NPC as _sched during the cast loop, where the buildings/stalls/zones are still in scope: post is the working anchor, home the sleep node when it differs. A combo with nothing interesting to do names only post and behaves exactly as before, and any handle an NPC lacks falls back to post, so a template can never strand someone.

Clock (src/00-prelude.js, src/30-sim.js). 1.2 → 5 seconds per game minute, advancing only while walking. NPCs keep breathing during dialogue but time does not pass, which also prevents a daypart boundary from relocating the NPC mid-conversation. New waitUntil(daypart) jumps to the next boundary and re-places everyone.

Relocation (src/30-sim.js). Resolution fires on daypart boundaries (~4×/day): in-zone moves swap the wander box and snap only when the NPC is outside it; cross-zone moves splice between zone arrays. The movement timer is dropped on every move or its cached float position drags the token back to the old box.

Zero new save fields. _sched is runtime-only like facing/stepPhase, and placement is a pure function of the already-saved clock. simFromSaved re-resolves after clockMin/day are restored — the world is built by the constructor against the default 08:00, so without that call a chat reopened at midnight showed a town going about its morning.

Player controls (src/70-hud.js). A Wait… menu (dawn/morning/dusk/night) and a Hide narration toggle. The latter collapses the host's narration panel through the surfaceClass the host provides for exactly this purpose, and force-expands in dialogue because the turn input lives inside that panel.

Fixes

  • NPCs have never moved. stepNpcs snapped when the token was "near any integer", but NPCs always start on an exact tile and the shipped fixed 1/60s step covers 0.027 tiles — inside the 0.05 band. Every move was cancelled on its first frame; three in-game days produced zero frames with a live direction. The snap now tests the remembered destination tile. Pre-existing since the prototype port.
  • Shared boxes stacked the cast on one tile. Most residents resolve to the same public handle by day and a household shares one home, and both placement helpers returned the box centre — so up to six NPCs landed on one plaza tile, and because talk-targeting picks the nearest with a strict <, everyone under the top sprite was unreachable. Placement now starts from a stable per-NPC hash inside the box; a private, meaningful placement opts out via spread:false so a stall merchant still stands at their counter.
  • NPCs walked through each other. Placement refused a shared tile but the wander step only checked terrain.
  • Interior places that never claimed a building lot compiled a named, NPC-populated room with no portal in either direction — anyone homed there was stranded and un-talkable. Such a place is now dropped, matching the file's existing policy for an unanchorable feature.
  • NPCs stood in doorways. Door tiles are deliberately non-solid so the player can walk through them; both the wander step and the placement helpers now refuse door and portal tiles.
  • Trees spawned under roof overhangs. The overhang rows are grass and non-solid, so the existing checks missed them and the roof drew over the trunk.
  • The talking partner drifted away mid-conversation, and a stall merchant roamed the frontage instead of manning the stall.
  • The header pinned a stale location. The second half of the location pill is the host's committed party location, which only moves on a narrated or Travel transition — walking is package-local, so it stuck ("The Tailings — The Slag Bar") and on the start zone could even show a location from a different world in the same chat. It is now shown only when it is genuinely this zone's binding, and never for the exterior.
  • A save whose zone no longer exists kept the old interior coordinates, clamped into a much larger map; the solid-tile rescue only fires if those land in a wall, so the player silently reappeared in a random corner. It now lands at the resolved zone's spawn.

Package and security impact

  • Affected package IDs: pixelforge only.
  • Engine compatibility impact: none — engine range unchanged (2.4.3 ≤ v < 4.0.0), no engine API surface touched, no new permissions or entrypoints.
  • Restart, storage, update, or uninstall impact: none. No save-format change: the snapshot serializes the same fixed field list, and every existing save restores correctly (schedules re-derive from its own saved clock).
  • Catalog: unchanged. Pixelforge is marked incomplete (#410), so its rebuild no longer writes a catalog entry at all.

Validation

  • node scripts/validate-catalog.mjs passes locally — Catalog valid: 35 packages (24 agents, 11 features), lanes v2=35, v3=35
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry — client.js sha256 verified against the manifest at each commit
  • 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

Validated against the committed content in a clean core.autocrlf=false worktree (a Windows checkout inflates byte sizes and false-fails the catalog validator, unrelated to this PR): catalog valid, test-brief.mjs all cases pass, Prettier and ESLint clean on every packages/pixelforge/src/*.js and the build script.

Both new regressions were verified to fail without their fix, not merely to pass with it:

  • Crowded-plaza collision sweep: 1,474 colliding samples before the fix, 0 after.
  • Save restore with an unresolvable zone: fails with "the player lands on the spawn tile, not stale coordinates" when the guard is reverted.

Measured against the reviewers' own baselines: wander went from 0 frames with a live direction in three in-game days to 2,629, with every NPC reaching a new tile within two in-game hours; shared-box hiding went from 1089/1915 (56.9%) to 0/1600; stranded door-less zones from 515 instances across 3,000 worlds to 0 across 600.

A 16-agent adversarial review (correctness, regression, brute-force placement) raised 13 findings, of which 4 were confirmed and fixed and 9 were refuted on inspection. New harness cases 14–14h cover handle integrity, daypart thresholds, per-kind day/night behaviour, the cross-zone splice with a no-duplication check, no-solid-spawn and no-doorway occupancy at every daypart, idempotent resolution, the GM hold seam, portal-graph reachability for every compiled zone, wandering at the real fixed timestep, and a rebuild-at-the-same-clock equality that pins the zero-save-fields property.

Live-playtested in a running Engine across two generated worlds (a cozy village and a sci-fi colony); every fix above except the save-restore one came from that playtest.

Still owed by a human: an install/update pass through the Engine package browser and a modes/restart/uninstall sweep (boxes left unchecked above).

Documentation impact

  • No documentation changes needed — the package's docs/brief-schema.md describes the sealed brief contract, which is unchanged; schedules add no brief fields.
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

The feature is world simulation rather than UI chrome. Screenshots of the seeded colony (stall by day, the same NPCs bedded down at the inn after dark) can be added after the human install pass if wanted.

Summary by CodeRabbit

  • New Features

    • Added time-based NPC schedules with daily relocation and improved wandering.
    • Added controls for waiting until key times of day and collapsing narration.
    • World displays now show the current time of day.
    • NPCs avoid blocked or occupied locations and pause appropriately during dialogue.
  • Bug Fixes

    • Improved save restoration when saved locations are unavailable.
    • Fixed NPC placement, movement, collision avoidance, and interior zone handling.
  • Release

    • Updated Pixelforge to version 0.7.0.

🔄 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/413 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/17/2026 **Status:** ✅ Merged **Merged:** 8/17/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/pixelforge-npc-schedules` --- ### 📝 Commits (9) - [`ba6b1b0`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ba6b1b02c873bcd693688f79143ed0b42956986d) feat(pixelforge): 0.7.0 — NPC daypart schedules and a slower package clock - [`6299de2`](https://github.com/Pasta-Devs/Marinara-Agents/commit/6299de2d5dbc9207dc7983920c7d84c4ff9b01f5) fix(pixelforge): make NPCs actually walk, stop them stacking, drop door-less interiors - [`d7df41d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/d7df41da0de6a40da9ec32b0c436fa841791f0c2) feat(pixelforge): playtest fixes and two QoL controls for 0.7.0 - [`f77ca75`](https://github.com/Pasta-Devs/Marinara-Agents/commit/f77ca75d10f0ee846a2e2c3efab99a77488b2565) fix(pixelforge): stop scheduled NPCs stacking, and free the narration class on teardown - [`a4f179d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a4f179d7573ffa71e3842354e102a145e760fb3d) Merge remote-tracking branch 'origin/staging' into feat/pixelforge-npc-schedules - [`6605d3b`](https://github.com/Pasta-Devs/Marinara-Agents/commit/6605d3b41da1b52fa6a405e7f51da26d927a4c3c) fix(pixelforge): search the zone when a schedule box overflows, instead of dumping on spawn - [`607e6a7`](https://github.com/Pasta-Devs/Marinara-Agents/commit/607e6a728389213148715bc9e00a6ef5f109bc21) fix(pixelforge): take the collapsed narration panel out of the tab order - [`ac7a407`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ac7a407f3e0bc9a5630de20cf6bc3d8a82ed3f6d) fix(pixelforge): validate the last-resort placement tile instead of assuming it - [`a00e4bf`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a00e4bf798746089f0ab3c2aa3e360068af19320) test(pixelforge): enforce the floor invariant walkableIn's totality rests on ### 📊 Changes **11 files changed** (+1765 additions, -89 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/pixelforge-0.7.0.zip` (+0 -0) 📝 `packages/pixelforge/client.js` (+533 -43) 📝 `packages/pixelforge/manifest.json` (+3 -3) 📝 `packages/pixelforge/src/00-prelude.js` (+4 -1) 📝 `packages/pixelforge/src/20-world.js` (+67 -20) ➕ `packages/pixelforge/src/25-schedule.js` (+159 -0) 📝 `packages/pixelforge/src/30-sim.js` (+147 -14) 📝 `packages/pixelforge/src/60-save.js` (+21 -3) 📝 `packages/pixelforge/src/70-hud.js` (+131 -3) 📝 `packages/pixelforge/test-brief.mjs` (+699 -1) 📝 `scripts/build-pixelforge-package.mjs` (+1 -1) </details> ### 📄 Description ## Linked issue Closes #412 ## Why this change Pixelforge NPCs stood at one anchor forever: the smith was at the forge at midnight, the square was as busy at 3am as at noon, and the inn filled up with nobody. The `standing` axis shipped in 0.6.x gave every NPC a predictable rest spot; this makes them use it, so the settlement reads as a place with a daily rhythm rather than a diorama. Two of the fixes below are older bugs this work exposed rather than caused — most notably that **NPCs have never actually moved**, in any released version. ## What changed **Schedules (`src/25-schedule.js`, new).** A sparse `kind × standing` table maps each daypart to a location handle. The compiler bakes the handles onto each NPC as `_sched` during the cast loop, where the buildings/stalls/zones are still in scope: `post` is the working anchor, `home` the sleep node when it differs. A combo with nothing interesting to do names only `post` and behaves exactly as before, and any handle an NPC lacks falls back to `post`, so a template can never strand someone. **Clock (`src/00-prelude.js`, `src/30-sim.js`).** 1.2 → 5 seconds per game minute, advancing **only while walking**. NPCs keep breathing during dialogue but time does not pass, which also prevents a daypart boundary from relocating the NPC mid-conversation. New `waitUntil(daypart)` jumps to the next boundary and re-places everyone. **Relocation (`src/30-sim.js`).** Resolution fires on daypart boundaries (~4×/day): in-zone moves swap the wander box and snap only when the NPC is outside it; cross-zone moves splice between zone arrays. The movement timer is dropped on every move or its cached float position drags the token back to the old box. **Zero new save fields.** `_sched` is runtime-only like `facing`/`stepPhase`, and placement is a pure function of the already-saved clock. `simFromSaved` re-resolves *after* `clockMin`/`day` are restored — the world is built by the constructor against the default 08:00, so without that call a chat reopened at midnight showed a town going about its morning. **Player controls (`src/70-hud.js`).** A **Wait…** menu (dawn/morning/dusk/night) and a **Hide narration** toggle. The latter collapses the host's narration panel through the `surfaceClass` the host provides for exactly this purpose, and force-expands in dialogue because the turn input lives inside that panel. ### Fixes - **NPCs have never moved.** `stepNpcs` snapped when the token was "near any integer", but NPCs always start on an exact tile and the shipped fixed 1/60s step covers 0.027 tiles — inside the 0.05 band. Every move was cancelled on its first frame; three in-game days produced zero frames with a live direction. The snap now tests the remembered destination tile. Pre-existing since the prototype port. - **Shared boxes stacked the cast on one tile.** Most residents resolve to the same `public` handle by day and a household shares one `home`, and both placement helpers returned the box centre — so up to six NPCs landed on one plaza tile, and because talk-targeting picks the nearest with a strict `<`, everyone under the top sprite was unreachable. Placement now starts from a stable per-NPC hash inside the box; a private, meaningful placement opts out via `spread:false` so a stall merchant still stands at their counter. - **NPCs walked through each other.** Placement refused a shared tile but the wander step only checked terrain. - **Interior places that never claimed a building lot** compiled a named, NPC-populated room with no portal in either direction — anyone homed there was stranded and un-talkable. Such a place is now dropped, matching the file's existing policy for an unanchorable feature. - **NPCs stood in doorways.** Door tiles are deliberately non-solid so the player can walk through them; both the wander step and the placement helpers now refuse door and portal tiles. - **Trees spawned under roof overhangs.** The overhang rows are grass and non-solid, so the existing checks missed them and the roof drew over the trunk. - **The talking partner drifted away** mid-conversation, and a stall merchant roamed the frontage instead of manning the stall. - **The header pinned a stale location.** The second half of the location pill is the host's committed party location, which only moves on a narrated or Travel transition — walking is package-local, so it stuck ("The Tailings — The Slag Bar") and on the start zone could even show a location from a *different* world in the same chat. It is now shown only when it is genuinely this zone's binding, and never for the exterior. - **A save whose zone no longer exists** kept the old interior coordinates, clamped into a much larger map; the solid-tile rescue only fires if those land in a wall, so the player silently reappeared in a random corner. It now lands at the resolved zone's spawn. ## Package and security impact - Affected package IDs: `pixelforge` only. - Engine compatibility impact: none — engine range unchanged (2.4.3 ≤ v < 4.0.0), no engine API surface touched, no new permissions or entrypoints. - Restart, storage, update, or uninstall impact: none. **No save-format change**: the snapshot serializes the same fixed field list, and every existing save restores correctly (schedules re-derive from its own saved clock). - Catalog: unchanged. Pixelforge is marked incomplete (#410), so its rebuild no longer writes a catalog entry at all. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [x] `node scripts/validate-catalog.mjs` passes locally — `Catalog valid: 35 packages (24 agents, 11 features)`, lanes `v2=35, v3=35` - [x] `git diff --check` passes locally - [x] Rebuilt every affected manifest, payload, artifact, and catalog entry — `client.js` sha256 verified against the manifest at each commit - [ ] 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 Validated against the committed content in a clean `core.autocrlf=false` worktree (a Windows checkout inflates byte sizes and false-fails the catalog validator, unrelated to this PR): catalog valid, `test-brief.mjs` all cases pass, Prettier and ESLint clean on every `packages/pixelforge/src/*.js` and the build script. Both new regressions were verified to fail *without* their fix, not merely to pass with it: - Crowded-plaza collision sweep: **1,474 colliding samples** before the fix, **0** after. - Save restore with an unresolvable zone: fails with "the player lands on the spawn tile, not stale coordinates" when the guard is reverted. Measured against the reviewers' own baselines: wander went from **0 frames with a live direction in three in-game days** to 2,629, with every NPC reaching a new tile within two in-game hours; shared-box hiding went from **1089/1915 (56.9%)** to **0/1600**; stranded door-less zones from **515 instances across 3,000 worlds** to **0 across 600**. A 16-agent adversarial review (correctness, regression, brute-force placement) raised 13 findings, of which 4 were confirmed and fixed and 9 were refuted on inspection. New harness cases 14–14h cover handle integrity, daypart thresholds, per-kind day/night behaviour, the cross-zone splice with a no-duplication check, no-solid-spawn and no-doorway occupancy at every daypart, idempotent resolution, the GM hold seam, portal-graph reachability for every compiled zone, wandering at the real fixed timestep, and a rebuild-at-the-same-clock equality that pins the zero-save-fields property. Live-playtested in a running Engine across two generated worlds (a cozy village and a sci-fi colony); every fix above except the save-restore one came from that playtest. Still owed by a human: an install/update pass through the Engine package browser and a modes/restart/uninstall sweep (boxes left unchecked above). ## Documentation impact - [x] No documentation changes needed — the package's `docs/brief-schema.md` describes the sealed brief contract, which is unchanged; schedules add no brief fields. - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) The feature is world simulation rather than UI chrome. Screenshots of the seeded colony (stall by day, the same NPCs bedded down at the inn after dark) can be added after the human install pass if wanted. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added time-based NPC schedules with daily relocation and improved wandering. * Added controls for waiting until key times of day and collapsing narration. * World displays now show the current time of day. * NPCs avoid blocked or occupied locations and pause appropriately during dialogue. * **Bug Fixes** * Improved save restoration when saved locations are unavailable. * Fixed NPC placement, movement, collision avoidance, and interior zone handling. * **Release** * Updated Pixelforge to version 0.7.0. <!-- 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:32:41 +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#957
No description provided.