Files

55 lines
4.2 KiB
Markdown

# Odin messages: shared candidates and Glitch gaps
Reviewed sibling Odin commit `eecb42c2364d915bc79ea99b16a7dad8f71baf1b`. No Odin files were changed.
## Sources
Paths below are relative to the Odin repository:
- `msgs/common.geno`: shared audio enums, currently populated with Odin content.
- `msgs/prop.geno`: hardware-agent command/state schemas.
- `msgs/game.geno`: GM/controller command/state schemas.
- `odin_prop_msg/src/msgs.rs` and `odin_game_msg/src/msgs.rs`: generated Rust types.
- `odin_ui/lib/models/msgs.dart`: generated Dart models.
- `odin_prop_msg/src/lib.rs`, `odin_game_msg/src/lib.rs`: subject constants.
- `odin_msg_util/src/lib.rs`: serialization and shared full-state helpers.
- `Justfile`, task `gen-msg`: invokes external `geno` for Rust serde, Rust state merging, Rust command-to-state, and Dart JSON generation.
Generator source was not found in this repository; the executable and version need to come from the owner.
## Candidates to share without room-specific fields
| Types | Existing content | Fit |
| --- | --- | --- |
| PropSystemState / PropSystemCmd | Optional name, nextPing, version; optional fullState request | Agent identity, liveness and state refresh |
| PropInfo / SystemState / SystemCmd | alive/version per named prop; fullState | GM device-health overview |
| StopwatchAction / StopwatchState / StopwatchCmd | none/start/stop/reset/stopAndReset; running/elapsedSecs; fullState | Room timer |
| GameCondition | off, ready, welcome, playing, debriefing, resetting | Overall room lifecycle, separate from cabinet lifecycle |
| Av2PropState / Av2PropCmd | Optional text and playing; fullState | Generic text/playback-shaped contract, though the existing agent is Odin's AV2 |
These are reusable schema candidates, not already activated services in the Glitch lab. Keep field order, types, optionality and enum numeric values if wire compatibility is required. Confirm nextPing's timing semantics from the system implementation before consuming it.
## Patterns to extract, not copy verbatim
- ClueState/ClueCmd combine text and playing with the Odin-specific memirEye output. Split the shared clue transport from room-specific effects.
- AudioState/AudioCmd use BackgroundMusic and SoundEffect enums containing feast/throne music and Odin-named effects. Share the mechanism with an agreed asset identifier strategy.
- AutoPilotState/AutoPilotCmd combine GameCondition with named Odin puzzles. Preserve the lifecycle enum but define Glitch's own puzzle progress.
- Prop commands commonly use optional fields for partial updates and fullState to request a snapshot.
- Props commonly report solved, but their enclosing messages are strongly tied to the named puzzle hardware.
## Transport compatibility
The checked-in Rust utilities use `rmp_serde::to_vec` for prop messages (struct fields serialize as ordered arrays), and JSON for the GM/controller messages. Subject names include `prop.system.cmd` and `prop.system.state`; other subjects are tied to Odin props.
The Glitch lab deliberately retains its separate `escape_gallery.glitch.lab.v1...` subject and named-field MessagePack contract. It is not wire-compatible with these generated Odin messages. No shared subject is subscribed or published by this lab, so it cannot command Odin devices.
For a multi-room hub, agree room scoping and device identities before sharing a broker. Sharing message types does not require sharing unscoped subjects.
## New Glitch definitions needed
Cabinet assignment/game identity; power/boot/ready/playing/won/lost; credits and score/objective progress; RFID admission and reader health; command correlation, acknowledgement, expiry and replay semantics; cabinet/session identity.
The existing lab Command/Reply/CabinetState types are an experimental boundary covering only part of this list. The Godot adapter implements that boundary behind a Rust sidecar, so the generated schema can replace it without rewriting Pac-Man.
Next agreement with the owner: extract the generic system/timer/lifecycle types into a shared package, obtain the generator, add Glitch cabinet definitions, and choose the supported browser transport. Do not reinterpret an Odin puzzle's solved/latch fields as arcade commands.