WalkXR Game Jam is an AI-powered empathy training simulator where users practice trauma-informed conversations with a psychologically realistic NPC. The first scenario features James, a military veteran with PTSD, at a bus stop.
Built with LangGraph + GPT-4o-mini + Streamlit, this prototype goes beyond the original WalkXR Design Document's Phase 2 (a working walk experience) by implementing core elements of Phase 3 (the Emotional OS) — specifically, real-time adaptive NPC behavior, multi-dimensional emotional tracking, and data-driven coaching feedback.
The WalkXR Master Design Document defines three phases:
This Game Jam prototype operates at Phase 2.5 — a fully functional walk experience that already incorporates the adaptive intelligence planned for Phase 3.
Design Doc approach: NPC agents follow pre-scripted persona descriptions. Behavior is defined once and remains consistent throughout.
Game Jam approach: James has a live internal state that evolves every turn:
| Metric | Range | What It Tracks |
|---|---|---|
npc_openness |
0.0 – 1.0 | How willing James is to share personal details |
npc_mood |
5 states | guarded → cautious → warming → open → withdrawn |
trust_shift |
-0.3 – +0.3 | Per-turn trust delta based on user's approach |
Result: James doesn't just "respond" — he adapts. Show genuine empathy and he gradually opens up. Push too hard or use clichés and he withdraws. This creates emergent, non-scripted emotional arcs unique to each session.
Design Doc approach: Phase 2 uses basic turn counting and a simple memory dict. The sophisticated Emotional State Engine is deferred to Phase 3 (Epic E05).
Game Jam approach: Every turn updates 15 state dimensions simultaneously:
confidence_level, rapport_score (composite: trust 40% + openness 30% + empathy ratio 30%)emotion_trajectory (valence + arousal per turn), dominant_emotionempathy_hits, empathy_misses, empathy_ratio — the LLM classifies each user response as a "hit" (genuine empathy), "miss" (insensitive/cliché), or "neutral"avg_response_length, silence_count — detects user disengagementnpc_openness, npc_mood — James's emotional evolutionDesign Doc approach: Conversations end when max turns are reached or the LLM says to stop.
Game Jam approach: 6 exit conditions create realistic, context-sensitive endings:
Why this matters: The conversation doesn't just "run out of turns." It ends for a reason — and that reason shapes the coaching feedback.
Design Doc approach: The system prompt is set once with scenario data. The NPC doesn't know how the conversation has been going.
Game Jam approach: Every turn, the system prompt is rebuilt with:
This means James in turn 7 is fundamentally different from James in turn 1 — not because of a script, but because of accumulated interaction data.
Design Doc approach: Evaluation (Epic E10) focuses on developer-facing tools like LangSmith tracing and red teaming. User-facing feedback is not specified.
Game Jam approach: End-of-session coaching is generated from concrete session data:
The coaching prompt includes a curated Empathetic Reflection Lexicon — 12 trauma-informed principles that ground the feedback in psychological best practices.
User Input
→ retrieve_context (scenario validation; future: RAG retrieval)
→ construct_prompt (adaptive prompt with full memory injection)
→ call_llm (GPT-4o-mini → structured JSON with 8 output fields)
→ update_memory (15-dimension state update with composite scoring)
→ route decision:
├─ reflection (6 exit conditions → data-driven coaching)
└─ end (return to user for next turn)
Each LLM call produces not just dialogue, but a complete turn assessment:
{
"response": "James's dialogue with *body language*",
"should_end_turn": false,
"next_step": "continue",
"emotion_assessment": {
"valence": 0.2,
"arousal": 0.4,
"label": "cautiously hopeful"
},
"observation": "User asked permission before probing — showed respect for boundaries",
"empathy_quality": "hit",
"trust_shift": 0.15,
"npc_internal_mood": "cautious"
}
A deliberate design choice: negative interactions hurt more than positive ones help.
This mirrors real trauma-informed relationships: trust is hard to build and easy to break.
| Component | Technology |
|---|---|
| Orchestration | LangGraph (stateful graph with conditional routing) |
| LLM | GPT-4o-mini (JSON mode, temperature 0.7) |
| Frontend | Streamlit (real-time metrics sidebar, chat UI, emotion chart) |
| State Management | Python TypedDict (15-field UserMemory) |
| Framework | LangChain Core + LangChain OpenAI |
The Streamlit interface provides real-time visibility into the simulation:
Sidebar Metrics (updated every turn):
End-of-Session Dashboard:
This Game Jam prototype validates several Phase 3 concepts ahead of schedule:
| Next Step | Description |
|---|---|
| RAG Integration | Replace the retrieve_context stub with LlamaIndex + ChromaDB for scenario knowledge retrieval |
| Multiple Scenarios | Extend beyond bus stop — new NPCs, settings, and therapeutic goals |
| Persistent Memory | Cross-session user growth tracking (currently resets on refresh) |
| BaseAgent Abstraction | Standardize agent class for multi-agent cohort development |
| Evaluation Pipeline | LangSmith integration for automated quality assessment |
| RLAIF Loop | Use session data to fine-tune agent responses over time |
# Install dependencies
pip install -r requirements.txt
# Set OpenAI API key
echo "OPENAI_API_KEY=your-key-here" > .env
# Launch
streamlit run app.py
Built for WalkXR Game Jam | LangGraph + GPT-4o-mini + Streamlit Adaptive Empathy Engine — Where AI learns to listen.