Skip to content

PerceptionSystem

PerceptionSystem

Phase · priority Agency · 10
Reads containment; connected_to/adjacent_to with permeability.light, permeability.sound; temperature, ambient_temperature; salient attributes on perceived nodes
Writes perceived_entities, perceived_danger, perceived_warmth on each Sentient; knows edges (writes.edges)
Settings perception_range (per NPC, 2), MinSignal 0.05, SafeThreshold 40 °C, DangerThreshold 120 °C, WarmthThreshold 30 °C, fact_refresh_hours 1, max_personal_facts 200, half-lives per predicate
Status designed · Phase 1 (#36)
PLAN §7.2, §7.3, §3.9
Player What villagers know

Builds each NPC's genuinely limited view of the world and writes what they saw into memory. This is what makes emergence real: different NPCs know different things because of where they are and what topology separates them from events.

Sensing

For each Sentient NPC: BFS outward from its location up to perception_range hops, attenuating the signal per edge by max(permeability.light, permeability.sound), stopping below MinSignal; collect the contents of every reached location → perceived_entities. Then two signals from the NPC's own location's temperature:

perceived_danger = clamp((T_here − 40) / 120, 0, 1)       # a campfire next door ≈ 0.1; a burning building ≈ 1.0
perceived_warmth = clamp((T_here − ambient) / 30, 0, 1)

Danger derives from temperature, not from OnFire proximity — the difference between "cosy campfire" and "inferno" emerges from heat and topology, not a flag. Everything written here is read by the publishers and DecisionSystem next tick (the one-tick lag of PLAN §18.6).

Remembering

For every perceived node that carries a salient attribute (food_value, water_level, fuel_value; temperature recorded as danger; location for every perceived node), write or update the NPC's knows edge to it via SetEdgePropertyIntent:

kira ─[knows]→ berry_bush_3 { "food_value": { "value": 18, "observed_at": ctx.WorldTime, "provenance": "observed" }, "location": {…} }
  • Refresh only when the value changed or the entry is older than fact_refresh — a since-timestamp (PLAN §3.9); standing beside a bush does not write every tick.
  • Evict when a new subject would exceed max_personal_facts: RemoveEdge on the edge whose best predicate confidence is lowest.
  • Confidence is derived at read time by consumers (view.Facts): DeterministicMath.Exp(−age / half_life); nothing stored.

Faction facts are not written by this system in Phase 1 (seeded by the scenario; shared by SocialSystem from Phase 2).

Hot-toggle: off, perceived_* freezes and no new facts form; NPCs act on stale perception and memory, which is exactly the designed failure. Trace: every perceived_danger set can be traced to the location's temperature when the intent carries Inputs (inn.temperature), which this system sets.

History

Phase Change
1 Introduced; writes knows facts with refresh and eviction.

See also: Option bus · The graph · From perception to Explain this