feat(engine-ambient): delete static fallbacks; add MultiInstanceEngineTests

Step 8 (final) of multi-instancing migration. All per-battle statics now
require a BattleAmbient scope — unwrapped writes throw InvalidOperationException
(fail-fast forcing function). MultiInstanceEngineTests proves correctness:
two parallel battles resolve independently, N=4/8/16 stress matches sequential
baseline, GameMgr.GetIns throws without scope.

Migration complete. EngineSessionGate gone. Suite fully green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-07 23:19:37 -04:00
parent 9e93a7b198
commit c789d836f1
15 changed files with 449 additions and 131 deletions

View File

@@ -221,6 +221,19 @@ namespace SVSim.BattleEngine.Tests
.SetValue(null, "headless-udid");
}
// Simple deterministic 40-card deck seed for multi-instance tests. The seed is unused for now
// (every slot is the same vanilla FollowerId), but takes a seed parameter so callers can vary
// it without API churn if/when we want a heterogeneous deck. Card 100011010 is loaded as part
// of EnsureProcessGlobals' HeadlessCardMaster.Load batch so SessionBattleEngine.Setup resolves
// each entry without re-loading.
public static long[] SampleDeck(int seed)
{
var rng = new System.Random(seed);
var deck = new long[40];
for (int i = 0; i < 40; i++) deck[i] = FollowerId;
return deck;
}
// Per-ambient seeder: writes the player/enemy chara ids onto the AMBIENT GameMgr's DataMgr.
// Called by TestBattleScope after the scope is entered so GameMgr.GetIns() routes to the
// per-test GameMgr, not whichever one happened to be ambient last.