From d9a04d3a5970e98d4d16b0e486bcb2d43cba2123 Mon Sep 17 00:00:00 2001 From: Natalie Date: Thu, 16 Apr 2026 11:24:16 -0700 Subject: [PATCH] =?UTF-8?q?fix(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20resolve=20wild=5Fcreature=5Fai=20regression=20pa?= =?UTF-8?q?cing=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .project/iteration_log.md | 1 + src/game/engine/src/modules/ai/wild_creature_ai.gd | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.project/iteration_log.md b/.project/iteration_log.md index 4bcb31c6..26cf44c0 100644 --- a/.project/iteration_log.md +++ b/.project/iteration_log.md @@ -29,3 +29,4 @@ 2026-04-16 07:23 Task #13 WILD AI CRASH: wild_creature_ai.gd replaced _unit_manager.get_units_at(pos) calls (method doesn't exist on UnitManager) with local _has_player_unit_at helper reading GameState.get_primary_layer().units directly. -11/+10 lines. Smoke seed 1/50: 0 get_units_at errors (was 250-330/game). Note: 6 remaining SCRIPT ERRORs from item_system.gd:103 drop_all_loot — flagged for follow-up. (combat-volume-dev) 2026-04-16 07:24 Task #11 TECH PROGRESSION: mc-city/src/city.rs base science 1.0→5.0 + auto_play.gd library score 3.0→8.0 gated on scholarship tech. Seeds p0_techs: 22/22/21, median 22 (target ≥20 MET). 28/28 mc-city tests pass. 2 files, ~24 lines total. Compatible with task #10 building_yields fix (no overlap). (improvements-dev) 2026-04-16 07:28 Task #15 LOOT CRASH: item_system.gd drop_all_loot FFI fix — coerce equipped_items + ground_loot into typed Array[Dictionary] before Rust call + early-return when both empty. Root cause: GDScript Array[] is NIL element type; Rust FFI rejects. +12/-4 lines. Smoke seed 1/50: 0 drop_all_loot / item_system / SCRIPT ERROR lines (was 6/game). (combat-volume-dev) +2026-04-16 11:20 REGRESSION BATCH (session resume): 3 seeds × 300 turns. Outcome: 3/3 VICTORY (100%, too high — target 50-80%). Median TTV=116 (target 200-350, TOO FAST). PASS: pop_peak=20, tiles=58, luxury_happiness (10 distinct), improvements=67 total, 0 invariants, 0 SCRIPT ERRORs. FAIL (marginal): techs=19 (need 20), combats=101 (need 120), both-players-p5m4-T100 = 1/3 (need 2/3), loot_dropped=0, strategic_resources gate not instrumented, worker improvements/seed min=0 (seed 2 zero). Seed 3 is the "good" game (252 turns, 29 pop, 179 combats, 100 tiles, 31 techs — healthy full 4X). Seeds 1+2 end too fast (99/116 turns). Key insight: extending TTV 120→220 will cascade-fix techs+combats+both-players. Dispatching pacing + fauna engagement + instrumentation specialists. diff --git a/src/game/engine/src/modules/ai/wild_creature_ai.gd b/src/game/engine/src/modules/ai/wild_creature_ai.gd index 13c16f4e..31f2fe73 100644 --- a/src/game/engine/src/modules/ai/wild_creature_ai.gd +++ b/src/game/engine/src/modules/ai/wild_creature_ai.gd @@ -13,7 +13,7 @@ const CombatResolverScript = preload("res://engine/src/modules/combat/combat_res const DEFAULT_DETECTION_RADIUS: int = 4 const DEFAULT_LEASH_RADIUS: int = 5 -const AGGRO_OVERRIDE_RADIUS: int = 8 +const PREDATOR_RADIUS: int = 5 const ROAM_CHANCE: int = 40 const CITY_DRIFT_CHANCE: int = 20 @@ -96,7 +96,8 @@ func _act( var home_pos: Vector2i = _find_nearest_lair( unit.position, leash_radius + detection_radius ) - var target: RefCounted = _find_attack_target(unit, detection_radius) + var predator_scan: int = max(detection_radius, PREDATOR_RADIUS) + var target: RefCounted = _find_attack_target(unit, predator_scan) if target != null: # Step toward target, then attack if adjacent and still able.