From cb9c5ca21f6b5a48e5f9ce52d42f80ebbad34835 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 16:46:14 +0100 Subject: [PATCH] Persist entity visibility state in typed snapshots --- .voidbot/state/aetheria.cc | Bin 86426 -> 86102 bytes Aetheria.State.Smoke/Program.cs | 4 ++++ Aetheria.State.Unity.Smoke/Program.cs | 6 ++++++ .../AetheriaRuntimeCommitLogApplier.cs | 4 +++- .../AetheriaRuntimeStateDocuments.cs | 6 ++++++ Assets/Scripts/Gameplay/ActionGameManager.cs | 2 ++ .../Runtime/AetheriaRuntimeCatalogSnapshot.cs | 8 +++++++- .../Runtime/AetheriaRuntimeCatalogStore.cs | 8 ++++++-- .../AetheriaRuntimeStateCommitDocument.cs | 6 ++++++ docs/aetheria-perfect-machine-map.md | 6 +++++- 10 files changed, 45 insertions(+), 5 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 1923686dee4c6f44ce3cbcf5bfa29b075703d6ba..955bd9ee62b7b097b4f10d6590b6ce463f3a0327 100644 GIT binary patch delta 1090 zcmaKr%WD)t5XR}4h{;VbiUzb0FM;glwQ&<&WjE_4o_t2d_0&6E*=f@|J#_bMSUrT0 zqbJRwK@<(52QP{sIf)2*6BGo&li*)s&+H>ZA|B_P>Z)JWSM~VCz|ZFcZ(sEdWCdz^S6Me;_8>9W(qy1zyf9MoNH6BVta-I^hnZdb1;c^5smK6|DF@zU%WTDF|*OfvAc)tx;~6^Pfx zzAKUqGGR}b$nl{a!>ulnS|(TSZPK3CR4MMZCH3UsJTc^={aql3?UQ*jm`b<(ex5L5 zpOs0@1{cWJkvHvpnJ&%iRGvE(Qtlk?^h9#p_Ctky>`If(wSCx$hMcphLftp-2+{PhpU6#n}gjbKOVgtLPt)9 zT2t#uVYTF(>a4NE(nuXe51KPeZnKzfVkVengtMpA$And}E5<_BaX<{V4F&7VG$1u5 zH8z4M6G)4-tef0xkHd-Y-wMg5g`Th2;b?)mtI(< zBHEZl`3s+yTvr}ZHq>-TQ{pcZZv{#j=h&CjK>rq3DG|}aHPqi^Ccas5YU$NI&{$K@ z+E^U|S7=2o-5_9MfYyjbf2hf^U3H)IK$|$12y5oTU4}cfi z*5i#6%^yp^-0sy{X;y<%&doCMzz#5y@VLze27+MLj<2bmir65B<5Vyaf~pM+An;uQ zHpWU#I~hO{%4|jWNkL3E{)+p^O2Hdxze9!^6Kmo^m2s-V-Nbh%AurG#B$Q+D0V0bH z0VNb^a7p~!TaY7=dXbh*E4qCe&0o5-2uf>zpLn$cn#Q0;HL1|nJ2}{zt@pL&w$Iz(OBMSeGJXd&Mj#92y(m+xpr0)FP!C_&njgdhc|v& z(bf&LdcAZ9o+dcqG7YhG3APYztr@hj=Z$rW5Uot1<;h|(eFzlHh3nc?f8X*!7e>FP zkVSKmETDm7yU{kE7m$x&_xDYd8Nj4$sfNf}O@v_pg{Nm`fVygcS~faYL|@LnZ$l^j zeoRcyLbi7XRn$L?itPz^dCX0?s4 entity.Children.IndexOf(bay.DockedShip)) .ToArray() ?? Array.Empty(), + Visibility = entity.Visibility, + VisibilitySourceCount = entity.VisibilitySources.Count, ChildEntityIndices = entity.Children? .Select(child => zone.Entities.IndexOf(child)) .Where(index => index >= 0) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs index f20145783..2a2bc4d48 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs @@ -786,7 +786,9 @@ namespace GameCult.Aetheria.State.Unity IReadOnlyList behaviorStates, IReadOnlyList cargoContents, IReadOnlyList dockingBayContents, - IReadOnlyList dockingBayAssignments) + IReadOnlyList dockingBayAssignments, + double visibility, + int visibilitySourceCount) { Name = name; Kind = kind; @@ -819,6 +821,8 @@ namespace GameCult.Aetheria.State.Unity CargoContents = cargoContents; DockingBayContents = dockingBayContents; DockingBayAssignments = dockingBayAssignments; + Visibility = visibility; + VisibilitySourceCount = visibilitySourceCount; } public string Name { get; } @@ -852,6 +856,8 @@ namespace GameCult.Aetheria.State.Unity public IReadOnlyList CargoContents { get; } public IReadOnlyList DockingBayContents { get; } public IReadOnlyList DockingBayAssignments { get; } + public double Visibility { get; } + public int VisibilitySourceCount { get; } } public sealed class AetheriaRuntimeActionBarBindingSnapshot diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 96631cb02..9a0f75fd7 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -535,7 +535,9 @@ namespace GameCult.Aetheria.State.Unity var cargoContents = ReadFieldCargoBayLoadouts(ref reader, fields, 24); var dockingBayContents = ReadFieldCargoBayLoadouts(ref reader, fields, 25); var dockingBayAssignments = ReadFieldInt32Array(ref reader, fields, 26); - SkipRemaining(ref reader, fields, 27); + var visibility = ReadFieldDouble(ref reader, fields, 27); + var visibilitySourceCount = ReadFieldInt32(ref reader, fields, 28); + SkipRemaining(ref reader, fields, 29); return new AetheriaRuntimeEntitySnapshot( name, kind, @@ -567,7 +569,9 @@ namespace GameCult.Aetheria.State.Unity behaviorStates, cargoContents, dockingBayContents, - dockingBayAssignments); + dockingBayAssignments, + visibility, + visibilitySourceCount); } private static Vector2Value ReadFieldVector2(ref MessagePackReader reader, int fields, int index) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs index 39a638a52..02d93c112 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs @@ -579,6 +579,12 @@ namespace GameCult.Aetheria.State.Unity [Key(31)] public IReadOnlyList DockingBayAssignments { get; set; } = Array.Empty(); + + [Key(32)] + public double Visibility { get; set; } + + [Key(33)] + public int VisibilitySourceCount { get; set; } } [MessagePackObject] diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 6c5ee6933..05abfcc92 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -152,7 +152,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. temperature, thermal mass, armor, max armor, and hull-conductivity axes. They also carry public runtime session state: velocity, target entity reference, active flag, heatsink toggle, shutdown override, tractor power, - heatstroke/hypothermia accumulators, and active consumable item/timer rows. + heatstroke/hypothermia accumulators, aggregate visibility/source-count state, + and active consumable item/timer rows. Entity equipment, cargo-bay, and docking-bay slot rows preserve item-instance facts needed for restore: item key, quality, durability, and quantity. Those facts are no longer discarded when pending checkpoint commands become @@ -846,6 +847,9 @@ First Aetheria surfaces to publish: quantity now survive canonical state and Unity package readback. - Done: preserve cargo bay contents, docking bay contents, and docking bay child assignments in typed entity snapshots. + - Done: preserve aggregate entity visibility and visibility-source count in + typed entity snapshots, so `Entity.VisibilitySources` no longer hides + untyped session pressure. - Remaining: add typed documents/mappers for runtime object graphs, typed behavior factory construction, remaining behavior-private state not covered by progress, weapon, sensor, radiator, reactor, or capacitor rows,