feat: add knowledge-gated pantry opportunities

This commit is contained in:
Rijad Zuzo
2026-07-13 00:46:56 +02:00
parent 9fcf6a0a58
commit c722e32a88
26 changed files with 2027 additions and 77 deletions
+46 -18
View File
@@ -2,7 +2,7 @@
> Agent-facing context for understanding the project quickly.
>
> Snapshot basis: repository state on July 11, 2026. Treat the code as the
> Snapshot basis: repository state on July 13, 2026. Treat the code as the
> source of truth when this document and the implementation differ.
See the [documentation map](README.md) for the authority and scope of each plan.
@@ -374,7 +374,10 @@ A small village panel displays:
decision reason, utility scores, directed familiarity/trust, and the exact
completed event that last changed trust;
- a compact selected-person history that separates up to four importance-ranked
retained memories from the NPC's three latest objective personal actions.
retained memories from the NPC's three latest objective personal actions;
- a cardless active `Village need` line sourced from the real pantry target,
food progress, and interested villager, with open/resolved detail only in
that person's inspector.
NPC name/profession labels, definition-driven colors and props, carried-food
visuals, compact task glyphs, and a brief amber blossom on real trust gains make
@@ -419,7 +422,10 @@ Focused `RefCounted` collaborators keep rule ownership visible:
one-hop communication, deterministic recent-memory retention, and stable
importance ranking for presentation/communication queries;
- `RelationshipSystem` owns directed relationship state, event-driven trust
consequences, and deterministic social queries.
consequences, and deterministic social queries;
- `FoodShortageOpportunitySystem` projects the first knowledge-gated unresolved
condition into a persisted open/resolved record without changing resources
or assigning work.
`SimulationManager` remains the scene-tree façade and signal boundary rather
than duplicating these responsibilities across additional manager nodes.
@@ -456,9 +462,10 @@ follow camera.
### `world/ui/ui.gd`
The UI subscribes to village, task, event, knowledge, and relationship changes.
It formats aggregate state and resolves known facts/relationship causes through
the event log without owning or recomputing simulation facts.
The UI subscribes to village, task, event, knowledge, relationship, and
opportunity changes. It formats aggregate state and resolves known facts,
relationship causes, and opportunity lifecycle details through manager queries
without owning or recomputing simulation facts.
## Current runtime flow
@@ -491,6 +498,7 @@ NpcVisual navigates through the active world
| -> SimulationEventLog appends completed facts
| -> EventKnowledgeSystem captures actor/nearby knowledge
| -> RelationshipSystem applies evidence-gated social consequences
| -> FoodShortageOpportunitySystem may open or resolve a real need
| |
| v
| village_changed signal updates the UI
@@ -527,6 +535,7 @@ NpcVisual navigates through the active world
│ ├── economy/ Inventory and storage transactions
│ ├── events/ Ordered event history and queries
│ ├── knowledge/ Per-NPC facts, provenance, transfer, and retention
│ ├── opportunities/ Knowledge-gated unresolved-condition projection
│ ├── persistence/ Validated local save-slot storage
│ ├── relationships/ Directed social consequences and queries
│ └── state/ Versioned simulation-state records
@@ -535,6 +544,7 @@ NpcVisual navigates through the active world
│ ├── communicated_knowledge_consequence_test.gd
│ ├── deterministic_simulation_test.gd
│ ├── food_storage_loop_test.gd
│ ├── food_shortage_opportunity_test.gd
│ ├── jajce_world_scaffold_test.gd
│ ├── knowledge_retention_consequence_test.gd
│ ├── jajce_runtime_integration_test.gd
@@ -543,6 +553,7 @@ NpcVisual navigates through the active world
│ ├── resource_node_player_parity_test.gd
│ ├── simulation_definitions_test.gd
│ ├── simulation_state_serialization_test.gd
│ ├── unit/test_food_shortage_opportunity_system.gd
│ └── witnessed_knowledge_consequence_test.gd
├── terrain/jajce/ Dedicated Terrain3D seed data and assets
├── tools/
@@ -575,9 +586,9 @@ These are expected prototype constraints, not necessarily isolated bugs:
gathering use `ResourceNode` instances with no fallback, food transfer uses
the typed pantry `StorageNode`, and patrol/study/rest use `ActivitySite`.
- Current NPC, village, resource, storage, event, knowledge, relationship,
clock, and RNG state serialize through world schema v7. F5/F9 provide one
validated local quicksave; a save menu, metadata, and player-transform
persistence remain deferred.
opportunity, clock, and RNG state serialize through world schema v8. F5/F9
provide one validated local quicksave; a save menu, metadata, and
player-transform persistence remain deferred.
- Simulation-owned resource records retain live amounts, reservations, and
usage definitions while ResourceNode scenes are unloaded.
- An explicit fixed-step clock converts frame delta into simulation ticks, but
@@ -590,11 +601,15 @@ These are expected prototype constraints, not necessarily isolated bugs:
located items.
- NPCs have home positions, schedule periods, carried food/wood, and directed
familiarity/trust. They retain direct or one-hop communicated knowledge of a
food deposit with first-acquisition provenance. Current trust causes are
lasting; other knowledge is capped and reviewed after one simulated day.
NPCs do not yet have wider social dimensions, goals, line-of-sight/hearing
evidence, personalized reinforcement/decay, false beliefs, or multi-hop
rumours.
food deposit or NPC pantry withdrawal with first-acquisition provenance.
Current trust causes and the trigger of an open opportunity are lasting;
other knowledge is capped and reviewed after one simulated day. NPCs do not
yet have wider social dimensions, goals, line-of-sight/hearing evidence,
personalized reinforcement/decay, false beliefs, or multi-hop rumours.
- One persisted `restock_empty_pantry` opportunity can emerge from a known
withdrawal plus current emptiness and critical hunger. It has exact NPC and
player supply resolutions, but no generic opportunity definitions, capable-
helper assignment, acceptance, rewards, free-form dialogue, or quest log.
- The reason inspector exposes current decisions, utility rejections, one exact
relationship cause, and a compact person-history view that distinguishes
importance-ranked retained memories from objective personal actions.
@@ -613,8 +628,8 @@ These are expected prototype constraints, not necessarily isolated bugs:
- Terrain3D and the bounded Jajce beauty baseline now run in the main game
scene; `Jajce Lookdev 01` and the runtime `Simulation Garden 01` are captured
as reproducible presentation baselines.
- Combat, companions, factions, politics, trade, rumours, quests, persistence,
and regional travel do not yet exist.
- Combat, companions, factions, politics, trade, generalized/multi-hop rumours,
a general quest framework, and regional travel do not yet exist.
- Stylized player/NPC silhouettes, water, foliage, and VFX support the current
build-in-public baseline, while blockout buildings and several work/resource
props remain visibly prototype-grade.
@@ -846,8 +861,21 @@ retention now keep current relationship causes lasting, cap other memories,
and forget routine facts at deterministic daily-sized reviews without deleting
the objective event. The selected-person inspector now shows lasting-first
retained memories beside objective personal history, and real trust changes
produce a short observer-only amber blossom without altering saved state. The
next systems slice is one bounded rumour/opportunity proof.
produce a short observer-only amber blossom without altering saved state.
The first bounded opportunity proof is complete. A positive NPC pantry
withdrawal plus current pantry emptiness opens one need only for a critically
hungry villager who knows that exact event. The schema-v8 record persists its
stable trigger, interested villager, pantry/food target, status, and later
resolution event; active evidence remains lasting. A real later NPC deposit or
player harvest into the pantry resolves it without quest-only history, economy
mutation by the generator, or AI assignment. The compact village/inspector UI
shows this lifecycle without changing the elevated follow camera.
Milestone 7 remains in progress. The next systems slice should prove the same
lifecycle with a missing-wood `task_blocked` condition and deterministic
interested-party death/staleness handling before extracting common opportunity
machinery.
The remaining simulation-garden target still aims for: