Skip to content

Sync shard room objects and visuals - #216

Merged
Mattie merged 2 commits into
masterfrom
codex/fix-shard-room-object-sync
Jun 15, 2026
Merged

Sync shard room objects and visuals#216
Mattie merged 2 commits into
masterfrom
codex/fix-shard-room-object-sync

Conversation

@Mattie

@Mattie Mattie commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Fix room 26 shard spawning so YAML room-object mutations sync back into the live room store, then add the matching frontend shard and amulet ground-object visuals.

Changes

  • Seed YAML room scripts from live room-object state before handling commands.
  • Persist changed YAML room objects through the live RoomScriptEngine setter and emit sender-inclusive room_objects refresh events.
  • Add frontend ground-object visuals for shard (💧) and amulet (🧿).
  • Add targeted backend and frontend coverage for shard sync and visual rendering.

Motivation & Context

Intent

  • Room 26 should leave the spawned shard visible in the live room object list after cry ashes / weep ashes, matching the legacy behavior where the object array is updated directly.
  • Clients should refresh immediately when YAML room scripts mutate room objects, including the actor’s own client.
  • The shard and amulet should read cleanly in console text and room/object badges.

Context

  • Issue / ticket: user-reported room 26 shard object appearing and then vanishing from the live client.
  • Legacy parity / constraints / related work:
    • Legacy pgmlobj(&gmobjs[43]) modifies the live room object array directly.
    • The modern YAML engine had its own room-object state, so the mutation needed to be synced back into the live store.

Legacy code being ported

  • Source (legacy) locations:
    • legacy/KYRROUS.C / room 26 ash-tree path that creates shard object 43.
  • New locations:
    • backend/kyrgame/yaml_rooms.pyYamlRoomEngine.set_room_objects helper.
    • backend/kyrgame/rooms.py — YAML room-object seeding, sync, and room_objects event emission.
    • frontend/src/data/groundObjectVisuals.ts — shard and amulet visual definitions.
    • frontend/src/components/* tests — room panel, console, and inline text visual coverage.
  • Intentional differences from legacy behavior:
    • Event fan-out uses the existing WebSocket room_objects payload shape so modern clients refresh consistently.
  • Known missing pieces / follow-ups:
    • None known for this scope.

Testing

  • cd legacy && make -f ELWKYR (Worldgroup build)
  • pytest backend/tests/rooms/test_room26_ashtre.py
  • pytest backend/tests
  • cd backend && python -m kyrgame.scripts.package_content --output ../legacy/Dist/offline-content.json
  • cd frontend && npm.cmd test -- GemstoneText --run
  • cd frontend && npm.cmd test -- MudConsole --run
  • cd frontend && npm.cmd test -- RoomPanel --run
  • cd frontend && npm.cmd run build

Details:

  • Verified the live checkout at http://127.0.0.1:5173 renders A 💧 shard rests near an 🧿 amulet. and reports shard textShadow: none.
  • Screenshot: frontend/screenshots/shard-amulet-ground-object-visuals.png.

Manual E2E Demo Checklist

  • Start the local backend and frontend.
  • Enter room 26 with an empty-enough room object list.
  • Run cry ashes or weep ashes.
  • Confirm the ASHM00/ASHM01 text appears first.
  • Confirm the room object refresh keeps shard object 43 visible for the actor and other clients.
  • Confirm the shard renders as 💧 shard in blue with no text outline.
  • Confirm an amulet ground object renders as 🧿 amulet where it appears in room text or badges.

Risk & Rollback

  • Risk level: low
  • Rollback plan:
    • Revert this PR to restore the previous YAML room-object behavior and frontend visual map.

UI Changes

  • Screenshots / description:
    • Added frontend/screenshots/shard-amulet-ground-object-visuals.png showing shard and amulet inline rendering.

@Mattie
Mattie marked this pull request as ready for review June 15, 2026 16:34
@Mattie
Mattie requested a review from Copilot June 15, 2026 16:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a state-sync gap between YAML room scripts and the live room object store (notably for room 26 shard spawning), and adds matching frontend visuals so shard/amulet ground objects render consistently across room text, console output, and badges.

Changes:

  • Seed YAML room scripts’ room-object state from the live room object list before handling commands, then persist any YAML room-object mutations back into the live store and emit a sender-inclusive room_objects refresh event.
  • Add ground-object visual definitions for shard (💧) and amulet (🧿), plus targeted frontend tests covering inline rendering, console listing, and room panel badges.
  • Add/extend backend tests to verify live persistence via the RoomScriptEngine room-objects setter and correct room_objects event emission semantics.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
backend/kyrgame/rooms.py Seeds YAML engine room objects from live state, persists YAML mutations through set_room_objects, and emits sender-inclusive room_objects refresh events.
backend/kyrgame/yaml_rooms.py Adds set_room_objects to allow external seeding/overwriting of YAML engine room-object state.
backend/tests/rooms/test_room26_ashtre.py Adds assertions/tests ensuring shard persistence to the live store and a single sender-inclusive room_objects event when shard spawns.
frontend/src/data/groundObjectVisuals.ts Adds shard/amulet visuals and tightens typing via satisfies for the visual map.
frontend/src/components/RoomPanel.test.tsx Extends room panel badge coverage to include amulet and shard.
frontend/src/components/MudConsole.test.tsx Extends console ground-object listing coverage to include amulet and shard rendering.
frontend/src/components/GemstoneText.test.tsx Adds dedicated assertions for shard/amulet inline visual rendering and styling.
docs/PORTING_PLAN.md Updates porting checklist to reflect the new YAML↔live room-object sync capability and event behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Mattie
Mattie merged commit 3dc7242 into master Jun 15, 2026
1 check passed
@Mattie
Mattie deleted the codex/fix-shard-room-object-sync branch June 15, 2026 16:49
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.

2 participants