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:
@@ -13,14 +13,11 @@ namespace UnityEngine
|
||||
public static Vector2 zero => new Vector2(0, 0);
|
||||
public static Vector2 one => new Vector2(1, 1);
|
||||
public static Vector2 up => new Vector2(0, 1);
|
||||
public static Vector2 down => new Vector2(0, -1);
|
||||
public static Vector2 left => new Vector2(-1, 0);
|
||||
public static Vector2 right => new Vector2(1, 0);
|
||||
public float magnitude => (float)Math.Sqrt(x * x + y * y);
|
||||
public float sqrMagnitude => x * x + y * y;
|
||||
public Vector2 normalized { get { float m = magnitude; return m > 1e-6f ? new Vector2(x / m, y / m) : zero; } }
|
||||
public static float Distance(Vector2 a, Vector2 b) => (a - b).magnitude;
|
||||
public static float Dot(Vector2 a, Vector2 b) => a.x * b.x + a.y * b.y;
|
||||
public static float Angle(Vector2 from, Vector2 to) => 0f;
|
||||
public void Normalize() { var n = normalized; x = n.x; y = n.y; }
|
||||
public static Vector2 Lerp(Vector2 a, Vector2 b, float t) => new Vector2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
|
||||
@@ -58,12 +55,9 @@ namespace UnityEngine
|
||||
public static float Distance(Vector3 a, Vector3 b) => (a - b).magnitude;
|
||||
public static float SqrMagnitude(Vector3 a) => a.sqrMagnitude;
|
||||
public static float Dot(Vector3 a, Vector3 b) => a.x * b.x + a.y * b.y + a.z * b.z;
|
||||
public static Vector3 Cross(Vector3 a, Vector3 b) => new Vector3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
|
||||
public static Vector3 Scale(Vector3 a, Vector3 b) => new Vector3(a.x * b.x, a.y * b.y, a.z * b.z);
|
||||
public void Scale(Vector3 s) { x *= s.x; y *= s.y; z *= s.z; }
|
||||
public static Vector3 Lerp(Vector3 a, Vector3 b, float t) => new Vector3(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t);
|
||||
public static Vector3 LerpUnclamped(Vector3 a, Vector3 b, float t) => Lerp(a, b, t);
|
||||
public static Vector3 MoveTowards(Vector3 a, Vector3 b, float d) => b;
|
||||
public static Vector3 operator +(Vector3 a, Vector3 b) => new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
|
||||
public static Vector3 operator -(Vector3 a, Vector3 b) => new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
|
||||
public static Vector3 operator -(Vector3 a) => new Vector3(-a.x, -a.y, -a.z);
|
||||
@@ -84,10 +78,7 @@ namespace UnityEngine
|
||||
public static Quaternion Euler(float x, float y, float z) => identity;
|
||||
public static Quaternion Euler(Vector3 e) => identity;
|
||||
public static Quaternion AngleAxis(float angle, Vector3 axis) => identity;
|
||||
public static Quaternion LookRotation(Vector3 fwd) => identity;
|
||||
public static Quaternion Slerp(Quaternion a, Quaternion b, float t) => identity;
|
||||
public static Quaternion FromToRotation(Vector3 from, Vector3 to) => identity;
|
||||
public static Quaternion Inverse(Quaternion rotation) => identity;
|
||||
public Vector3 eulerAngles { get => Vector3.zero; set { } }
|
||||
public static Vector3 operator *(Quaternion q, Vector3 v) => v;
|
||||
public static Quaternion operator *(Quaternion a, Quaternion b) => identity;
|
||||
@@ -102,11 +93,7 @@ namespace UnityEngine
|
||||
public static Color black => new Color(0, 0, 0, 1);
|
||||
public static Color clear => new Color(0, 0, 0, 0);
|
||||
public static Color red => new Color(1, 0, 0, 1);
|
||||
public static Color green => new Color(0, 1, 0, 1);
|
||||
public static Color blue => new Color(0, 0, 1, 1);
|
||||
public static Color yellow => new Color(1, 0.92f, 0.016f, 1);
|
||||
public static Color cyan => new Color(0, 1, 1, 1);
|
||||
public static Color magenta => new Color(1, 0, 1, 1);
|
||||
public static Color gray => new Color(0.5f, 0.5f, 0.5f, 1);
|
||||
public static Color grey => gray;
|
||||
public static Color Lerp(Color a, Color b, float t) => new Color(a.r + (b.r - a.r) * t, a.g + (b.g - a.g) * t, a.b + (b.b - a.b) * t, a.a + (b.a - a.a) * t);
|
||||
@@ -125,16 +112,9 @@ namespace UnityEngine
|
||||
|
||||
public static class Mathf
|
||||
{
|
||||
public const float PI = 3.14159265f;
|
||||
public const float Infinity = float.PositiveInfinity;
|
||||
public const float NegativeInfinity = float.NegativeInfinity;
|
||||
public const float Epsilon = 1.401298E-45f;
|
||||
public const float Deg2Rad = PI / 180f;
|
||||
public const float Rad2Deg = 180f / PI;
|
||||
public static float Floor(float f) => (float)Math.Floor(f);
|
||||
public static int FloorToInt(float f) => (int)Math.Floor(f);
|
||||
public static float Ceil(float f) => (float)Math.Ceiling(f);
|
||||
public static int CeilToInt(float f) => (int)Math.Ceiling(f);
|
||||
public static float Round(float f) => (float)Math.Round(f);
|
||||
public static int RoundToInt(float f) => (int)Math.Round(f);
|
||||
public static float Abs(float f) => Math.Abs(f);
|
||||
@@ -151,45 +131,23 @@ namespace UnityEngine
|
||||
public static int Clamp(int v, int lo, int hi) => Math.Max(lo, Math.Min(hi, v));
|
||||
public static float Clamp01(float v) => Math.Max(0f, Math.Min(1f, v));
|
||||
public static float Lerp(float a, float b, float t) => a + (b - a) * Clamp01(t);
|
||||
public static float LerpUnclamped(float a, float b, float t) => a + (b - a) * t;
|
||||
public static float LerpAngle(float a, float b, float t) => a + (b - a) * Clamp01(t);
|
||||
public static float MoveTowards(float a, float b, float d) => b;
|
||||
public static float SmoothDamp(float cur, float target, ref float vel, float time) { vel = 0; return target; }
|
||||
public static float SmoothDamp(float cur, float target, ref float vel, float time, float maxSpeed) { vel = 0; return target; }
|
||||
public static float SmoothDampAngle(float cur, float target, ref float vel, float time) { vel = 0; return target; }
|
||||
public static float SmoothStep(float a, float b, float t) => Lerp(a, b, t);
|
||||
public static float Sin(float f) => (float)Math.Sin(f);
|
||||
public static float Cos(float f) => (float)Math.Cos(f);
|
||||
public static float Tan(float f) => (float)Math.Tan(f);
|
||||
public static float Asin(float f) => (float)Math.Asin(f);
|
||||
public static float Acos(float f) => (float)Math.Acos(f);
|
||||
public static float Atan(float f) => (float)Math.Atan(f);
|
||||
public static float Atan2(float y, float x) => (float)Math.Atan2(y, x);
|
||||
public static float Sqrt(float f) => (float)Math.Sqrt(f);
|
||||
public static float Pow(float f, float p) => (float)Math.Pow(f, p);
|
||||
public static float Exp(float f) => (float)Math.Exp(f);
|
||||
public static float Log(float f) => (float)Math.Log(f);
|
||||
public static float Log(float f, float b) => (float)Math.Log(f, b);
|
||||
public static float Log10(float f) => (float)Math.Log10(f);
|
||||
public static float Sign(float f) => Math.Sign(f);
|
||||
public static bool Approximately(float a, float b) => Math.Abs(a - b) < 1e-6f;
|
||||
public static float Repeat(float t, float length) => t - Floor(t / length) * length;
|
||||
public static float PingPong(float t, float length) => length - Math.Abs(Repeat(t, length * 2) - length);
|
||||
public static float DeltaAngle(float a, float b) => Repeat(b - a + 180f, 360f) - 180f;
|
||||
public static float GammaToLinearSpace(float v) => v;
|
||||
public static float LinearToGammaSpace(float v) => v;
|
||||
}
|
||||
|
||||
public static class Debug
|
||||
{
|
||||
public static void Log(object m) { }
|
||||
public static void LogFormat(string m, params object[] a) { }
|
||||
public static void LogWarning(object m) { }
|
||||
public static void LogError(object m) { }
|
||||
public static void LogException(Exception e) { }
|
||||
public static void Assert(bool c) { }
|
||||
public static void DrawLine(Vector3 a, Vector3 b) { }
|
||||
public static void DrawRay(Vector3 a, Vector3 b) { }
|
||||
public static bool isDebugBuild => false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user