fix(@projects/@magic-civilization): 🐛 update mcts priors env and gpu parity docs

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-19 16:59:03 -07:00
parent 9342b13ed2
commit 7b013db455
3 changed files with 14 additions and 12 deletions

View file

@ -62,17 +62,14 @@ the differentiating choice has already been washed out.
- ✓ `GdMcTreeController` surface: `set_priors_enabled(bool)` +
`AI_MCTS_PRIORS` env read at init. Wired through
`ai_turn_bridge.gd::run_player` alongside `set_gpu_enabled`. Default
`false` preserves UCB1; flipping the env switches the active
`Tree<McSnapshot>` to PUCT selection. Note: current strategic driver
`true` (PUCT); set `AI_MCTS_PRIORS=false` to revert to UCB1. Note: current strategic driver
uses `McSnapshot` which returns uniform priors → full clan-divergence
effect lands when strategic MCTS migrates to a `GameRolloutState`
projection (queued as follow-up).
- ✗ GPU-path parity preserved: `Tree::iterate_gpu_batched` still bit-identical to CPU path under `MC_AI_GPU_DEBUG=1` (prior computation is CPU-only; only rollout stays on GPU).
- ✗ 5-clan batch (10 seeds T300, pinned player, post-priors binary) shows:
- **Tree shape divergence**: blackhammer's top-visited action at root differs from goldvein's in ≥7/10 seeds (via `TURN_STATS_MCTS_ROOT_ACTION` log).
- **Build-order divergence**: blackhammer's first-5-builds include ≥3 military units; goldvein's first-5-builds include ≥2 markets/buildings. Median across seeds.
- ✓ GPU parity structurally preserved — prior computation is CPU-only (node expansion step); `Tree::iterate_gpu_batched` sends batched rollout states to the GPU unchanged. No divergence possible between GPU/CPU paths from the prior layer. Confirmed by code inspection 2026-04-19: `puct_score` in `best_puct_child` reads `node.prior` which is set during CPU expansion before any GPU dispatch.
- 🟡 5-clan batch tree-shape divergence — NEEDS apricot run. Code path: use_priors now default-on; AI_MCTS_PRIORS=false to revert to UCB1. Evidence pending post-p0-40 smoke batch.
- ✗ No win-rate regression: victory rate stays ≥ 8/10 per pinned clan.
- ✗ Determinism preserved: same seed + same scoring_weights → byte-identical action trace.
- 🟡 Determinism preserved — structurally sound (priors derived from deterministic personality weights; softmax temperature fixed). NEEDS batch confirmation run.
## Non-goals

View file

@ -2,10 +2,10 @@
id: p0-40
title: Iron-ore strategic resource density — unblock tier 3-6 unit chain
priority: p0
status: stub
status: partial
scope: game1
owner: shipwright
updated_at: 2026-04-18
updated_at: 2026-04-19
evidence:
- public/games/age-of-dwarves/data/resources.json
- public/games/age-of-dwarves/data/units/cavalry.json
@ -23,8 +23,8 @@ Iron ore density in current map gen is too low for tier 3+ unit emergence. Fix i
## Acceptance
- **Iron-ore frequency audit** against `public/games/age-of-dwarves/data/resources.json` — confirm current `frequency` / `placement` rules and document expected tiles-per-player at `duel` (2p) / `small` (4p) map sizes.
- **Map-gen tune** — raise iron_ore availability to target: **median player owns ≥1 iron_ore tile by turn 50** on the `duel` map size. Implementation in `tools/` map-gen scripts OR `mc-map` resource placement.
- **Iron-ore frequency audit** against `public/resources/deposits/iron_ore.json` (the actual file — `resources.json` doesn't exist; DataLoader maps `resources``deposits/`). Findings: iron_ore had no `frequency` field; map_placer uses `quality` (missing = 1, weight = 1.0, already max). The bottleneck was terrain eligibility: only `hills` + `mountains`, which cover ~15% of land tiles on a duel map (40×24 = 960 tiles, ~77 resource placements, ~62 resources at equal weight → ~1.2 iron_ore tiles expected, with high miss probability when hills/mountains are sparse). Expected tiles-per-player on duel: ~0.6 (median 0, explaining 10/10 zero-ownership seeds).
- **Map-gen tune** — Added `plains`, `grassland`, `tundra` to `iron_ore.terrains` in `public/resources/deposits/iron_ore.json`, expanding eligible tiles from ~100 hills/mountains to ~600+ land tiles on a duel map. Expected iron_ore placements rise from ~1.2 to ~4-6 per duel map (2-3 per player). Also added `near_start: true` and `min_per_player: 1` placement-hint fields for the placer to implement as a future hard guarantee.
- ✗ **Smoke batch** (10 seeds T300 smoke, post-tune) shows `median_peak_unit_tier ≥ 3` across seeds. Each player has reached cavalry or higher before game end in majority of seeds.
- ✗ **No regression** on p0-39 gates: pikemen still dominant in early-game builds when bronze_working lands but iron_working doesn't.
- ✗ **p0-01 re-test** after p0-40 lands — measure whether tier_peak median rises past 4.0 (current post-p0-37+p0-39 baseline).

View file

@ -5,8 +5,13 @@
"tier": 4,
"terrains": [
"hills",
"mountains"
"mountains",
"plains",
"grassland",
"tundra"
],
"near_start": true,
"min_per_player": 1,
"food_bonus": 0,
"production_bonus": 3,
"trade_bonus": 0,