Commit Graph

67 Commits

Author SHA1 Message Date
admin 734fe12098 perf: cache SimulationDefinitions lookups in memory
Previously get_action(), get_profession(), get_actions(), get_professions(), get_profession_ids(), and validate() reloaded all .tres files from disk on every call. These are called per-tick (action selection, task completion, NPC inspector refresh) producing unnecessary disk I/O. Now definitions are loaded once and stored in static dicts/lists keyed by ID. Add invalidate_cache() for hot-reload scenarios.
2026-07-05 23:54:55 +02:00
admin 58d3573965 docs: document simulation readability layer 2026-07-05 23:50:29 +02:00
admin d883148132 feat: add npc decision inspector 2026-07-05 23:50:18 +02:00
admin 7edf9acd57 feat: enhance magical world ambience 2026-07-05 23:50:06 +02:00
admin ebbd225628 docs: mark jajce beauty baseline complete 2026-07-05 23:24:26 +02:00
admin ac0282716c fix: run project scenarios in quality gate 2026-07-05 23:24:17 +02:00
admin fde2101690 fix: repair jajce beauty asset pipeline 2026-07-05 23:24:08 +02:00
admin ed0bc3f37f fix: resolve scene dependency errors and missing UID in main.tscn
- WaterBody.tscn, WaterfallBody.tscn: gdshader files were referenced
  with type="Material" instead of type="Shader". Wrapped each
  shader in a ShaderMaterial sub-resource so Godot can load them.
- ChimneySmoke.tscn: reordered sub-resources so StandardMaterial3D
  is defined before QuadMesh that references it.
- WaterfallMist.tscn: fixed node type GpuParticles3D -> GPUParticles3D
  (case-sensitive class name in Godot 4.7).
- jajce_world.gd: added explicit Vector3 type annotation to fix
  'Cannot infer the type of pos variable' parse error.
- main.tscn.uid: created missing UID mapping file. The scene header
  declared uid="uid://rs3hv73svbpa" but no .uid file existed,
  causing Godot to reject the scene as unsupported format.
2026-07-05 23:06:51 +02:00
admin 4463e524aa style: apply gdformat formatting across the entire project
Auto-format all GDScript files using gdformat from gdtoolkit.
This is a baseline formatting pass to ensure consistent style:

- Normalizes indentation and spacing
- Wraps long lines to 100 characters
- Removes trailing whitespace
- Standardizes blank lines between functions

68 files reformatted, 8 files left unchanged (3rd-party addon files
with parse errors excluded).
2026-07-05 23:06:23 +02:00
admin 28a2e42c41 feat: add local quality gate scripts and documentation
Add quality.sh (bash), quality.ps1 (PowerShell), and fix_format.sh
for automated GDScript quality checking. Includes:
- gdformat --check (formatting gate)
- gdlint (lint rules)
- godot --headless project validation (with 30s timeout)
- Optional GUT test support
- --changed mode for checking only modified .gd files
- Compact summary output with NEXT FIX suggestions
- Full logs saved to logs/quality/latest/

Add docs/local_quality_gate.md with setup and usage instructions.
2026-07-05 23:06:18 +02:00
admin 22613a445e WIP: feat(scene) integrate beauty pass — shader water, building blockouts, wind, smoke, 6 textures
- Add 3 missing Terrain3D textures: Dirt Path (id=3), Riverbank Stone (id=4),
  Compacted Ground (id=5) with procedural albedo PNGs + generate tool
- Replace greybox river BoxMesh with animated vertex-displacement water shader
- Replace greybox waterfall BoxMesh with scrolling-UV waterfall shader
- Add WaterfallMist GPUParticles3D with upward drift and alpha fade
- Add wind vertex shader for tree canopies (sin-based, height-weighted sway)
- Replace StylizedTree.tscn with script-driven procedural tree supporting
  3 canopy color variants and position-based randomization
- Replace greybox house boxes with StylizedHouse (walls + pitched roof + door)
- Replace mill box with StylizedMill (body + roof + water wheel cylinder)
- Replace fortress box with FortressBlockout (keep + parapet + corner turret)
- Replace bridge box with BridgeBlockout (deck + pillar supports)
- Add ChimneySmoke GPUParticles3D on each house roof
- Height-snap buildings (fortress + village) to terrain surface in _ready()
- Update JajceWorld.tscn: remove all greybox landmark sub-resources, instance
  new scenes, keep terrain/navigation/sky/fog as-is
