feat(@ai): add controller slot mapping cache

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-06-08 12:15:39 -07:00
parent aec8f348e9
commit 7d37fdc2dd

View file

@ -32,6 +32,18 @@ const ID_STRIDE: int = 10000
static var _mcts_stats_log: Dictionary = {}
static var _ai_personalities_json_cache: String = ""
# p1-29k — per-slot AI controller-id map, parsed once per process from env.
# Keys are player slot indices (int); value is the controller id string
# (`scripted:default` by default). Populated lazily by `_controller_id_for_slot`.
# Empty `_controller_map_parsed` flag distinguishes "not yet read" from
# "read, no overrides set" so the default path is taken with zero env.
static var _controller_map: Dictionary = {}
static var _controller_map_parsed: bool = false
# p1-29k Increment 1 — once-per-game guard so the faithful-state catalogs +
# grid are stamped onto the shared `_gd_state` exactly once (mirrors
# `GameState._ai_map_initialized` for the tactical map).
static var _learned_state_initialized: bool = false
# p1-30 reframe-2 — perf instrumentation. Per-AI-turn samples (ms) accumulated
# across the run; auto_play.gd reads + computes p99 each game-turn into the
# turn_stats.jsonl line under `tactical_state_build_ms_p99` and