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:
@@ -10,7 +10,6 @@ namespace UnityEngine
|
||||
public partial struct Vector4
|
||||
{
|
||||
public static Vector4 zero => default;
|
||||
public static Vector4 one => new Vector4(1f, 1f, 1f, 1f);
|
||||
public static Vector4 operator *(Vector4 a, float s) => new Vector4(a.x * s, a.y * s, a.z * s, a.w * s);
|
||||
public static Vector4 operator *(float s, Vector4 a) => new Vector4(a.x * s, a.y * s, a.z * s, a.w * s);
|
||||
public static Vector4 operator +(Vector4 a, Vector4 b) => new Vector4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w);
|
||||
@@ -33,7 +32,6 @@ namespace UnityEngine
|
||||
public bool hasChanged { get; set; }
|
||||
public Matrix4x4 localToWorldMatrix => default;
|
||||
public Matrix4x4 worldToLocalMatrix => default;
|
||||
public void Translate(float x, float y) { }
|
||||
public void Rotate(float x, float y) { }
|
||||
public void Translate(Vector3 translation, Space relativeTo) { }
|
||||
public void Rotate(Vector3 eulers, Space relativeTo) { }
|
||||
@@ -63,10 +61,6 @@ namespace UnityEngine
|
||||
public partial class Material
|
||||
{
|
||||
public void CopyPropertiesFromMaterial(Material mat) { }
|
||||
public void SetVectorArray(string name, Vector4[] values) { }
|
||||
public void SetVectorArray(int nameID, Vector4[] values) { }
|
||||
public void SetVectorArray(string name, List<Vector4> values) { }
|
||||
public void SetVectorArray(int nameID, List<Vector4> values) { }
|
||||
}
|
||||
|
||||
public partial class Mesh
|
||||
@@ -77,15 +71,11 @@ namespace UnityEngine
|
||||
public Vector2[] uv { get; set; }
|
||||
public Color32[] colors32 { get; set; }
|
||||
public void MarkDynamic() { }
|
||||
public void RecalculateNormals() { }
|
||||
public void RecalculateTangents() { }
|
||||
}
|
||||
|
||||
public partial class Texture2D
|
||||
{
|
||||
public byte[] EncodeToPNG() => Array.Empty<byte>();
|
||||
public Color32[] GetPixels32() => Array.Empty<Color32>();
|
||||
public void SetPixels32(Color32[] colors) { }
|
||||
public bool LoadImage(byte[] data) => false;
|
||||
}
|
||||
|
||||
@@ -99,7 +89,6 @@ namespace UnityEngine
|
||||
{
|
||||
public static int PropertyToID(string name) => 0;
|
||||
public static void SetGlobalColor(string name, Color value) { }
|
||||
public static void SetGlobalColor(int nameID, Color value) { }
|
||||
}
|
||||
|
||||
public partial class Animation
|
||||
@@ -115,21 +104,14 @@ namespace UnityEngine
|
||||
public bool playOnAwake { get; set; }
|
||||
public int priority { get; set; }
|
||||
public void PlayOneShot(AudioClip clip) { }
|
||||
public void PlayOneShot(AudioClip clip, float volumeScale) { }
|
||||
}
|
||||
|
||||
public partial class Camera
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
public bool allowMSAA { get; set; }
|
||||
public int eventMask { get; set; }
|
||||
public TransparencySortMode transparencySortMode { get; set; }
|
||||
public void ResetAspect() { }
|
||||
public static int GetAllCameras(Camera[] cameras) => 0;
|
||||
}
|
||||
|
||||
public enum TransparencySortMode { Default, Perspective, Orthographic, CustomAxis }
|
||||
|
||||
public partial struct CharacterInfo
|
||||
{
|
||||
public int advance;
|
||||
@@ -144,15 +126,7 @@ namespace UnityEngine
|
||||
public static event Action<Font> textureRebuilt;
|
||||
public bool GetCharacterInfo(char ch, out CharacterInfo info, int size, FontStyle style)
|
||||
{ info = default; return false; }
|
||||
public bool GetCharacterInfo(char ch, out CharacterInfo info, int size)
|
||||
{ info = default; return false; }
|
||||
public bool GetCharacterInfo(char ch, out CharacterInfo info)
|
||||
{ info = default; return false; }
|
||||
public void RequestCharactersInTexture(string characters, int size, FontStyle style) { }
|
||||
public void RequestCharactersInTexture(string characters, int size) { }
|
||||
public void RequestCharactersInTexture(string characters) { }
|
||||
// suppress unused-event warning while keeping the API surface
|
||||
private void _TouchTextureRebuilt() => textureRebuilt?.Invoke(this);
|
||||
}
|
||||
|
||||
public partial class Light
|
||||
@@ -167,23 +141,18 @@ namespace UnityEngine
|
||||
|
||||
public partial class Application
|
||||
{
|
||||
public static string streamingAssetsPath => "";
|
||||
public static NetworkReachability internetReachability => NetworkReachability.NotReachable;
|
||||
public static void OpenURL(string url) { }
|
||||
}
|
||||
|
||||
public enum NetworkReachability { NotReachable, ReachableViaCarrierDataNetwork, ReachableViaLocalAreaNetwork }
|
||||
public enum NetworkReachability { NotReachable}
|
||||
|
||||
public partial class Screen
|
||||
{
|
||||
public static int sleepTimeout { get; set; }
|
||||
public static void SetResolution(int width, int height, bool fullscreen) { }
|
||||
public static void SetResolution(int width, int height, FullScreenMode mode) { }
|
||||
}
|
||||
|
||||
public enum FullScreenMode { ExclusiveFullScreen, FullScreenWindow, MaximizedWindow, Windowed }
|
||||
|
||||
public enum IMECompositionMode { Auto, On, Off }
|
||||
public enum IMECompositionMode { Auto, On}
|
||||
|
||||
public partial class Input
|
||||
{
|
||||
@@ -195,7 +164,6 @@ namespace UnityEngine
|
||||
public partial class Resources
|
||||
{
|
||||
public static Object[] FindObjectsOfTypeAll(Type type) => Array.Empty<Object>();
|
||||
public static T[] FindObjectsOfTypeAll<T>() => Array.Empty<T>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +177,6 @@ namespace UnityEngine.Networking
|
||||
public static UnityWebRequest Get(string uri) => new UnityWebRequest();
|
||||
public UnityWebRequestAsyncOperation SendWebRequest() => new UnityWebRequestAsyncOperation();
|
||||
public void SetRequestHeader(string name, string value) { }
|
||||
public string GetResponseHeader(string name) => null;
|
||||
public Dictionary<string, string> GetResponseHeaders() => new Dictionary<string, string>();
|
||||
public bool isDone => true;
|
||||
public float downloadProgress => 1f;
|
||||
@@ -224,19 +191,11 @@ namespace UnityEngine.Networking
|
||||
public class UploadHandlerRaw : UploadHandler { public UploadHandlerRaw(byte[] data) { } }
|
||||
public class DownloadHandlerBuffer : DownloadHandler { }
|
||||
public class UnityWebRequestAsyncOperation : AsyncOperation { }
|
||||
public static class UnityWebRequestTexture { public static UnityWebRequest GetTexture(string uri) => new UnityWebRequest(); }
|
||||
public class DownloadHandlerTexture : DownloadHandler { public UnityEngine.Texture2D texture => null; public static UnityEngine.Texture2D GetContent(UnityWebRequest www) => null; }
|
||||
public class DownloadHandlerAssetBundle : DownloadHandler { public UnityEngine.AssetBundle assetBundle => null; public static UnityEngine.AssetBundle GetContent(UnityWebRequest www) => null; }
|
||||
}
|
||||
|
||||
namespace UnityEngine
|
||||
{
|
||||
// ---- additional off-battle-path Unity type stubs (CS0246 closure) ----
|
||||
public sealed class WaitForSecondsRealtime : YieldInstruction { public WaitForSecondsRealtime(float time) { } }
|
||||
public enum AnimationBlendMode { Blend, Additive }
|
||||
public class AnimationState { public string name { get; set; } public float speed { get; set; } public float time { get; set; } public float normalizedTime { get; set; } public float length => 0f; public float weight { get; set; } public bool enabled { get; set; } public WrapMode wrapMode { get; set; } public int layer { get; set; } public AnimationBlendMode blendMode { get; set; } public AnimationClip clip => null; }
|
||||
public class GUIContent { public GUIContent() { } public GUIContent(string text) { } public string text { get; set; } public Texture image { get; set; } }
|
||||
public class TextEditor { public GUIContent content { get; set; } public string text { get; set; } public void Copy() { } public void Paste() { } public void OnFocus() { } public void SelectAll() { } }
|
||||
public struct WebCamDevice { public string name => ""; public bool isFrontFacing => false; }
|
||||
public class Display { public int systemWidth => 0; public int systemHeight => 0; public int renderingWidth => 0; public int renderingHeight => 0; public static Display main => null; public static Display[] displays => Array.Empty<Display>(); }
|
||||
public class AnimationState { public string name { get; set; } public float speed { get; set; } public float time { get; set; } public float length => 0f; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user