engine cleanup passes 4-7 + multi-instancing ambient rip
Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,86 +7,4 @@ using UnityEngine;
|
||||
using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick;
|
||||
namespace Wizard.RoomMatch
|
||||
{
|
||||
public partial class PlayerControllerForOwn
|
||||
{
|
||||
private string _battleID;
|
||||
private bool _isEmitedEnterRoom;
|
||||
private bool _receiveAliveForDisconnect;
|
||||
private List<NetworkBattleSender.EmitData> _alreadyEmitList;
|
||||
private const float FAILURE_RETRY_INTERVAL = 5f;
|
||||
private Coroutine _escapeRoomWaitCoroutine;
|
||||
private DialogBase _escapeRoomDialog;
|
||||
public GatheringAutoJoinTaskInfo GatheringAutoJoinTaskInfo;
|
||||
public bool IsEmitting { get; set; }
|
||||
public bool IsEmitLeave { get; set; }
|
||||
public bool IsEmitRelease { get; set; }
|
||||
private bool IsEnableSendForWatch { get; set; }
|
||||
public bool IsSendRematch { get; set; }
|
||||
public bool IsDoneForceClose { get; set; }
|
||||
public long GetBattleId() => default!;
|
||||
public PlayerControllerForOwn(Player target, RoomConnectController room) { }
|
||||
public void Init(bool isRecovery) { }
|
||||
public void Ready() { }
|
||||
public void CancelReady() { }
|
||||
public void CheckGatheringRoom() { }
|
||||
public void SelectDeck(DeckData deck, bool isDefaultDeck) { }
|
||||
public void Release() { }
|
||||
public void SelectDeckForMutliDeck(DeckData deck, bool isDefaultDeck, Action apiEndAction) { }
|
||||
public void SelectDeckOpen() { }
|
||||
public void SelectDeckClose() { }
|
||||
public void FirstTurnSelect(int type) { }
|
||||
public void CreateRoomServer(RoomConnectController room) { }
|
||||
public void CreateRoomBattleServer(RoomConnectController room) { }
|
||||
public void SetBattleId(string battleId) { }
|
||||
public void SendDeckInfoForWatch(DeckData deck) { }
|
||||
public void EnterRoomServer(string roomId) { }
|
||||
private void UpdateSelfRank() { }
|
||||
private void EnterRoomSuccess(BaseRoomBattleEnterRoomTask task) { }
|
||||
public void RecoverRoomSuccess(OpenRoomBattleGetRecoveryParamTask task) { }
|
||||
public void InitilizeRoomBattleServer(string roomId) { }
|
||||
public static List<int> ConvertResultMap(Dictionary<int, List<InitializeRoomBattle.Result>> resultMap, int targetViewerId) => default!;
|
||||
private static Dictionary<string, object> CreateSendDeckParameter(DeckData deckData) => default!;
|
||||
public void SendOwnerChoiceDeckForWatch(DeckData deck) { }
|
||||
public void SendDraftChoiceDeckForWatch(DeckData[] deck) { }
|
||||
public void SendOpponentResetForWatch() { }
|
||||
private void SendRoomNotify(string notifyMsg) { }
|
||||
public void EnterRoomBattleServer() { }
|
||||
public void ExitRoom(string roomId) { }
|
||||
protected void CloseOrExitRoomBeforeInitializeRoomBattleServer() { }
|
||||
private IEnumerator EscapeRoomReceiveCoroutine(Action onRetry) => default!;
|
||||
public void StopEscapeRoomReceiveCorutineAndCloseDialog() { }
|
||||
public void PlayExitRoom() { }
|
||||
public void KickRoom() { }
|
||||
public void PlayKick() { }
|
||||
public void ForceKickRoom() { }
|
||||
public void OnReceiveAlive() { }
|
||||
public void CloseRoom() { }
|
||||
public void ReleaseRoom() { }
|
||||
public void ForceCloseRoom() { }
|
||||
public void StartForceCloseRoom() { }
|
||||
public void OwnerForcecloseRoom() { }
|
||||
private IEnumerator ForceCloseCoroutine() => default!;
|
||||
public void Emote(int id) { }
|
||||
public void SendDeckReset(Action SuccessFunction, Action onFailed = null) { }
|
||||
public void Send2PickBeginDeckCreateAPIAfterEmit(Action SuccessFunction, Action onFailed = null) { }
|
||||
public void Emit2PickBeginDeckCreate(int[] candidateClassIds) { }
|
||||
public void Send2PickSelectClassAPIAfterEmit(int inClassId, Action SuccessFunction) { }
|
||||
public void Emit2PickSelectClass(int inClassId, List<CandidateCard> candidateCardList) { }
|
||||
public void Send2PickSelectCardAPIAfterEmit(int selectedId, Action SuccessFunction) { }
|
||||
public void Emit2PickSelectCard(List<CandidateCard> candidateCards) { }
|
||||
public void EmitRetry2PickDeckCreate() { }
|
||||
public void SendBanDeck(DeckData deck) { }
|
||||
public void SendSetDeckForDeckOpenBo1(DeckData deck) { }
|
||||
public void SendSetMultiDeck(List<DeckData> deckList) { }
|
||||
public void SendMultiDeckRematch() { }
|
||||
private void EmitRematch() { }
|
||||
public void ReceiveRematch() { }
|
||||
public void SendConventionRetire(Action callback) { }
|
||||
public void EmitNotifyRoomCreateOrEnter(ROOM_URI id, Dictionary<string, object> data = null) { }
|
||||
private void EmitNotify(ROOM_URI id, Dictionary<string, object> data = null) { }
|
||||
public void OnAck(Dictionary<string, object> inObject) { }
|
||||
private void EmitMsg(string uri, Dictionary<string, object> dataList = null, Action callback = null, bool isGetableAck = true) { }
|
||||
private void EmitMsg(ROOM_URI uri, Dictionary<string, object> dataList = null, Action callback = null, bool isGetableAck = true) { }
|
||||
public IEnumerator EmitRetry(string uri) => default!;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user