From 9282d5f8cbf14c3068688076e4ef3fad0d2f890d Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 10 Apr 2026 19:56:30 -0700 Subject: [PATCH] =?UTF-8?q?feat(ai):=20=E2=9C=A8=20Add=20debug=20logging?= =?UTF-8?q?=20for=20founder=20AI=20decision-making=20in=20heuristic=20AI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../src/modules/ai/simple_heuristic_ai.gd | 19 +++++++++++++++++++ .../src/modules/management/turn_processor.gd | 19 ++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/game/engine/src/modules/ai/simple_heuristic_ai.gd b/src/game/engine/src/modules/ai/simple_heuristic_ai.gd index 46d73ae6..4177f0f7 100644 --- a/src/game/engine/src/modules/ai/simple_heuristic_ai.gd +++ b/src/game/engine/src/modules/ai/simple_heuristic_ai.gd @@ -193,6 +193,25 @@ static func _decide_founder_action( dist_own >= FOUND_MIN_DIST_OWN or own_city_positions.is_empty() ) + print( + ( + "[AI DEBUG] founder p%d idx=%d pos=%s cities=%d dist_own=%d " + + "enemies=%d dist_enemy=%d far=%s clear=%s can_found=%s" + ) + % [ + player.index, + idx, + str(unit.position), + own_city_positions.size(), + dist_own, + enemy_units.size(), + dist_enemy, + str(far_enough_from_own), + str(clear_of_enemies), + str(unit.can_found_city), + ] + ) + if far_enough_from_own and clear_of_enemies: return { "type": "found_city", diff --git a/src/game/engine/src/modules/management/turn_processor.gd b/src/game/engine/src/modules/management/turn_processor.gd index 70da62c6..d9d335b7 100644 --- a/src/game/engine/src/modules/management/turn_processor.gd +++ b/src/game/engine/src/modules/management/turn_processor.gd @@ -5,9 +5,12 @@ extends RefCounted ## healing, economy). Still known-broken and out of scope: _process_culture, ## _process_golden_age, _process_loot_decay, _process_spell_system, ## _process_government — all blocked on empty module stubs. -## Calls disabled in turn_manager.gd::next_player (Diplomacy.process_turn) -## and turn_processor.gd::_process_* until these modules are rebuilt. -## Grep for `DISABLED:` to find every guarded call site. +## Calls disabled in turn_manager.gd::next_player (Diplomacy.process_turn, +## EconomyScript.apply_protection_effects) and turn_processor.gd::_process_* +## until these modules are rebuilt. The `_process_climate` sub-calls into +## WeatherScript and ClimateEffectsScript are also disabled — marine_harvest, +## climate, and ecosystem still run. Grep for `DISABLED:` to find every +## guarded call site. const PlayerScript: GDScript = preload("res://engine/src/entities/player.gd") const UnitScript: GDScript = preload("res://engine/src/entities/unit.gd") @@ -384,13 +387,19 @@ func _process_government(_player: RefCounted) -> void: # Player func _process_climate(game_map: RefCounted) -> void: # GameMap ## Order: marine_harvest → weather → climate → climate_effects → ecosystem. + ## DISABLED: WeatherScript and ClimateEffectsScript are empty stubs; their + ## process_turn calls abort next_player and kill the arena turn loop. + ## See top-of-file out-of-scope list. Revive once weather + climate_effects + ## modules are rebuilt. (marine_harvest as MarineHarvestScript).process_turn(game_map, GameState.players) (climate as ClimateScript).ocean_dead_fraction = ( (marine_harvest as MarineHarvestScript).ocean_dead_fraction ) - (weather as WeatherScript).process_turn(game_map) + # (weather as WeatherScript).process_turn(game_map) (climate as ClimateScript).process_turn(game_map, GameState.turn_number, GameState.map_seed) - (climate_effects as ClimateEffectsScript).process_turn(game_map, weather, GameState.players) + # (climate_effects as ClimateEffectsScript).process_turn( + # game_map, weather, GameState.players + # ) # Step 5: Ecosystem — flora dynamics, fauna dynamics, quality recomputation if ecosystem != null and ecology_db != null: (ecosystem as EcosystemScript).process_turn(