feat(ai): Add debug logging for founder AI decision-making in heuristic AI

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-04-10 19:56:30 -07:00
parent bba3da7fd7
commit 9282d5f8cb
2 changed files with 33 additions and 5 deletions

View file

@ -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",

View file

@ -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(