feat: add deterministic goat routine

This commit is contained in:
Rijad Zuzo
2026-07-26 23:52:56 +02:00
parent f79c2bb630
commit e3aa3440a2
61 changed files with 1393 additions and 1057 deletions
+29 -13
View File
@@ -16,7 +16,7 @@ SimulationClock
-> ActionSelectionSystem chooses an action
-> ActionTargetResolver resolves a stable target ID
-> VillageEconomy performs inventory/storage transactions
-> AnimalCareSystem advances animal needs and composes feeding
-> AnimalCareSystem advances animal needs, routines, and feeding
-> SimulationEventLog records completed facts
-> EventKnowledgeSystem records, ranks, transfers, and retains bounded knowledge
-> RelationshipSystem applies evidence-gated social consequences
@@ -25,6 +25,7 @@ SimulationClock
-> ActiveWorldAdapter supplies loaded-world positions/capacity
-> LoadedResourceSpatialIndex bounds finite-anchor discovery
-> NpcVisual performs local navigation, animation, and transient reactions
-> AnimalNode follows saved animal destinations through loaded navigation
-> PantryStockVisual derives physical stock arrangement from storage state
```
@@ -36,9 +37,10 @@ would otherwise obscure that lifecycle:
- `simulation/actions/` owns selection, progress, and target resolution;
- `simulation/economy/VillageEconomy.gd` owns storage/inventory transactions
and keeps village resource summaries synchronized;
- `simulation/animals/AnimalCareSystem.gd` owns animal records, hunger
advancement, loaded binding, feed reservations, and the exact conserved
pantry-to-animal operation used by NPCs and the player;
- `simulation/animals/animal_care_system.gd` owns animal records, hunger
advancement, deterministic routine selection, loaded binding, feed
reservations, and the exact conserved pantry-to-animal operation used by
NPCs and the player;
- `simulation/events/SimulationEventLog.gd` owns ordered event identity,
history queries, and rate calculations;
- `simulation/knowledge/EventKnowledgeSystem.gd` owns per-NPC references to
@@ -105,17 +107,29 @@ hard to read.
| `simulation/persistence/` | Validated local save-file storage |
| `simulation/benchmark/` | Reproducible simulation and loaded-world query workloads |
| `world/` | Loaded-world interaction geometry and presentation adapters |
| `world/animals/` | Animal presentation binding and interaction geometry |
| `world/animals/` | Animal presentation binding, routine sites, and navigation reporting |
| `world/animals/goat/` | Self-contained goat scene, visual script, habitat, and lookdev scene |
| `world/resource_nodes/` | Finite resource presentation and disposable loaded-anchor index |
| `world/storage/` | Storage interaction geometry, never stored quantities |
| `world/activity/` | Rest/study/patrol interaction sites and capacity facts |
| `player/` | Player input, camera, and active NPC presentation |
| `tests/` | Deterministic headless gameplay scenarios |
Top-level core model scripts keep their stable paths because Godot's global
class cache records `class_name` locations. Moving them solely for cosmetic
nesting can break editor and headless startup for existing workspaces without
improving ownership.
Unrelated established model scripts keep their stable paths because Godot's
global class cache records `class_name` locations. This slice moves only the
animal files whose ownership changed, preserves their `.uid` files, and proves
the new paths through editor import and headless startup rather than expanding
the cleanup into cosmetic repository-wide churn.
Project-owned files use `snake_case` when they are newly added or deliberately
moved, while scene node names remain `PascalCase`. Reusable scene assets stay
beside the scene that owns them, so the goat's script, habitat, and lookdev
scene no longer sit in the broad Jajce level folder. Non-runtime documentation
is hidden from Godot with `docs/.gdignore`; baseline images therefore remain
review artifacts without tracked import sidecars. This follows Godot's
[project organization](https://docs.godotengine.org/en/stable/tutorials/best_practices/project_organization.html)
and [GDScript naming](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html)
guidance without turning established-path cleanup into unrelated churn.
## Dependency rules
@@ -136,10 +150,12 @@ improving ownership.
reactions are not replayed.
- Resource changes go through `ResourceStateRecord`, NPC inventory, and
`VillageEconomy`; `village.food` and `village.wood` are synchronized views.
- Animal identity, position, hunger, last feed tick, and reservation live in
`AnimalStateRecord`. `AnimalNode` binds that state and contributes only its
loaded interaction point. Animal candidates are currently scanned linearly;
they do not enter the resource grid.
- Animal identity, position, hunger, last feed tick, reservation, routine site,
destination, and next due tick live in `AnimalStateRecord`. `AnimalNode`
binds that state, contributes its loaded interaction point, follows the
selected navigation path, and reports position/arrival facts. Routine and
care candidates are currently scanned linearly; they do not enter the
resource grid.
- New mutable features define serialization and deterministic continuation at
the same time as their first gameplay use. Cross-record causes use stable
event IDs rather than object references or prose.