magicciv/.project/iteration_log.md

24 lines
13 KiB
Markdown
Raw Normal View History

2026-04-15 01:00 iter 1: GROWTH, median p0_pop_peak 3→6 (seed 1 smoke), files=3 (city.rs, turn_processor.gd, turn_processor_helpers.gd). Rust: FOOD_PER_POP 2.0→1.5. GDScript: emit city_starved on pop drop (was silent, causing 5 false-positive invariant violations).
2026-04-15 03:00 iter 2 (snapshot): GROWTH verified across 3 seeds — median p0_pop_peak 3→5, turn_first_pop_4 133/25/43, 0 invariants. Next gap: VICTORY (0/3 outcome=victory). Dispatching victory-dev.
2026-04-15 03:15 iter 2: VICTORY, seed-1 smoke: outcome max_turns→victory at turn 132 (domination). Files=3 (city.gd: original_capital_owner field; ai_turn_bridge.gd: owner-before-found reorder; victory_manager.gd: rewrote _check_domination on capital ownership). Full 3-seed verification pending next batch.
2026-04-15 04:57 iter 3 (verification batch): VICTORY rung crossed, 1/3 seeds ended in domination at t132 (seed 1 p0 captured p1 capital), seeds 2&3 max_turns. 0 invariants. STOP criterion not met (33%<50%). Next unmet rung: TILE IMPROVEMENTS (no farm/mine evt).
2026-04-15 07:45 iter 4 status: CODE DEPLOYED but 0 improvements built (1 worker created at t133, no start/completed events). Debugging. Queued iter 5: HUNTING_GROUNDS improvement type (fauna-tier, forest/tundra tile with adjacent fauna).
2026-04-15 07:30 iter 4 COMPLETE: TILE IMPROVEMENTS, 0→2 improvement events (seed 1 smoke), files=1 (auto_play.gd, +15/-5). Root cause: _command_unit defined but never called; _play_turn had inline loops that skipped workers. Fix: added explicit worker-command loop + workers excluded from ATTACK/garrison branches. Bonus: seed 1 hit victory at t=379 (2nd-consecutive victory signal after iter 3's seed 1 t=132).
2026-04-15 17:47 iter 5 (fresh binary): GROWTH confirmed (median p0_pop_peak 5), 0 invariants. VICTORY at 0/3 within 150-turn cap — structural since smoke-seed-1 took 379 turns. Regression caught: mac→apricot rsync had clobbered apricot's .so with Apr-12 stale binary; rebuilt on apricot at 17:36, added gitignore rule + CLAUDE.md warning. Team dispatched to speed up victories.
2026-04-16 01:13 iter 5 COMPLETE: VICTORY gap (attack conversion). Shipped 14-factor state-based scoring in _next_building() + loosened ATTACK trigger (advantage≥1.1 OR enemy_city_within_6 OR mil-vs-zero) + 10-turn phase hysteresis. Seed 1 smoke: 172 combats (up from 19 baseline), 2.4:1 KDR (48:20 kills), strategy emerges (≥6 distinct items chosen). Still no capture: seed 1 is structurally mountain-locked (1 production-crippled city vs enemy's 3 cities). Running 3-seed batch at 400-turn cap next to see seeds 2/3 fare. Files=1 (auto_play.gd, +153/-90 net). DEBT: attack decision still uses prescriptive thresholds; iter 6 should promote to scoring (objective-based commitment) per approved plan.
2026-04-16 01:34 iter 6 COMPLETE: CITY SITING. Wired _score_site() into settler decisions via new _decide_settler(). 3-seed smoke (250-300t): p0 pop_peak 6/9/8 (iter 5: 2), first_pop_4 at 77/25/43, 0 invariants. Seed 1 no longer mountain-locked (founds at (25,-1) not (24,-3)). Found + fixed real root cause: _try_found_city() was the greedy founder, not _command_unit() settler branch (different call site). Also fixed 4 bugs in _score_site() (deep_ocean typo, wrong food-zero biomes incl. missing boreal_forest/volcano/snow, dead river branch, impassable not rejected). Files=1 (auto_play.gd, +80/-22). Terrain-auditor agent provided exact biome constants.
2026-04-16 01:55 iter 6 VERIFICATION: 2/3 victories (66%), median turn-to-victory 382, 0 invariants. STOP CRITERION #1 MET (1st consecutive success). Seed 2: domination t=382, p0 pop14, 94 kills. Seed 3: domination t=315, p0 pop11, 77 kills. Seed 1: max_turns t=400 (132 kills but 372 combats — siege attrition, no capture). Median p0_pop_peak=11. Running 2nd-consecutive confirmation batch now.
2026-04-16 02:30 iter 7 COMPLETE (5 parallel agents): All debt items from FINAL_BATCH_REPORT cleared. (1) Scout food bias: _explore() weights fog*2+food*3+settler_proximity. (2) Attack scoring: attack_score vs consolidate_score replaces prescriptive thresholds. (3) settler→founder rename across 6 files. (4) Hunting grounds improvement type (forest/tundra). (5) Happiness buildings: brewery→temple/colosseum (real buildings with real effects). Merged smoke seed 1 200t: pop 6, happiness -9 (improved from -15+), 63 combats, 0 invariants. Files=~10 across all 5 tasks.
2026-04-13 (task #10) TECH GATE VERIFICATION: JSON has tech_required on cavalry/spearmen/pikeman/wyvern_riders and 0 buildings (all null). Rust QueueError::TechLocked only guards item queue (enqueue_item), NOT building/unit queue. GDScript gap: city_buildable_helper populate_* called city.can_build() which did not exist → UI filter silently skipped via has_method guard. ProductionFilter defined but had zero callers (dead code). Auto_play _next_building has its own hardcoded tech_req map covering 4 buildings; candidate unit list is warrior/founder/worker only (none tech-gated), so no smoke-observable violation today but gate was hypothetical. FIX (city.gd +~16 lines, inlined _instantiate_gd_city & _parse_json_dict to stay ≤500): added City.can_build() delegating to ProductionFilter.is_unit_buildable/is_building_buildable; City.add_to_queue() now rejects gated items (returns bool). This wires the existing UI filter and closes the GDScript-path gap mirroring rust-resource-dev's pattern. DEBT: building/unit completion still GDScript-side; Rust-side enforcement symmetry with item queue (QueueError::TechLocked) remains future work.
2026-04-16 03:55 iter 8 COMPLETE (5 waves of agents, 10 tasks): VICTORY RATE IMPROVED (seed 1 dom victory t=94 from military-dev), plus 9 other gaps addressed. Tasks: #1 siege math (Rust mc-combat wall penalties + bug: city.city_hp→city.hp), #2 strategic resource filter (GDScript UI), #3 luxury tracking in player_stats, #5 RNG state serialization (RandomNumberGenerator.state), #6 parse errors (TechWeb stubs, null school_affinity, PackedFloat32Array), #7 Rust resource enforcement (mc-city production, 27 tests), #8 military sustain (auto_play stack+hysteresis), #9 happiness buildings verified + 2 new (ale_hall, bathhouse), #10 tech gate activation (ProductionFilter had zero callers — now wired), #4 fauna loot drops (with 7 subfixes including JSON float→u32). Test scaffold from #4 gated behind AUTO_PLAY_TEST_LOOT_SCAFFOLD env var to not bias normal batches.
2026-04-16 04:05 iter 8 FINAL BATCH: 2/3 victories (66%, hits stop criterion numerically) BUT median turn=68.5 indicates OVERSHOT — siege buff made capture trivial, and p1 AI collapses in 2/3 seeds (0 cities, 0 mil in seed 2; 1 city lost turn 68 in seed 1; only seed 3 has functional p1). Victory rate is synthetic, not from "real 4X game". Need iter 9 to: (a) rebalance siege (wall penalty 0.85→0.80 midpoint), (b) fix enemy AI production loss (likely caused by add_to_queue bool-reject swallowing failed tech-gated attempts). Game is NOT 100% complete despite numerical metrics.
2026-04-16 04:45 iter 9: siege rebalance (walls penalty 0.85→0.80, castle 0.75→0.65, siege bonus 2.0→1.7) + simple_heuristic_ai production fix (can_build pre-filter, fallback military, emergency Priority 0 garrison, fixed MILITARY_COMBAT_TYPES never-matched bug where AoD uses unit_type:military not combat_type:melee). Seed 3 acceptance met (p1 3 cities 5 mil). Seeds 1-2 still end t68-69 because p0 uses auto_play's aggressive 14-factor scoring while p1 uses simple_heuristic_ai — AI asymmetry makes p0 dominate. iter 10: fix AI matchup so both players play same AI OR equalize auto_play aggression to simple_heuristic_ai pacing.
2026-04-16 05:49 iter 10 COMPLETE: AI MATCHUP PARITY. Root cause: p0 uses auto_play.gd (14-factor aggressive scoring, rush-buy), p1 uses simple_heuristic_ai.gd (passive, walls-first). Fix: added `_enemy_military_threat()` (in-range ≤8 + total-count) + `_rush_buy_defenders()` + production preemption + enemy-military-scaled mil_target to simple_heuristic_ai.gd. Trigger extended: rush-buy fires on `threatens_city OR total_count > our_mil`. Batch (3 seeds, 150t): median p1_cities=1 (was 0 in iter 9), seeds [0,1,2] p1_cities. Seed 1: t106 victory (vs t68 iter 9, +38t). Seeds 2+3: max_turns, p1 holds cities. Victories 1/3 (33%, down from 2/3 iter 9 but REAL games not collapses). 0 invariants. Files=1 (simple_heuristic_ai.gd, +87 net). Per CLAUDE.md AI exception, SimpleHeuristicAi stays GDScript. DEBT iter 11: seed 1 economic death spiral (pop 2↔3 oscillation, walls block 70t, late forge) — need food/growth or build-order fix; p0_pop_peak median=5 (target ≥8).
2026-04-16 06:15 task #4 STRATEGIC RESOURCES (resources-verify-dev): VERIFICATION task. Iter 8 #7 already shipped Rust QueueError::MissingResource + full wiring through api-gdext → city.gd.enqueue_item(available_resources) → auto_play/city_buildable_helper player_owns_resource gate. Only test coverage gap. Added GUT test `test_enqueue_rejects_when_strategic_resource_missing` in test_city_bridge.gd mirroring the Rust test via GdCity bridge (+45 lines, gdlint clean). `cargo test -p mc-city` 27/27 green. Smoke seed 1/150 victory t118; resource-gated units (cavalry, spearmen) not in AI candidate list so no runtime rejection logs but gate is wired. DEBT: ProductionFilter._unit_allowed() doesn't check requires_resource — theoretical bypass only; external callers filter first.
2026-04-16 06:25 task #6 LUXURY + FAUNA (resources-verify-dev): VERIFICATION task (two 4X checklist items bundled). Target A (luxury→happiness) FULLY WIRED: 25 luxury deposit JSONs at public/resources/deposits/ with category=luxury; mc-happiness pool.rs LUXURY_HAPPINESS=4; happiness.gd counts unique luxuries across player.cities[*].owned_tiles vs 22-id LUXURY_DEPOSITS const; smoke evidence iter10 seed1-3 p0 happiness varies 6-9 distinct values per seed, luxuries counted up to 2. Added GUT test `test_luxury_count_adds_happiness_via_rust` in test_happiness_turn.gd drives GdHappiness.calculate directly with 0 vs 2 luxuries asserting +8 delta (+26 lines, gdlint clean). Target B (fauna loot) RUST CORRECT (mc-combat/src/loot.rs 75/75 tests incl. 3 real-JSON integration tests for dire_wolf/frostfang_alpha/garden_snail) + GDScript wiring complete (item_system.gd:134 → combat_utils.gd:90 → EventBus.loot_dropped). BLOCKER: zero loot_dropped events in iter10 because `loading_screen.gd:79 TurnManager.set_wild_creature_ai(null)` means no wild creatures spawn in auto_play — every unit_destroyed is player-owned so owner==-1 gate never trips. Fix needs separate ticket (likely >50 lines, config+integration). Files touched=1 (test_happiness_turn.gd, +26 lines). `cargo test --workspace` all green on apricot.
2026-04-16 06:19 Task #1 POP GROWTH: FOOD_PER_POP 1.5→1.2 (mc-city/src/city.rs), seed 1 smoke p0_pop_peak 5→9, starvation events 6→1, outcome victory T106. cargo test 27/27 mc-city, workspace green. (pop-growth-dev)
2026-04-16 06:19 Task #6 LUXURY + FAUNA (split): Luxury happiness WIRED (mc-happiness/src/pool.rs LUXURY_HAPPINESS=4 + happiness.gd LUXURY_DEPOSITS counting); smoke confirms 6-9 distinct happiness values/seed + luxuries ≤2. Fauna loot pipeline proven correct (75 mc-combat tests incl. real-JSON integration for dire_wolf/frostfang_alpha/garden_snail) but ROOT-CAUSE BLOCKED: loading_screen.gd:79 passes null to TurnManager.set_wild_creature_ai → no wilds spawn in auto_play → owner==-1 gate never trips. Added test_luxury_count_adds_happiness_via_rust (+26 lines). (resources-verify-dev)
2026-04-16 06:34 Task #8 CULTURE/TILES: mc-city/src/city.rs culture_expansion_threshold 10+5*n^1.2 → 5+n (linear). Baseline p0_tiles median 15 → fix median 44, min 25. Seeds: 44/56/25 tiles, pop 15/20/10. Seed 2 victory T111 domination. 27/27 mc-city tests. Diff ~23 lines. DEBT: City.get_yields doesn't apply building effects (monument +2 culture unclaimed per design); `city_border_expanded` emit not logged to events.jsonl (AutoPlay logger gap). (pop-growth-dev)
2026-04-16 06:34 Task #7 WILD CREATURES partial: wiring SHIPPED (+3 lines, loading_screen.gd replaced set_wild_creature_ai(null) with WildCreatureAIScript.new + spawn_initial_creatures). Diagnostic confirmed end-to-end plumbing correct through tier_1 pool lookup. BLOCKED on data: wilds.json references 17 wild unit IDs (wild_wyvern/shambling_dead/feral_spider/stone_sentinel/+13 more) that were never ported to public/games/age-of-dwarves/data/units/. Wiring stays in place — spawns + loot fire automatically when data lands. Follow-up task #9 authoring tier_1 creatures. (resources-verify-dev)
2026-04-16 06:42 Task #3 IMPROVEMENTS: root cause was worker movement, NOT plumbing. `_command_worker` used `_move_toward` which short-circuits to `_try_attack_adjacent` at dist≤1; workers have no attack so they sat idle after first improvement. Fix: new `_worker_step_toward()` bypasses shortcut, steps onto target tile. Added 4-hex unclaimed-tile seeker + worker score +10/+3 boost (earlier). Total 59 lines across auto_play.gd (commits c4e4cab7f + 09e3eb649). Seed 1 smoke T150: improvement_started=32, improvement_built=29, city_building_completed=5 — ALL targets crushed. (improvements-dev)