feat: add witnessed knowledge and wind ambience

This commit is contained in:
Rijad Zuzo
2026-07-11 11:27:40 +02:00
parent 2ed93de6d1
commit 81409650df
72 changed files with 3001 additions and 606 deletions
+31 -13
View File
@@ -2,7 +2,8 @@
## Current contract
Every successful food movement creates one `EconomicEventRecord`:
Every successful food or wood movement creates an `EconomicEventRecord` using
the applicable event type:
```text
resource_extracted
@@ -13,17 +14,21 @@ item_consumed
Each record contains a monotonically increasing event ID, event type,
simulation tick, actor ID, source ID, destination ID, item ID, and transferred
amount. Actor `-1` identifies a player-triggered extraction until persistent
player identity is introduced.
amount, plus the authoritative world position captured when the fact is
recorded. NPC events preserve their authoritative interaction target (or NPC
position when no target applies); player extraction/depletion events preserve
the ResourceNode interaction position. Actor `-1` identifies a player-triggered
extraction until persistent player identity is introduced.
Events are immutable facts about completed transfers. They do not perform the
transaction and are not replayed to reconstruct current state. Resource,
inventory, and storage records remain authoritative.
`SimulationEventLog` owns ordered event identity, append/restore behavior, and
history/rate queries. `VillageEconomy` performs transactions and requests event
records only after state changes succeed; `SimulationManager` remains the
public signal boundary used by presentation.
history/rate queries, including exact lookup through `get_by_id()`.
`VillageEconomy` performs transactions and requests event records only after
state changes succeed; `SimulationManager` remains the public signal boundary
used by presentation.
An action whose definition-backed completion cost becomes unavailable records
a zero-amount `task_blocked` narrative fact with the action and shortfall
@@ -32,10 +37,21 @@ transfer occurred.
## Persistence and determinism
`SimulationStateRecord` schema v3 stores the ordered event stream and
`next_event_id`. Schema v1 and v2 saves migrate to an empty stream beginning at
ID zero. Parsing rejects duplicate event IDs and a next ID that could collide
with restored history.
`SimulationStateRecord` schema v5 stores the ordered event stream,
`next_event_id`, directed relationships that may reference an exact event, and
per-NPC known-event references. Schema v1 and v2 saves migrate to an empty
stream beginning at ID zero. Parsing rejects duplicate event IDs, invalid or
duplicate knowledge references, relationship causes the observer does not
know, and a next ID that could collide with restored history.
A successful food deposit can currently raise a hungry familiar NPC's directed
trust in its contributor only when that NPC knows the event. The actor and
living NPCs within the bounded witness radius receive a `KnownEventStateRecord`
at record time. Witness distance uses the event's captured position, never the
actor's later location. The relationship stores the same deposit event ID
rather than copied prose, so the inspector can resolve and display the real
completed fact. This is a first evidence-gated causal consumer of the event
stream, not general event sourcing.
The food-loop regression verifies this chain:
@@ -57,6 +73,8 @@ NPC record, so unloading presentation does not lose the fact.
The stream is currently kept in full for the small simulation garden. Before
large populations or long-running worlds, add measured retention,
archival/summary rules, and query indexes. General denied attempts, witnesses,
secrecy, causal links, and memories belong in later event/history slices; they
should extend this record family without making prose authoritative.
archival/summary rules, and query indexes. Proximity is the only current witness
rule; line of sight, hearing, acquisition provenance, communication, secrecy,
false beliefs, multi-event causal graphs, and memory retention belong in later
event/history slices. They should extend this record family without making
prose authoritative or recomputing old evidence from current positions.