Skip to content

[settlements] Add clean-room settlement/NPC/faction pressure layer for living worlds #178

Description

@100yenadmin

Summary And Gameplay Impact

Add a compact, clean-room settlement/NPC/faction pressure layer for living worlds. This gives towns, districts, factions, establishments, and notable NPCs persistent texture and pressure without asking the DM/story layer to invent every civic beat from scratch.

Current ClawDnD State

ClawDnD has world content, locations, factions, strategic clocks, Atlas, Relations/Camp, and player-known codex lanes. Issue #143 tracks rare world-gen NPC/quest variant matrices. What is missing is a typed settlement pressure model tied to locations/factions/worldsim: governance, safety, economy, unrest, faction influence, establishment hooks, notable public NPC roles, and player-known civic state.

External Source Value And Recommendation

Use ryceg/Eigengrau-s-Essential-Establishment-Generator and opendnd/opendnd as mechanics-shape references only. Do not import generated prose, names, tables, frontend/runtime dependencies, or content. Eigengrau has useful concepts around establishments and civic texture; OpenDnD has limited lane-specific value.

Architecture Plan

  • Add optional SettlementProfile, LocalFactionLink, and SettlementPressure models tied to existing Location, Faction, and strategic state.
  • Seed authored settlement blocks from world/area JSON.
  • Generate deterministic defaults from location tags only when safe and clearly marked as generated.
  • Let worldsim tick unrest, faction pressure, local assets, civic clocks, and backlog suggestions through engine-owned paths.
  • Surface player-known settlement state in Atlas, Relations, and Codex projections.
  • Keep hidden DM notes, sealed agendas, private lore, and generator provenance out of player-safe read models.

Files And Modules Likely Touched

  • servers/engine/models.py
  • servers/engine/content.py
  • servers/engine/worldsim.py
  • servers/engine/server.py
  • viewer/server.py
  • viewer/openworlds/screen-map.jsx
  • viewer/openworlds/screen-relations.jsx
  • viewer/openworlds/screen-bestiary.jsx
  • viewer/tests/test_atlas_surface.py
  • viewer/tests/test_session_surface.py

State-Authority Boundary

Settlement pressure is engine-owned state/projection. Viewer/OpenWorlds may display player-known civic state and post player intent through /move, but may not write settlement pressure, faction influence, clocks, or NPC dispositions directly.

Acceptance Criteria

  • Old snapshots load unchanged.
  • Valid settlement content seeds deterministically.
  • Malformed optional settlement blocks degrade safely with diagnostics.
  • Settlement pressure advances only through engine-owned time/worldsim paths.
  • Atlas/Relations/Codex expose only player-safe settlement facts.
  • Hidden NPC motives, sealed agendas, private lore, and generated-source notes do not leak.
  • No Eigengrau/OpenDnD prose, names, tables, or runtime dependency is imported.
  • Tests cover seeding, idempotent ticks, player-known filtering, and legacy fallback.

Focused Validation Commands

uv run --directory servers/engine --group dev pytest -q tests/test_worldsim.py tests/test_content.py
python3 -m unittest viewer.tests.test_atlas_surface -q
python3 -m unittest viewer.tests.test_session_surface -q
git diff --check

Adversarial Risks

  • Importing external prose/tables instead of clean-room dimensions.
  • Duplicating faction state in settlements and drifting from canonical faction/worldsim truth.
  • Leaking hidden NPC/faction agendas into player surfaces.
  • Overbuilding generation before the read model is useful.

Original-Agent Handoff

Start with:

  • servers/engine/models.py
  • servers/engine/worldsim.py
  • servers/engine/content.py
  • viewer/server.py
  • viewer/openworlds/screen-map.jsx
  • viewer/openworlds/screen-relations.jsx

Refs #60. Related to #117, #118, #121, #143.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttier-1Tier 1: Claude Code plugin

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions