Chapter 38 — District Life
Chapter 38 — District Life
Section titled “Chapter 38 — District Life”Districts in AI RPG Engine are not just map labels — they are living neighborhoods with economic pulse, social morale, and atmospheric identity. The district life system derives expressive mood from raw metrics, flows that mood into narration, modifies gameplay through district-aware scaling, and exposes everything through director commands and session recaps.
Raw Metrics
Section titled “Raw Metrics”Each district tracks 7 metrics in DistrictMetrics:
| Metric | Range | Baseline | Decay |
|---|---|---|---|
alertPressure | 0–100 | 0 | Toward 0 |
rumorDensity | 0–100 | 0 | Toward 0 |
intruderLikelihood | 0–100 | 0 | Toward 0 |
surveillance | 0–100 | computed | From faction presence |
stability | 0–10 | zone average | Averaged |
commerce | 0–100 | 50 | Toward 50 |
morale | 0–100 | 50 | Toward 50 |
The first five metrics are security-oriented and decay toward 0 (or are computed). Commerce and morale are social/economic metrics that use baseline-seeking decay — they drift toward 50 at 0.5/tick, representing a natural equilibrium. A district left alone settles to average commerce and neutral morale.
Mood Derivation
Section titled “Mood Derivation”The mood system (district-mood.ts) is a pure-function layer that converts raw metrics into expressive descriptors. No state — just computation.
Three Mood Axes
Section titled “Three Mood Axes”| Axis | Derived From | Meaning |
|---|---|---|
| Safety | alertPressure (inverse), stability | How secure does this place feel? |
| Prosperity | commerce, stability | Is trade flowing? Are people fed? |
| Spirit | morale, surveillance (inverse), stability | Are people hopeful or broken? |
Base formulas:
safety = (100 - alertPressure) × 0.5 + stability × 5prosperity = commerce × 0.6 + stability × 4spirit = morale × 0.6 + (100 - surveillance) × 0.2 + stability × 2
Tag-Driven Weighting
Section titled “Tag-Driven Weighting”District tags modify mood derivation without explicit configuration per pack. A sacred district amplifies spirit, a secure district amplifies safety, a cursed district suppresses both:
| Tag | Safety | Prosperity | Spirit |
|---|---|---|---|
| sacred | ×0.8 | ×1.0 | ×1.5 |
| public | ×1.0 | ×1.3 | ×1.1 |
| secure | ×1.5 | ×0.7 | ×1.0 |
| underground | ×0.7 | ×0.8 | ×0.8 |
| networked | ×1.1 | ×1.2 | ×1.0 |
| cursed | ×0.6 | ×1.0 | ×0.5 |
| exterior | ×1.0 | ×1.1 | ×1.0 |
Descriptors
Section titled “Descriptors”A priority cascade produces compact atmospheric phrases (~3–5 words):
safety < 20 && spirit < 30→ “dangerous and despairing”safety < 30→ “on edge, jumpy”prosperity > 70 && spirit > 60→ “busy and cheerful”safety > 70 && spirit > 50→ “calm and watchful”spirit < 30→ “subdued, fearful”- default → “unremarkable”
Each mood maps to a tone enum: calm, tense, prosperous, grim, volatile, oppressive.
Gameplay Modifiers
Section titled “Gameplay Modifiers”District mood produces four scaling factors that affect gameplay:
| Modifier | Affected By | Effect |
|---|---|---|
leverageCostScale | Safety | Dangerous districts (safety < 30) increase costs ×1.3; safe districts (> 70) reduce to ×0.85 |
rumorSpreadScale | Spirit | Low-spirit districts (< 30) accelerate spread ×1.5; high-spirit (> 70) slow to ×0.7 |
npcCooperationBias | Prosperity | Prosperous districts bias NPC trust checks positively |
pressureUrgencyBias | Safety + Spirit | Doubly-stressed districts (both < 30) add +0.15 urgency to new pressures |
Drift Sources
Section titled “Drift Sources”District metrics change through multiple systems:
Event Hooks (Engine)
Section titled “Event Hooks (Engine)”combat.entity.defeated→ morale −3inventory.item.received→ commerce +3dialogue.choice.selected→ morale +1
Faction Actions (Engine)
Section titled “Faction Actions (Engine)”recruit→ morale +2 in target districtsmuggle→ commerce +3, stability −3hoard→ commerce −3 in target districtfortify,patrol,sanction→ existing security metric effects
Player Leverage (Product)
Section titled “Player Leverage (Product)”sabotage→ stability −3, alertPressure +5diplomacy→ morale +3, alertPressure −2rumor→ rumorDensity +3social→ commerce +2
NPC Consequence Chains (Product)
Section titled “NPC Consequence Chains (Product)”retaliation/vendetta→ alertPressure +5, morale −3extortion→ commerce −3, morale −2abandonment→ commerce −3plea→ morale −1sacrifice→ morale +3
Narration Integration
Section titled “Narration Integration”The narrator receives a single-line district descriptor in the scene context:
District: Chapel Grounds: calm and watchfulThe system prompt instructs Claude to weave this into environmental descriptions through sensory detail — showing crowds, emptiness, tension, commerce, morale through what the character perceives. The descriptor adds ~8 tokens to the narration input.
Director Commands
Section titled “Director Commands”/districts
Section titled “/districts”Overview of all districts with mood:
DISTRICTS
Chapel Grounds (chapel-grounds) — "calm and watchful" Safety: 72 | Prosperity: 55 | Spirit: 61 Tags: sacred | Faction: none
Crypt Depths (crypt-depths) — "on edge, jumpy" Safety: 28 | Prosperity: 31 | Spirit: 22 Tags: cursed, underground | Faction: chapel-undead/district <id>
Section titled “/district <id>”Deep inspection with mood, modifiers, raw metrics, and more.
Session Recaps
Section titled “Session Recaps”When districts change during a session, the recap includes a DISTRICT CHANGES section:
DISTRICT CHANGES
Chapel Grounds: "calm and watchful" → "on edge, jumpy" alertPressure rose sharply, morale fell sharply Crypt Depths: unchangedChanges are detected by comparing mood descriptors and looking for metric shifts above threshold (>15 for most metrics, >2 for stability).
Strategic Map
Section titled “Strategic Map”The /map command shows mood descriptors alongside each district:
Chapel Grounds (chapel-grounds) — "calm and watchful" Threat: 15 | Stability: 7 | Surveillance: 30Design Philosophy
Section titled “Design Philosophy”Districts should feel inhabited, not spreadsheet-heavy. The system achieves this through:
- 7 raw metrics — compact enough to fit in a single inspection line
- 3 derived mood axes — human-readable compression of 7 metrics
- Tag-driven weighting — packs define district character through tags, not per-metric config
- Compact descriptors — 3–5 word phrases that Claude can naturally weave into prose
- Baseline-seeking decay — districts recover naturally, making player/NPC impact visible as deviation from equilibrium
The goal is not municipal simulation — it is atmospheric consequence.