# Sprint 8: React — Joint / Integration Tasks **Goal:** Activate the dialogue pipeline end-to-end — player talks to NPCs, NPCs respond, the world reacts. **Teams:** Server + Client **Agents:** All implementation agents ## Pre-Sprint None. All required decisions (D-028, D-060, D-062, D-063, D-064) are confirmed. ## Sprint Completion Proof Concrete observable criteria when Sprint 8 is done: 1. **Dialogue flow works end-to-end:** - Player walks to Kael (or any NPC), presses [E], selects Talk - NPC greeting appears in dialogue box (bottom 20% screen, max-width) - 2-3 player response options visible below NPC text - Player clicks response → NPC replies with new text + new options - Conversation continues until player walks away (WASD) 2. **Walk-away triggers visual + server recording:** - Player in dialogue with NPC, presses WASD (any direction) - Dialogue box fades out over 300ms, silence - Server logs incomplete interaction in KG (verify via debug print or db query) - Player can walk away mid-conversation without crash 3. **Confrontation option appears and feels different:** - Detective character approaches Sera Venn after observing corridor contradiction - Talk → response options include at least one confrontation line (italic, first-person: *"I saw you avoiding Torek..."*) - Click confrontation → 1-2s pause, monologue appears ("This changes things..."), ambient audio dips to 50% - After pause, NPC responds (text changes, relationship may shift color on next observation) 4. **Fog entity recognition timing:** - NPC enters fog (outside vision cone but within sound/thermal range) - Grey blob appears for 0.6s (6 ticks normal, or 0.3s/3 ticks if anomaly) - During delay, monologue fires ("Those footsteps... that's Kael's walk") - After delay, grey blob transitions to D-033 color + faint silhouette over 0.3s 5. **Sound ping rendering:** - NPC makes loud sound outside LOS (door slam, footsteps, voice) - 2-3 concentric rings expand from sound direction on insert overlay (white-blue, sonar aesthetic) - Rings fade over 1.5s - No crash, no visual glitches 6. **Invisible locks work:** - Player talks to Sera with Surface trust level - Gets 2-3 response options (small talk, routine questions) - Player CANNOT see that Real/Secret tier options exist (no grayed-out text, no lock icons, no hint) - After trust increase (via repeated positive interactions or evidence discovery), new options appear on next Talk — player realizes "wait, there's more now" ## Test Plan Alignment (D-030 phases) **Phase 2 (Sprint 3-4): Integration tests** - Sprint 8 falls in integration test phase - Required: End-to-end dialogue pipeline integration test (server sends dialogue_response, client renders, player input returns, server logs) - Required: Walk-away flow integration test (client sends WalkAway, server records KG, dialogue state clears) - Negative test: Locked dialogue options are NOT sent to client (server filters before protocol, client never sees them) ## Cross-Team Dependencies | Ticket | Team | Depends on | Delivers to | |--------|------|------------|-------------| | #305 | server | (none) | Client #435 consumes dialogue_response protocol field | | #427 | server | #452 (ContentSlug) | Client #437 triggers via WalkAway input | | #435 | client | #434 (done) | Server #305 sends data to render | | #436 | client | #435 | Uses dialogue box from #435 | | #437 | client | #435 | Pairs with server #427 | | #450 | server | (none) | Enables urgent recognition for #431 | | #451 | server | #450 | Pairs with client #431 fog visualization | | #431 | client | Protocol v7 | Consumes pending_recognitions from server | **Critical path:** Server #305 (dialogue pipeline) + Client #435 (dialogue box) are the headline integration. Everything else is enhancement/polish around that core. **Parallel tracks:** - Track 1 (dialogue): #305 (server) ↔ #435 (client) → #436 (confrontation styling) → #437 (walk-away) ↔ #427 (server KG) - Track 2 (perception): #450 (server anomaly) → #451 (server monologue) → #431 (client fog viz) - Track 3 (infrastructure): #452 (server ContentSlug) → used by #427 ## Integration Risks 1. **Protocol version mismatch:** Client #431 bumps protocol to v7 (pending_recognitions field). Server must match. Verify protocol.gd PROTOCOL_VERSION == server bridge/types.rs PROTOCOL_VERSION after merge. 2. **Dialogue response format:** Server #305 populates `dialogue_response: Vec` in ObserverSnapshot. Client #435 must decode this correctly (MessagePack array of maps). Test with 0 options (no dialogue), 1 option, 3 options, and 5+ options (client shows top 3). 3. **Walk-away during network lag:** Client sends WalkAway input. Server may send 1-2 more dialogue snapshots in flight before WalkAway is processed. Client should handle: fade dialogue box, ignore late dialogue_response updates. 4. **Cognitive delay + monologue timing:** Server #451 fires monologue at delay START (when grey blob appears). Client #431 must show monologue DURING the 0.6s grey-to-color transition. If monologue arrives after transition completes, timing feels wrong. Verify monologue timestamp is within delay window. 5. **Confrontation italic rendering:** Client uses BBCode `[i]...[/i]` for italic. If NPC name or response text contains special BBCode chars (`[`, `]`), text will break. Server should escape BBCode in dialogue text, or client should use `bbcode_text.c_escape()` before rendering. ## Notes **Server-side dialogue filtering (D-062 invisible locks):** - Server filters dialogue options BEFORE sending to client. Client never sees locked options in protocol. - Access tier filter: RelationshipState → AccessTier mapping must be shared understanding (or document in decisions/content.md amendment) - Trust tier filter: KG.relationship → TrustTier. Unknown = Surface, Known/Friend = Real, PersonOfInterest+Secret fact = Secret. - Situation filter: Game state (time, location, NPC routine) → active Situation tags. Document the mapping function (or make it data-driven YAML config). **Client-side dialogue rendering (max 3 visible, D-061 20% height):** - If NPC sends 5 valid options (all unlocked, all pass filters), client shows top 3 by priority. - If later in conversation NPC sends 2 options, client shows 2. - Dialogue box height scales with content (NPC text + options) but never exceeds 20% viewport height. If content overflows, scroll NPC text, keep options visible. **Monologue + dialogue spatial separation (D-061, D-063):** - Monologue floats above dialogue box on z-layer 7. - During confrontation beat: monologue visible ("This changes things..."), dialogue box dimmed to 70% opacity. - After beat: monologue fades, dialogue box returns to 100% opacity, NPC response appears. **Audio dip during confrontation (D-063):** - Client-side: When player clicks confrontation option, AudioServer.set_bus_volume_db(ambient_bus, -6.0) (50% volume). - After monologue beat + response sent, restore: AudioServer.set_bus_volume_db(ambient_bus, 0.0). - Duration: ~1-2 seconds (duration of monologue beat). Not tied to NPC response arrival. ## Open Questions None. All design decisions confirmed. If blockers arise during implementation, escalate to Team Leader (Jeroen). ## Files Written - /var/home/jeroenschweitzer/Projects/settled-reach/main/docs/sprints/sprint-8/server.md - /var/home/jeroenschweitzer/Projects/settled-reach/main/docs/sprints/sprint-8/client.md - /var/home/jeroenschweitzer/Projects/settled-reach/main/docs/sprints/sprint-8/audio.md - /var/home/jeroenschweitzer/Projects/settled-reach/main/docs/sprints/sprint-8/joint.md