- Update scaffold test for new scene structure and beauty elements
2026-07-05 20:10:45 +02:00
admin 6c11dc5dd6 WIP: feat(scene) initial beauty baseline — terrain textures, sky, foam, mist, foliage, shadows
- Add 3 Terrain3D texture assets (limestone, valley grass, warm soil)
- Sculpt initial Terrain3D heightmap with ridge, valley, waterfall drop
- Replace plain water with emissive-tinged material
- Add foam mesh, mist spheres, and procedural sky with valley fog
- Add 10 StylizedTree instances around village perimeter
- Enable directional light shadows with extended cascade range
- Add tree height snapping to terrain surface
- Add refined scaffold tests for material count, terrain height, foliage, sky, fog
- Add terrain texture PNGs and StylizedTree.tscn scene
- Add generate_jajce_terrain.gd tool
2026-07-05 20:05:44 +02:00
admin f12fb6ad78 docs: mark jajce runtime integration complete 2026-07-05 18:18:08 +02:00
admin 5851c0362a feat: integrate jajce world into runtime 2026-07-05 18:17:59 +02:00
admin 40014411fb docs: mark quicksave phase complete 2026-07-05 18:10:44 +02:00
admin 08b7bee0e5 feat: add validated quicksave persistence 2026-07-05 18:10:33 +02:00
admin 2fcf641152 docs: document economic event pipeline 2026-07-05 18:04:20 +02:00
admin f9601a67d1 feat: add structured economic events 2026-07-05 18:04:11 +02:00
admin ebf70a711a docs: document food storage transaction loop 2026-07-05 17:57:33 +02:00
admin 6dbb395bd6 feat: add location-based food storage loop 2026-07-05 17:57:24 +02:00
admin 3ea8f02d55 docs: mark simulation architecture gate complete
- Update ACTION_SYSTEM_ARCHITECTURE.md to describe the active-position
  contract and visual lifecycle proof
- Mark BUILD_IN_PUBLIC_PLAN.md systems-gate section complete
- Mark LEARNING_ROADMAP.md architecture-gate section complete and
  renumber post-gate implementation sequence
- Update PROJECT_CONTEXT.md immediate-milestone section to reflect
  completed gate and next food-loop milestone
- Update SIMULATION_STATE_SCHEMA.md with NPCStateRecord v2 details
- Update ADR 0001 checklist to mark active-position sync done
2026-07-05 17:21:23 +02:00
admin a8ae331f51 feat: synchronize authoritative npc position
- NpcVisual emits position_changed signal during _physics_process
- SimulationManager.synchronize_npc_position() writes active position
  into SimNPC state on movement, arrival, and navigation failure
- WorldViewManager forwards position_changed and syncs before
  despawn/reload
- SimNPC stores travel_target_position and has_travel_target as
  versioned state; NPCStateRecord v2 persists them with v1 migration
- WorldViewManager.spawn_npc_visual() resumes travel for traveling NPCs
  via SimulationManager.request_current_travel()
- WorldViewManager.despawn_npc_visual() syncs position before removal
- WorldViewManager.reload_npc_visual() spawns a visual from persisted
  state without rerolling target selection
- tests/npc_visual_lifecycle_test.gd proves unload/reload preserves
  action, target, reservation, position, RNG state, and checksum
- simulation_state_serialization_test adds legacy v1 NPC migration test
  that does not invent an active travel target
2026-07-05 17:21:17 +02:00
admin 4f9dc842fd docs: mark action separation phase complete 2026-07-05 14:17:57 +02:00
admin 4673f0698d refactor: separate action system responsibilities 2026-07-05 14:17:45 +02:00
admin 81df7b5939 docs: mark simulation definitions phase complete 2026-07-05 13:35:42 +02:00
admin f816f3976a feat: add simulation action definitions 2026-07-05 13:35:33 +02:00
admin 12f9ba616f docs: mark resource authority phase complete 2026-07-05 13:26:26 +02:00
admin 363620b731 refactor: move resource authority into simulation 2026-07-05 13:26:19 +02:00
admin f83d2c7704 docs: mark simulation state phase complete 2026-07-05 12:52:13 +02:00
admin 30cac28fc0 feat: add versioned simulation state records 2026-07-05 12:52:07 +02:00
admin c690937afa docs: update architecture gate progress
BUILD_IN_PUBLIC_PLAN.md:
- Mark systems gate items deterministic clock and headless checksum
  as complete; remaining gate work stays flagged as in-progress
