Files changed: .obsidian/workspace.json archive/README.md archive/projects/DEPLOY-API-KEYS-TAB.md archive/projects/arr-stack-runbook.md archive/projects/arr-wiring-runbook.md archive/projects/cc-deploy-watchtower-v2.md archive/projects/headscale-full-deployment.md archive/projects/last-ember-project.md archive/projects/mmud/last-ember-chronicle.html archive/projects/mmud/last-ember-howto.html archive/projects/mmud/last-ember.html archive/projects/mmud/mmud-phase5-prompt.md archive/projects/mmud/mmud-phase6-prompt.md archive/projects/mmud/mmud-prompts/mmud-prompts/01-update-planned.md archive/projects/mmud/mmud-prompts/mmud-prompts/02-npc-nodes.md archive/projects/mmud/mmud-prompts/mmud-prompts/03-darkcragg.md archive/projects/mmud/mmud-prompts/mmud-prompts/04-dcrg-node.md archive/projects/mmud/mmud-prompts/mmud-prompts/05-phase5.md archive/projects/mmud/mmud-prompts/mmud-prompts/06-phase6.md archive/projects/mmud/mmud-prompts/mmud-prompts/README.md archive/projects/mmud/mmud-prompts/mmud-prompts/mmud-project.md archive/projects/openwebui-theme-deploy.md archive/projects/peertube-phase2-project.md archive/projects/peertube-rebuild.md archive/projects/utility-caddy-initial-setup.md archive/projects/vaultwarden-deployment.md archive/reports/logistics_migration.md archive/reports/post_validation_report.md archive/reports/task_a_aurora_validation.md archive/reports/task_c_watchdog_test.md projects/deploy-livesync.md
6.6 KiB
6.6 KiB
Task: Add NPC sim node architecture and rules to planned.md
Edit /home/zvx/projects/mmud/docs/planned.md in place.
Edit 1: NPC Sim Nodes section
Find the ### NPC Live Conversations — LLM at Runtime subsection inside ## The Last Ember — Town Hub. Replace the Command line and everything after it in that subsection (from **Command:** through the end of **Cost math:**) with the following:
**Network Architecture — NPCs as Mesh Nodes:**
The NPCs are literal Meshtastic nodes on the mesh network. Five sim nodes, all backed by the same game database:
- **EMBR** — The Last Ember. The game server. All game commands go here.
- **GRST** — Grist. DM this node to talk to the barkeep.
- **MRN** — Maren. DM this node to talk to the healer.
- **TRVL** — Torval. DM this node to talk to the merchant.
- **WSPR** — Whisper. DM this node to talk to the sage.
Players don't issue a `talk` command — they DM the NPC's node directly. The game server sees inbound on the NPC node ID, checks the rules below, and routes the response back through that NPC's node. The NPCs are *people on the network*, not menu options.
**Three rule layers (checked in order):**
**Rule 1 — Unknown node (not in the game):** Static in-character rejection with onboarding instructions. No LLM call. Each NPC has a fixed response:
- Grist: `"Don't know you. DM EMBR to start. Then we'll talk."`
- Maren: `"I only patch up adventurers. DM EMBR to become one."`
- Torval: `"No account, no credit, friend. DM EMBR to join up."`
- Whisper: `"...not yet. EMBR. Begin there."`
**Rule 2 — Known player, not in the bar:** Static in-character refusal. Player is in the dungeon, dead, or otherwise not in town. No LLM call.
- Grist: `"You're not here, {name}. Come back to the bar first."`
- Maren: `"I can hear you're still down there. Come back alive."`
- Torval: `"I don't do deliveries. Get back to the Ember."`
- Whisper: `"...too far. Return."`
**Rule 3 — Known player, in the bar:** Full LLM conversation. This is the only case that triggers a live LLM call.
**System prompt per NPC includes:**
- Full backstory and personality card
- Current game state injection: active bounties, recent deaths, Breach status, epoch day, floor control percentages, raid boss HP — whatever is relevant. The NPC *knows what's happening.*
- Hard rules: respond in character, NEVER break character, response MUST be under 150 characters, never reveal exact secret locations or puzzle solutions (hints only), never acknowledge being an AI, never discuss anything outside the game world.
**What each NPC brings:**
- **Grist** — gossip and world state. Knows everything from broadcast logs. Ask about another player and he'll tell you what they've been up to. Dry, factual, slightly unsettling in how much he knows.
- **Maren** — the human element. Comments on your injuries, your play pattern, your stubbornness. Has opinions about the dungeon. Will never talk about what she saw on the lowest floor no matter how hard you try.
- **Torval** — comic relief and commerce. Banter about items, terrible jokes, comments on your gear. "You're wearing THAT to floor 3? Bold." Embellished sales pitches.
- **Whisper** — lore oracle. High-skill conversation. Speaks in fragments. Ask the right questions and get real, useful information about secrets. Her cryptic style is the LLM prompt, not a gimmick — talking to Whisper IS a puzzle.
**Guardrails:**
- Conversation memory is session-only — NPCs don't remember yesterday's chat. Keeps context windows small and prevents exploit accumulation.
- If the LLM fails or times out, fall back to a random pre-generated dialogue snippet from the batch pipeline (20 per NPC already generated at epoch start).
- No rate limit on NPC conversations. Players can talk as long as they want. The NPCs are storytellers, historians, and characters — extended conversation is a feature, not abuse.
- Uses the same pluggable LLM backend as the epoch generation pipeline (Anthropic, OpenAI, Google, or Dummy).
**Server History Seed — 2 Years of Lore:**
Before the server goes live, generate 24 epochs (2 years) of simulated history. For each epoch:
- Epoch number, endgame mode, Breach type, narrative theme
- Whether the server won or lost (mix of both — some epic victories, some heartbreaking failures)
- 3-5 notable players per epoch (generated names, classes, levels reached, what they did)
- 1-2 memorable moments per epoch ("Kira carried the Crown from floor 4 to floor 1 with 3 HP", "The Warden stood for 28 days — the server failed on the final push", "Epoch 11's Raid Boss had No Escape + Enraged — three players died on the killing blow")
- Hall of fame entries, titles earned
Stored in the persistent tables (accounts, hall_of_fame, hall_of_fame_participants, titles). When the real server starts on epoch 25, the NPCs have 24 epochs of history to draw from. Grist drops names of old champions. Maren compares your injuries to legends. Torval mentions gear from epochs past. Whisper sees patterns across cycles that nobody else notices.
**NPC context injection includes a lore packet:** A compressed 20-30 sentence summary of server history highlights pulled from the hall of fame tables. Regenerated at each epoch start so it stays current as real player history accumulates and blends with the seed history. The NPCs don't distinguish between seeded and real history — it's all the same to them.
**Cost math:** At Haiku-tier pricing, ~500 tokens per conversation turn. Even heavy usage (50 turns/day across all players) is ~25,000 tokens/day ≈ $0.006/day. Unlimited conversation is essentially free.
Edit 2: Update Resolved Decisions
Find the resolved decision line that says:
- NPC live conversations: LLM at runtime exception for talk command in town. Session-only memory, 5/day rate limit per NPC, falls back to pre-generated dialogue on failure.
Replace it with:
- NPC live conversations: NPCs are sim nodes on the mesh (GRST, MRN, TRVL, WSPR). Players DM them directly. Three rule layers: unknown node gets static onboarding response, known player not in bar gets static rejection, known player in bar gets full LLM conversation. No rate limit. Session-only memory. Falls back to pre-generated dialogue on failure. 24-epoch history seed provides 2 years of lore for NPCs to draw from.
Edit 3: Add to Open Questions
Add this to the end of the ## Open Questions list:
- NPC sim node deployment — which host runs meshtasticd with 5 identities, TCP routing to game LXC
Commit
git add -A && git commit -m "Design doc: NPCs as mesh sim nodes, three-layer access rules, onboarding funnel"