Workshop briefs for the larger spikes identified by the architecture review audit: knowledge graph & information boundaries, observer snapshot pipeline, NPC AI state machines, save/load architecture, and map authoring pipeline. Each includes participants, key questions, input documents, and expected outputs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3.9 KiB
Save/Load Architecture Workshop Brief
Goal: Design the save/load system — serialization strategy, versioning, migration, and relationship to tier serialization. Ticket: #354 (epic) Priority: MEDIUM — must resolve before vertical slice Participants: Tyre (architecture lead), Dudley (implementation), Troblum (evaluation), Qatux (docs), Si (tickets) Source: Architecture Review Audit 2026-02-11, Tyre R-08
Context
Save/load is not addressed in any existing decision document or ticket. Both audit reviewers flagged this as a gap that must be resolved before the vertical slice.
The audit consensus recommends a custom SaveState struct over bevy_reflect, with versioning and migration. Troblum notes this creates a third data model alongside ECS components and ObserverSnapshot — every NPC component change requires updating 3 places.
D-026 defines tier serialization for State-saved NPCs (~1-2KB per frozen entity). The save/load system must interoperate with this — a full save includes all tiers, while tier serialization handles individual NPC state-save/restore during gameplay.
Key Questions to Resolve
Serialization Strategy
- Custom
SaveStatestruct vs bevy_reflect vs hybrid? (Audit recommends custom) - What is serialized? (All ECS components? Only authoritative state? Derived state rebuilt on load?)
- What format? (bincode for speed, MessagePack for debuggability, JSON for human-readability?)
- How large is a typical save? (15 NPCs x 1-2KB + map state + knowledge graphs + game clock)
Versioning
- What version scheme? (Semantic? Monotonic integer?)
- How are migrations handled? (Forward-only? Rollback support?)
- What triggers a version bump? (Any component change? Only breaking changes?)
- How is backwards compatibility tested?
Tier Integration
- How does full-save serialization relate to tier serialization (#96)?
- State-saved NPCs are already serialized blobs — does save/load wrap these directly?
- Active-tier NPCs need full component serialization — same format as State-saved, or different?
- How does the knowledge graph serialize? (Per-entity? Separate table?)
Architecture
- Where does save logic live? (bevy_ecs system? Separate module outside the schedule?)
- How is save triggered? (Manual save, autosave, checkpoint?)
- What about save corruption? (Checksums? Atomic writes? Backup previous save?)
- Quick save vs named saves — different mechanisms or same with different metadata?
Client-Side
- Does the client need save/load awareness? (Save menu, load screen, save file browser)
- How does save/load interact with the IPC bridge? (Pause simulation, serialize, resume?)
- Are save files portable across platforms? (Q-007 implications)
Input Documents
| Document | What to read | Why |
|---|---|---|
decisions/architecture.md |
D-010, D-020, D-026 | Architecture constraints, tier system |
server/src/npc/mod.rs |
NPC component model | What needs serializing |
server/src/simulation/tier.rs |
Tier system stub | Existing serialization infrastructure |
server/src/simulation/rng.rs |
SimRng (ChaCha20 seed) | RNG state must be saved for determinism |
server/src/simulation/time.rs |
SimulationTime | Game clock state |
server/Cargo.toml |
serde, rmp-serde dependencies | Available serialization tools |
Expected Outputs
- Decision: D-0XX — Save/Load Architecture — Strategy, format, versioning scheme
- SaveState schema: Rust struct definitions with serde derives
- Migration strategy: How version N saves load in version N+1
- Integration spec: How save/load interacts with tier serialization
- Tickets: Implementation tasks (server save system, client save UI, save format tests)
Workshop Format
Two rounds:
- Round 1: Each participant analyzes from their domain (Tyre: architecture, Dudley: implementation, Troblum: risk and alternatives)
- Round 2: Cross-review, resolve trade-offs, finalize schema