- Rename TaskZone references to ActivityMarkers for consistency

LEARNING_ROADMAP.md:
- Add architecture gate progress note: first deterministic slice
  (SimulationClock, seeded streams, headless checksum) is implemented
- Update recommended implementation order to reflect shifted priorities

PROJECT_CONTEXT.md:
- Note that farm and forest markers have been deleted from main.tscn
- Update activity marker description (4 remaining: guard/study/rest/food)
- Add SimulationClock.gd and deterministic_simulation_test.gd to repo map
- Update technical debt: randomness is now seeded but RNG state is not
  yet serialized; clock is explicit but orchestration still lives on scene tree
- Gate status updated with completed first-slice summary

RESOURCE_NODE_MIGRATION.md:
- Mark Phase 4b (player parity) complete
- Phase 6 renamed from 'remove zone model' to 'replace activity markers'
  with progress note: TaskZone container and FarmZone/ForestZone deleted
- Update divergences to note farm/forest scene nodes have been removed
2026-07-05 11:23:19 +02:00
admin 37610242bf feat: add deterministic simulation foundation
Replace implicit randomness with seeded per-NPC RandomNumberGenerator
streams so the same seed always produces the same scenario outcome.

- Add SimulationClock (RefCounted): explicit fixed-step clock that
  converts frame delta into simulation ticks while preserving sub-tick
  remainder; replaces raw _process tick_timer accumulation
- Add simulation_seed export (int=1337) to SimulationManager; drive
  per-NPC RNG streams via seed + npc_id + stream_id derivation
  (stream 0=init, stream 1=wander)
- Add get_wander_offset(npc_id) to SimulationManager so wander targets
  are deterministic per seed; WorldViewManager calls it instead of
  local randf_range()
- Add get_state_snapshot() and get_state_checksum() to SimulationManager
  for headless verification and future save/load
- Convert SimNPC/SimVillage const DEBUG_LOGS to instance var debug_logs
  so headless tests can silence output without recompilation
- Pass RandomNumberGenerator through SimNPC._init() instead of using
  global randf_range() for hunger/energy/position/scoring noise
- Remove obsolete farm_zone and forest_zone exports from
  WorldViewManager and their marker/tree scene children from main.tscn;
  NPC gather tasks use ResourceNode exclusively
- Rename TaskZone container to ActivityMarkers in main.tscn and update
  all scene paths (player, WVM, tests) to match
- Add headless deterministic_simulation_test.gd: verifies clock
  accuracy, same-seed equality, different-seed divergence, and
  24-tick scenario checksum without loading main.tscn
2026-07-05 11:23:12 +02:00
admin b50fae671a docs: mark Jajce scaffold proof complete 2026-07-04 21:08:16 +02:00
admin 556d0fdc26 feat: add Jajce world scaffold 2026-07-04 21:06:57 +02:00
admin 83fc258afc docs: establish simulation architecture gate 2026-07-04 19:55:30 +02:00
admin 0900022558 docs: mark resource node phase 4 complete 2026-07-04 19:48:15 +02:00
admin 326df51cbe feat: add player resource node harvesting 2026-07-04 19:47:31 +02:00
admin f5e7326d49 docs: update plans with phase progress, bug log, and current architecture state
RESOURCE_NODE_MIGRATION.md:
- Add progress overview table with per-phase completion status
- Document key divergences from original plan (zone fallback removal,
  navigation_failed signal, stale-path prevention, duplicate detection)
- Add bug log table (11 bugs found and fixed during implementation)
- Mark completed phases 1-3 with checkmarks
- Split phase 4 into 4a (wood, done) and 4b (player parity, not started)
- Replace flat implementation order with checkable table
- Update definition-of-done with per-criterion status

PROJECT_CONTEXT.md:
- Advance snapshot commit reference from e30d208 to b8752f8
- Note that gather_food/gather_wood now use ResourceNode instances
- Explain zone marker status (player use only, NPCs use nodes)
- Update runtime flow diagram with navigation_failed pathway
- Add resource_nodes/ to repository map
- Update technical debt entries to reflect current state
2026-07-04 19:31:43 +02:00
admin b8752f8835 feat: add navigation_failed signal with time-based stuck detection and simulation pipeline
NpcVisual:
- Add navigation_failed(sim_id) signal distinct from arrived_at_target
  so the simulation layer can distinguish genuine arrival from failure
- Replace integer stuck_counter with delta-based stuck_time and
  exported stuck_timeout (1.5s) for frame-rate-independent detection
- Add path_request_id / path_pending mechanism to reject stale
  async path results when a new target is set or NPC dies
- On empty path or stuck movement, emit navigation_failed instead
  of arriving; only emit arrived_at_target when truly close to target
- Reduce arrival_distance back to 0.6 now that navigation_failure
  is properly signalled (no longer needed as a workaround)
- clamp arrival_distance reference in apply_dead_visual_state

SimNPC:
- Remove retry_count (replaced by navigation_failed signal pathway)
- Move last_task assignment from set_task() to task completion in
  SimulationManager so it reflects the task that actually finished

SimulationManager:
- Add notify_npc_navigation_failed(): release reservation, record
  last_task, send NPC to wander for 2s, emit task_changed signal
- Add notify_npc_target_unavailable() as public alias of above
- Guard extraction with node.reserved_by == npc.id to prevent
  stale/illegitimate extraction when reservation is lost
- Guard fallback zone task completion (apply_npc_task) so it only
  fires for non-resource tasks (gather_food/wood with no target
  silently skip instead of applying zone values)
- Remove retry_count safety net (fully replaced by signal pipeline)

WorldViewManager:
- Connect navigation_failed signal in spawn_npc_visual()
- Skip target assignment for empty/idle/dead task states
- When no resource node available for gather_food/wood, call
  notify_npc_target_unavailable() so NPC wanders instead of idling
- Add _on_npc_visual_navigation_failed handler delegating to
  SimulationManager.notify_npc_navigation_failed()
- Remove retry_count references
2026-07-04 19:24:30 +02:00
admin 1837bc0d2d fix: detect duplicate ResourceNode node_id and use interaction_point for distance calc
- Push error and disable node when duplicate node_id is registered
  to prevent silent conflict during find_available()
- Use interaction_point.global_position instead of self.global_position
  in find_available() so distance is measured to the marker NPCs
  actually navigate toward
2026-07-04 19:24:19 +02:00
admin 41bfc8d90a fix: empty-path re-entrancy, retry_count reset, := to = for Variant 2026-07-03 18:51:13 +02:00
admin c6033b63fb feat: authoritative extraction from ResourceNode on task completion
Phase 3 of ResourceNode migration:
- Add apply_resource_delta to SimVillage for clean resource changes
- Extract from reserved ResourceNode on task completion instead of
  hard-coded apply_npc_task for gather_food/gather_wood
- Detect depleted/unavailable targets on arrival and replan
2026-07-03 18:32:34 +02:00
admin 0dfaa06f9c fix: remove invalid StringName cast from dictionary get 2026-07-03 18:28:06 +02:00
admin 8049c52e0f fix: use Variant assignment for _try_get_resource_target return type 2026-07-03 18:26:50 +02:00
admin 9cd38a1adb feat: add ResourceNode system with target selection and reservation
Phase 1-2 of the ResourceNode migration plan:

- Create ResourceNode class (world/resource_nodes/) with extraction,
  reservation, nearest-available selection, and debug label
- Place 4 resource instances in main.tscn (2 berry bushes, 2 trees)
- Add target_id to SimNPC for tracking which node an NPC is using
- Add set_npc_target_id and release_npc_reservation to SimulationManager
  with cleanup on task change, completion, and death
- Update WorldViewManager to query available ResourceNodes first,
  falling back to zone markers with a logged warning
2026-07-03 18:18:51 +02:00
admin e30d208c3f chore: standardize cross-platform development setup 2026-07-03 13:10:12 +02:00
Rijad Zuzo 595233e5df feat(plugin): add terrain3d plugin installation 2026-07-03 13:05:56 +02:00
Rijad Zuzo 5e171ae63a chore: change the dead npcs to have no collision 2026-06-22 00:00:32 +02:00
Rijad Zuzo b5e2493c2a feat: add proper death from starvation and survival tasks urgency 2026-06-21 23:37:58 +02:00
Rijad Zuzo eef2068747 feat: add better priorities setting 2026-06-21 14:41:19 +02:00