From cb1d133a30705153b47fee848b1ba91733ee9019 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 29 Jun 2026 04:44:11 +0100 Subject: [PATCH] Treat RTS client state as managed documents --- Aetheria.State.Verify/Program.cs | 100 +++++++++--------- .../Tests/DaemonRuntimeDocumentTests.cs | 2 +- GameCult.Aetheria.State.Unity.csproj | 2 +- .../Runtime/AetheriaClientState.cs | 2 +- ...tion.cs => AetheriaRuntimeRtsDocuments.cs} | 78 +++++++------- ...ta => AetheriaRuntimeRtsDocuments.cs.meta} | 0 .../Runtime/AetheriaRuntimeVerseClient.cs | 76 ++++++------- 7 files changed, 130 insertions(+), 130 deletions(-) rename Packages/org.gamecult.aetheria.state/Runtime/{AetheriaRuntimeRtsProjection.cs => AetheriaRuntimeRtsDocuments.cs} (96%) rename Packages/org.gamecult.aetheria.state/Runtime/{AetheriaRuntimeRtsProjection.cs.meta => AetheriaRuntimeRtsDocuments.cs.meta} (100%) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 209e65a49..cd28d7619 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -52,7 +52,7 @@ RequireTradeItemDetailsUseEveSurface(root); RequireTradeItemValuesUseRuntimeQueries(root); RequireItemTierProjectionUsesRuntimeQueries(root); RequireInventoryDropdownUseEveSurface(root); -RequireStationRefitDockingBaysUseTypedProjection(root); +RequireStationRefitDockingBaysUseTypedDocuments(root); RequireNoDeadPopupShells(root); RequirePlayerSettingsEveSurface(root); RequireVerseHostSettingsAuthority(root); @@ -89,7 +89,7 @@ RequireLootPickupRequestAuthority(root); RequireEntityDestroyedRequestAuthority(root); RequireDroppedPickupCheckpointState(root); RequireTradePurchaseRequestAuthority(root); -RequireInventoryProjectionSlotIdentity(root); +RequireInventoryDocumentSlotIdentity(root); RequireInventoryValidationUsesManagedTypedDocuments(root); RequireMenuDockingUsesManagedTypedSnapshot(root); RequireUnitySharedDocumentAccessorErgonomics(root); @@ -1270,7 +1270,7 @@ static void RequireTypedBehaviorBodyKeys(string root) if (missingZoneSymbols.Length > 0) { throw new InvalidOperationException( - "Zone runtime body/orbit objects must own typed projection key surfaces: " + + "Zone runtime body/orbit objects must own typed document key surfaces: " + string.Join(", ", missingZoneSymbols)); } @@ -1315,10 +1315,10 @@ static void RequireTypedBehaviorBodyKeys(string root) static void RequireNoDeadRuntimeProjectionCaches(string root) { - var runtimeProjectionDirectory = Path.Combine(root, "Assets", "Scripts", "ServerShared", "RuntimeProjection"); - if (Directory.Exists(runtimeProjectionDirectory)) + var runtimeDocumentsFactoryDirectory = Path.Combine(root, "Assets", "Scripts", "ServerShared", "RuntimeProjection"); + if (Directory.Exists(runtimeDocumentsFactoryDirectory)) { - var survivors = Directory.EnumerateFileSystemEntries(runtimeProjectionDirectory) + var survivors = Directory.EnumerateFileSystemEntries(runtimeDocumentsFactoryDirectory) .Select(path => Path.GetRelativePath(root, path)) .ToArray(); throw new InvalidOperationException( @@ -4552,10 +4552,10 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root) "HideZoneDetailsSurface(", "AetheriaEveUnitySurfaceHost.RenderRuntime(", "AetheriaEveUnitySurfaceHost.Hide(_zoneDetailsSurfaceDocument)", - "AetheriaRuntimeZoneDetailsSurfaceBuilder.Build(ProjectZoneDetailsSurfaceState(", + "AetheriaRuntimeZoneDetailsSurfaceBuilder.Build(ProjectZoneDetailsSurfaceState(zoneIndex))", "AetheriaRuntimeZoneDetailsSurfaceBuilder.ProjectDaemonZone(", "AetheriaRuntimeZoneDetailsSurfaceBuilder.Project(", - "ProjectZoneDetailsSurfaceState(", + "ZoneDetailsSurfaceState(", "AetheriaUnityRuntimeClientProvider.ResolveClient(", ".State", ".Reactive()", @@ -6504,7 +6504,7 @@ static void RequireInventoryDropdownUseEveSurface(string root) } } -static void RequireStationRefitDockingBaysUseTypedProjection(string root) +static void RequireStationRefitDockingBaysUseTypedDocuments(string root) { var runtimeDocumentsPath = Path.Combine( root, @@ -6512,27 +6512,27 @@ static void RequireStationRefitDockingBaysUseTypedProjection(string root) "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeRtsViewportDocuments.cs"); - var runtimeProjectionPath = Path.Combine( + var runtimeDocumentsFactoryPath = Path.Combine( root, "Packages", "org.gamecult.aetheria.state", "Runtime", - "AetheriaRuntimeRtsProjection.cs"); + "AetheriaRuntimeRtsDocuments.cs"); var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs"); var inventoryMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryMenu.cs"); var runtimeDocuments = File.Exists(runtimeDocumentsPath) ? File.ReadAllText(runtimeDocumentsPath) - : throw new InvalidOperationException("Cannot verify station-refit docking-bay projection; runtime viewport documents are missing."); - var runtimeProjection = File.Exists(runtimeProjectionPath) - ? File.ReadAllText(runtimeProjectionPath) - : throw new InvalidOperationException("Cannot verify station-refit docking-bay projection; runtime projection source is missing."); + : throw new InvalidOperationException("Cannot verify station-refit docking-bay document; runtime viewport documents are missing."); + var runtimeDocumentsFactory = File.Exists(runtimeDocumentsFactoryPath) + ? File.ReadAllText(runtimeDocumentsFactoryPath) + : throw new InvalidOperationException("Cannot verify station-refit docking-bay document; runtime document factory is missing."); var inventoryPanel = File.Exists(inventoryPanelPath) ? File.ReadAllText(inventoryPanelPath) - : throw new InvalidOperationException("Cannot verify station-refit docking-bay projection; InventoryPanel.cs is missing."); + : throw new InvalidOperationException("Cannot verify station-refit docking-bay document; InventoryPanel.cs is missing."); var inventoryMenu = File.Exists(inventoryMenuPath) ? File.ReadAllText(inventoryMenuPath) - : throw new InvalidOperationException("Cannot verify station-refit docking-bay projection; InventoryMenu.cs is missing."); + : throw new InvalidOperationException("Cannot verify station-refit docking-bay document; InventoryMenu.cs is missing."); var requiredDocumentSymbols = new[] { @@ -6566,7 +6566,7 @@ static void RequireStationRefitDockingBaysUseTypedProjection(string root) string.Join(", ", missingDocumentSymbols)); } - var requiredProjectionSymbols = new[] + var requiredDocumentFactorySymbols = new[] { "var dockingBays = parent == null", "DockingBays = dockingBays", @@ -6599,22 +6599,22 @@ static void RequireStationRefitDockingBaysUseTypedProjection(string root) "CanAfford = price >= 0 && credits >= price", "OwnedQuantity = CountStationOwnedQuantity" }; - var missingProjectionSymbols = requiredProjectionSymbols - .Where(symbol => !runtimeProjection.Contains(symbol, StringComparison.Ordinal)) + var missingDocumentFactorySymbols = requiredDocumentFactorySymbols + .Where(symbol => !runtimeDocumentsFactory.Contains(symbol, StringComparison.Ordinal)) .ToArray(); - if (missingProjectionSymbols.Length > 0) + if (missingDocumentFactorySymbols.Length > 0) { throw new InvalidOperationException( - "StationRefitAsync docking-bay rows are no longer projected from daemon station state: " + - string.Join(", ", missingProjectionSymbols)); + "StationRefitAsync docking-bay rows are no longer derived from daemon station state: " + + string.Join(", ", missingDocumentFactorySymbols)); } - if (runtimeProjection.Contains("private static string BuildEntityKey(", StringComparison.Ordinal) || - runtimeProjection.Contains("private static bool TryParseEntityKey(", StringComparison.Ordinal)) + if (runtimeDocumentsFactory.Contains("private static string BuildEntityKey(", StringComparison.Ordinal) || + runtimeDocumentsFactory.Contains("private static bool TryParseEntityKey(", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Runtime projection reintroduced local entity key folklore; use AetheriaRuntimeRunCheckpointCommit entity key helpers."); + "Runtime document factory reintroduced local entity key folklore; use AetheriaRuntimeRunCheckpointCommit entity key helpers."); } var requiredPanelSymbols = new[] @@ -6963,14 +6963,14 @@ static void RequireDaemonHostDoesNotDrainRuntimeCommits(string root) } } -static void RequireInventoryProjectionSlotIdentity(string root) +static void RequireInventoryDocumentSlotIdentity(string root) { - var projectionPath = Path.Combine( + var documentsFactoryPath = Path.Combine( root, "Packages", "org.gamecult.aetheria.state", "Runtime", - "AetheriaRuntimeRtsProjection.cs"); + "AetheriaRuntimeRtsDocuments.cs"); var viewportDocumentsPath = Path.Combine( root, "Packages", @@ -6978,19 +6978,19 @@ static void RequireInventoryProjectionSlotIdentity(string root) "Runtime", "AetheriaRuntimeRtsViewportDocuments.cs"); - if (!File.Exists(projectionPath)) + if (!File.Exists(documentsFactoryPath)) { - throw new InvalidOperationException("Cannot verify inventory projection slot identity; AetheriaRuntimeRtsProjection.cs is missing."); + throw new InvalidOperationException("Cannot verify inventory document slot identity; AetheriaRuntimeRtsDocuments.cs is missing."); } if (!File.Exists(viewportDocumentsPath)) { - throw new InvalidOperationException("Cannot verify inventory projection slot identity; AetheriaRuntimeRtsViewportDocuments.cs is missing."); + throw new InvalidOperationException("Cannot verify inventory document slot identity; AetheriaRuntimeRtsViewportDocuments.cs is missing."); } - var projection = File.ReadAllText(projectionPath); + var documentsFactory = File.ReadAllText(documentsFactoryPath); var viewportDocuments = File.ReadAllText(viewportDocumentsPath); - var requiredProjectionSymbols = new[] + var requiredDocumentFactorySymbols = new[] { "AddSlot(items, \"equipment\", equipmentIndex, equipment[equipmentIndex])", "AddSlot(items, \"cargo\", cargoBayIndex, slot)", @@ -6998,15 +6998,15 @@ static void RequireInventoryProjectionSlotIdentity(string root) "X = slot.X", "Y = slot.Y" }; - var missingProjectionSymbols = requiredProjectionSymbols - .Where(symbol => !projection.Contains(symbol, StringComparison.Ordinal)) + var missingDocumentFactorySymbols = requiredDocumentFactorySymbols + .Where(symbol => !documentsFactory.Contains(symbol, StringComparison.Ordinal)) .ToArray(); - if (missingProjectionSymbols.Length > 0) + if (missingDocumentFactorySymbols.Length > 0) { throw new InvalidOperationException( - "Inventory projection no longer carries enough typed slot identity for cargo/equipment operations: " + - string.Join(", ", missingProjectionSymbols)); + "Inventory document no longer carries enough typed slot identity for cargo/equipment operations: " + + string.Join(", ", missingDocumentFactorySymbols)); } var requiredDocumentSymbols = new[] @@ -12021,7 +12021,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) "AetheriaRuntimeVerseClient reintroduced a projection-input helper instead of owning generic reactive typed documents directly."); } - if (client.Contains("ProjectStationRefitAsync", StringComparison.Ordinal) && + if (client.Contains("StationRefitAsync", StringComparison.Ordinal) && client.Contains("loadoutTemplatesDocument.LatestAsync()", StringComparison.Ordinal)) { throw new InvalidOperationException( @@ -12041,7 +12041,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root) client.Contains("Aetheria().Daemon.LatestFrame.LatestAsync()", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Aetheria runtime Verse client projected documents still bootstrap through one-shot latest-frame reads instead of the managed reactive client inputs."); + "Aetheria runtime Verse client managed documents still bootstrap through one-shot latest-frame reads instead of the managed reactive client inputs."); } if (client.Contains("_fallbackCatalog", StringComparison.Ordinal) || @@ -13277,7 +13277,7 @@ static void RequireMainMenuContinueRunState(string root) "_lastAppliedAuthoritativeDaemonRunId", "_lastAppliedAuthoritativeDaemonZoneIndex", "private bool TryRestoreEntityGraphFromZoneRender(", - "AetheriaRuntimeRtsProjection.ProjectZoneRender(observed.Frame)", + "AetheriaRuntimeRtsDocuments.ZoneRender(observed.Frame)", "AetheriaRuntimeEntitySnapshotProjector.CreateSnapshots(runId, daemonZone)", "ObservedEntityRestorer.TryApplyInPlace(", "ObservedEntityRestorer.Replace(entitySnapshots, currentEntityKey, Zone)", @@ -13628,14 +13628,14 @@ static void RequireMainMenuContinueRunState(string root) actionGameManager.Contains("AvailableCargoBays()", StringComparison.Ordinal)) { throw new InvalidOperationException( - "ActionGameManager must not expose renderer-local towing context or available cargo bay enumeration as public gameplay truth; clients must use typed projections and daemon operations."); + "ActionGameManager must not expose renderer-local towing context or available cargo bay enumeration as public gameplay truth; clients must use typed documents and daemon operations."); } if (actionGameManager.Contains("public int Credits", StringComparison.Ordinal) || actionGameManager.Contains("Credits = render.Credits", StringComparison.Ordinal)) { throw new InvalidOperationException( - "ActionGameManager must not mirror run credits as manager-global gameplay state; clients must read credits through typed projections such as StationRefitAsync."); + "ActionGameManager must not mirror run credits as manager-global gameplay state; clients must read credits through typed documents such as StationRefitAsync."); } if (actionGameManager.Contains("public static AetheriaRuntimeCatalogSnapshot RuntimeCatalog", StringComparison.Ordinal) || @@ -14222,7 +14222,7 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) "_lastAppliedAuthoritativeDaemonRunId", "_lastAppliedAuthoritativeDaemonZoneIndex", "private bool TryRestoreEntityGraphFromZoneRender(", - "AetheriaRuntimeRtsProjection.ProjectZoneRender(observed.Frame)", + "AetheriaRuntimeRtsDocuments.ZoneRender(observed.Frame)", "AetheriaRuntimeEntitySnapshotProjector.CreateSnapshots(runId, daemonZone)", "ObservedEntityRestorer.Replace(entitySnapshots, currentEntityKey, Zone)", "ObservedEntityRestorer.TryApplyInPlace(", @@ -14426,7 +14426,7 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) if (observedReadShimHits.Length > 0) { throw new InvalidOperationException( - "ActionGameManager must not expose broad observed galaxy/zone read shims; clients read typed projections through AetheriaClient: " + + "ActionGameManager must not expose broad observed galaxy/zone read shims; clients read typed documents through AetheriaClient: " + string.Join(", ", observedReadShimHits)); } @@ -16444,7 +16444,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) "ReactiveObservedDaemon(", "TryCurrent(out AetheriaRuntimeDaemonRenderView? observed)", "return new AetheriaRuntimeDaemonRenderView(frame, soaView);", - "AetheriaRuntimeRtsProjection.ProjectZoneRender(Frame)", + "AetheriaRuntimeRtsDocuments.ZoneRender(Frame)", "zoneRender = null" }; var observedDaemonStateBypassHits = forbiddenObservedDaemonStateSymbols @@ -17478,7 +17478,7 @@ static void RequireInventoryDoubleClickTransferRequestAuthority(string root) if (missingTypedSlotValidationSymbols.Length > 0) { throw new InvalidOperationException( - "Inventory cargo/equipment submissions must validate Unity facade adapters against typed inventory projection slot identity: " + + "Inventory cargo/equipment submissions must validate Unity facade adapters against typed inventory document slot identity: " + string.Join(", ", missingTypedSlotValidationSymbols)); } @@ -18184,7 +18184,7 @@ static void RequireInventoryLoadoutRestoreRequestAuthority(string root) var rtsDocuments = File.Exists(rtsDocumentsPath) ? File.ReadAllText(rtsDocumentsPath) : throw new InvalidOperationException("Cannot verify loadout restore authority; RTS viewport documents are missing."); - var rtsProjectionPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeRtsProjection.cs"); + var rtsProjectionPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeRtsDocuments.cs"); var rtsProjection = File.Exists(rtsProjectionPath) ? File.ReadAllText(rtsProjectionPath) : throw new InvalidOperationException("Cannot verify loadout restore authority; RTS projection source is missing."); @@ -18348,7 +18348,7 @@ static void RequireInventoryLoadoutRestoreRequestAuthority(string root) !rtsProjection.Contains("credits >= price", StringComparison.Ordinal) || !clientState.Contains("public CultMeshDocumentHandle LoadoutTemplates", StringComparison.Ordinal) || !verseClient.Contains("RequireManagedLoadoutTemplates().Templates", StringComparison.Ordinal) || - !verseClient.Contains("ProjectStationRefit(", StringComparison.Ordinal)) + !verseClient.Contains("StationRefit(", StringComparison.Ordinal)) { throw new InvalidOperationException( "StationRefitAsync must publish typed loadout restore options with shared runtime pricing and daemon-target identity."); diff --git a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs index 4476bff8e..56e67c971 100644 --- a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs +++ b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs @@ -141,7 +141,7 @@ public class DaemonRuntimeDocumentTests } [Test] - public void AetheriaClientStateReadsProjectedDocumentsThroughCultMesh() + public void AetheriaClientStateReadsManagedDocumentsThroughCultMesh() { var statePath = Path.Combine( Path.GetTempPath(), diff --git a/GameCult.Aetheria.State.Unity.csproj b/GameCult.Aetheria.State.Unity.csproj index 5af10d810..436af6ebf 100644 --- a/GameCult.Aetheria.State.Unity.csproj +++ b/GameCult.Aetheria.State.Unity.csproj @@ -99,12 +99,12 @@ + - diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs index 1f4a54676..39aed43a0 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClientState.cs @@ -210,7 +210,7 @@ namespace GameCult.Aetheria.State.Verse return document; throw new NotSupportedException( - $"Aetheria typed state does not expose a projected document for {typeof(TDocument).FullName}."); + $"Aetheria typed state does not expose a managed document for {typeof(TDocument).FullName}."); } public CultMeshReactiveDocument Reactive() diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsProjection.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsDocuments.cs similarity index 96% rename from Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsProjection.cs rename to Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsDocuments.cs index 6af6fc647..7fda43964 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsProjection.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsDocuments.cs @@ -6,16 +6,16 @@ using System.Linq; namespace GameCult.Aetheria.State.Verse { - public static class AetheriaRuntimeRtsProjection + public static class AetheriaRuntimeRtsDocuments { private const double ZoneRenderWormholeDistanceRatio = 1.0; - public static AetheriaRuntimeRtsViewportDocument ProjectViewport( + public static AetheriaRuntimeRtsViewportDocument Viewport( AetheriaRuntimeDaemonFrameDocument frame, AetheriaRuntimeRtsViewportBounds viewport) { - var objects = ProjectObjectsViewport(frame, viewport); - var gravity = ProjectGravityViewport(frame, viewport); + var objects = ObjectsViewport(frame, viewport); + var gravity = GravityViewport(frame, viewport); return new AetheriaRuntimeRtsViewportDocument { @@ -34,7 +34,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeObjectsViewportDocument ProjectObjectsViewport( + public static AetheriaRuntimeObjectsViewportDocument ObjectsViewport( AetheriaRuntimeDaemonFrameDocument frame, AetheriaRuntimeRtsViewportBounds viewport) { @@ -75,7 +75,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeGravityViewportDocument ProjectGravityViewport( + public static AetheriaRuntimeGravityViewportDocument GravityViewport( AetheriaRuntimeDaemonFrameDocument frame, AetheriaRuntimeRtsViewportBounds viewport) { @@ -107,7 +107,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeRenderSplatsViewportDocument ProjectRenderSplatsViewport( + public static AetheriaRuntimeRenderSplatsViewportDocument RenderSplatsViewport( AetheriaRuntimeDaemonFrameDocument frame, AetheriaRuntimeRtsViewportBounds viewport) { @@ -374,7 +374,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeCurrentZoneDocument ProjectCurrentZone( + public static AetheriaRuntimeCurrentZoneDocument CurrentZone( AetheriaRuntimeDaemonFrameDocument frame) { frame ??= new AetheriaRuntimeDaemonFrameDocument(); @@ -397,7 +397,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeCurrentEntityDocument ProjectCurrentEntity( + public static AetheriaRuntimeCurrentEntityDocument CurrentEntity( AetheriaRuntimeDaemonFrameDocument frame) { frame ??= new AetheriaRuntimeDaemonFrameDocument(); @@ -434,11 +434,11 @@ namespace GameCult.Aetheria.State.Verse Equipment = inventory.Where(item => string.Equals(item.Source, "equipment", StringComparison.Ordinal)).ToArray(), Cargo = inventory.Where(item => string.Equals(item.Source, "cargo", StringComparison.Ordinal)).ToArray(), ShutdownPerformance = entity?.ShutdownPerformance ?? 0, - Hud = ProjectCurrentEntityHudStatus(entity) + Hud = CurrentEntityHudStatus(entity) }; } - public static AetheriaRuntimeCurrentDockingDocument ProjectCurrentDocking( + public static AetheriaRuntimeCurrentDockingDocument CurrentDocking( AetheriaRuntimeDaemonFrameDocument frame) { frame ??= new AetheriaRuntimeDaemonFrameDocument(); @@ -469,7 +469,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeZoneContactsDocument ProjectZoneContacts( + public static AetheriaRuntimeZoneContactsDocument ZoneContacts( AetheriaRuntimeDaemonFrameDocument frame) { frame ??= new AetheriaRuntimeDaemonFrameDocument(); @@ -504,7 +504,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeStationRefitDocument ProjectStationRefit( + public static AetheriaRuntimeStationRefitDocument StationRefit( AetheriaRuntimeDaemonFrameDocument frame, IReadOnlyList? loadoutTemplates = null, AetheriaRuntimeCatalogSnapshot? catalog = null) @@ -521,7 +521,7 @@ namespace GameCult.Aetheria.State.Verse : AetheriaRuntimeRunCheckpointCommit.EntityRecordKey(context.RunId, context.Zone.ZoneIndex, parent.EntityIndex); var availableEntities = parent == null ? Array.Empty() - : ProjectStationRefitEntities(context, parent, currentEntityIndex); + : StationRefitEntities(context, parent, currentEntityIndex); var stationStock = parent == null ? Array.Empty() : ProjectStationStock(parent); @@ -609,7 +609,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeSectorMapDocument ProjectSectorMap( + public static AetheriaRuntimeSectorMapDocument SectorMap( AetheriaRuntimeDaemonFrameDocument frame) { frame ??= new AetheriaRuntimeDaemonFrameDocument(); @@ -639,11 +639,11 @@ namespace GameCult.Aetheria.State.Verse .OrderBy(zone => zone.ZoneIndex) .Select(zone => ToSectorMapZone(zone, run, discovered)) .ToArray(), - Links = ProjectSectorMapLinks(zones, discovered) + Links = SectorMapLinks(zones, discovered) }; } - public static AetheriaRuntimeZoneDetailsDocument ProjectZoneDetails( + public static AetheriaRuntimeZoneDetailsDocument ZoneDetails( AetheriaRuntimeDaemonFrameDocument frame, int zoneIndex) { @@ -690,7 +690,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeZoneRenderDocument ProjectZoneRender( + public static AetheriaRuntimeZoneRenderDocument ZoneRender( AetheriaRuntimeDaemonFrameDocument frame) { frame ??= new AetheriaRuntimeDaemonFrameDocument(); @@ -710,10 +710,10 @@ namespace GameCult.Aetheria.State.Verse CurrentEntityKey = run.CurrentEntityKey ?? "", ZoneRenderRadius = zoneRenderRadius, Credits = run.Credits, - AdjacentZones = ProjectZoneRenderAdjacentZones(run, zone), - WormholeExits = ProjectZoneRenderWormholeExits(run, zone, zoneRenderRadius), - BodyPoses = ProjectZoneRenderBodyPoses(zone), - AsteroidBeltPoses = ProjectZoneRenderAsteroidBeltPoses(zone, frame.SimulationTimeSeconds), + AdjacentZones = ZoneRenderAdjacentZones(run, zone), + WormholeExits = ZoneRenderWormholeExits(run, zone, zoneRenderRadius), + BodyPoses = ZoneRenderBodyPoses(zone), + AsteroidBeltPoses = ZoneRenderAsteroidBeltPoses(zone, frame.SimulationTimeSeconds), DroppedPickups = (zone.DroppedPickups ?? Array.Empty()) .Where(pickup => pickup != null) .OrderBy(pickup => pickup.PickupIndex) @@ -731,7 +731,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeSelectedObjectDocument ProjectSelectedObject( + public static AetheriaRuntimeSelectedObjectDocument SelectedObject( AetheriaRuntimeDaemonFrameDocument frame, int entityIndex) { @@ -750,7 +750,7 @@ namespace GameCult.Aetheria.State.Verse }; } - public static AetheriaRuntimeInventoryDocument ProjectInventory( + public static AetheriaRuntimeInventoryDocument Inventory( AetheriaRuntimeDaemonFrameDocument frame, int entityIndex) { @@ -905,7 +905,7 @@ namespace GameCult.Aetheria.State.Verse }; } - private static IReadOnlyList ProjectSectorMapLinks( + private static IReadOnlyList SectorMapLinks( IReadOnlyList zones, HashSet discovered) { @@ -930,7 +930,7 @@ namespace GameCult.Aetheria.State.Verse return links.ToArray(); } - private static AetheriaRuntimeZoneRenderAdjacentZone[] ProjectZoneRenderAdjacentZones( + private static AetheriaRuntimeZoneRenderAdjacentZone[] ZoneRenderAdjacentZones( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeZoneSnapshotCommit zone) { @@ -950,7 +950,7 @@ namespace GameCult.Aetheria.State.Verse .ToArray(); } - private static AetheriaRuntimeZoneRenderWormholeExit[] ProjectZoneRenderWormholeExits( + private static AetheriaRuntimeZoneRenderWormholeExit[] ZoneRenderWormholeExits( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeZoneSnapshotCommit zone, double zoneRenderRadius) @@ -968,7 +968,7 @@ namespace GameCult.Aetheria.State.Verse .ToArray(); } - private static AetheriaRuntimeZoneRenderBodyPose[] ProjectZoneRenderBodyPoses( + private static AetheriaRuntimeZoneRenderBodyPose[] ZoneRenderBodyPoses( AetheriaRuntimeZoneSnapshotCommit zone) { return AetheriaRuntimeDaemonRenderQueries.QueryBodyPoses(zone) @@ -987,7 +987,7 @@ namespace GameCult.Aetheria.State.Verse .ToArray(); } - private static AetheriaRuntimeZoneRenderAsteroidBeltPose[] ProjectZoneRenderAsteroidBeltPoses( + private static AetheriaRuntimeZoneRenderAsteroidBeltPose[] ZoneRenderAsteroidBeltPoses( AetheriaRuntimeZoneSnapshotCommit zone, double simulationTimeSeconds) { @@ -1000,7 +1000,7 @@ namespace GameCult.Aetheria.State.Verse CenterZ = pose.CenterZ, Radius = pose.Radius, AsteroidCount = pose.AsteroidCount, - InstancePoses = ProjectZoneRenderAsteroidInstancePoses( + InstancePoses = ZoneRenderAsteroidInstancePoses( zone, pose.BodyKey, simulationTimeSeconds) @@ -1008,7 +1008,7 @@ namespace GameCult.Aetheria.State.Verse .ToArray(); } - private static AetheriaRuntimeZoneRenderAsteroidInstancePose[] ProjectZoneRenderAsteroidInstancePoses( + private static AetheriaRuntimeZoneRenderAsteroidInstancePose[] ZoneRenderAsteroidInstancePoses( AetheriaRuntimeZoneSnapshotCommit zone, string bodyKey, double simulationTimeSeconds) @@ -1045,8 +1045,8 @@ namespace GameCult.Aetheria.State.Verse return items.Where(item => !string.IsNullOrWhiteSpace(item.ItemKey)).ToArray(); } - private static IReadOnlyList ProjectStationRefitEntities( - ProjectionContext context, + private static IReadOnlyList StationRefitEntities( + DocumentContext context, AetheriaRuntimeEntitySnapshotCommit dockParent, int currentEntityIndex) { @@ -1122,7 +1122,7 @@ namespace GameCult.Aetheria.State.Verse } private static IReadOnlyList ProjectStationDockingBays( - ProjectionContext context, + DocumentContext context, AetheriaRuntimeEntitySnapshotCommit dockParent, int currentEntityIndex) { @@ -1501,7 +1501,7 @@ namespace GameCult.Aetheria.State.Verse } } - private static ProjectionContext Context(AetheriaRuntimeDaemonFrameDocument frame) + private static DocumentContext Context(AetheriaRuntimeDaemonFrameDocument frame) { var run = frame.Run ?? new AetheriaRuntimeRunCheckpointCommit(); var zones = run.Zones ?? Array.Empty(); @@ -1509,7 +1509,7 @@ namespace GameCult.Aetheria.State.Verse zones.FirstOrDefault() ?? new AetheriaRuntimeZoneSnapshotCommit(); var runId = string.IsNullOrWhiteSpace(run.RunId) ? "local-rts" : run.RunId; - return new ProjectionContext(run, zone, runId); + return new DocumentContext(run, zone, runId); } private static double Stat(AetheriaRuntimeEntitySnapshotCommit entity, string name) @@ -1519,7 +1519,7 @@ namespace GameCult.Aetheria.State.Verse return grid?.Values?.FirstOrDefault() ?? 0; } - private static AetheriaRuntimeCurrentEntityHudStatus ProjectCurrentEntityHudStatus( + private static AetheriaRuntimeCurrentEntityHudStatus CurrentEntityHudStatus( AetheriaRuntimeEntitySnapshotCommit? entity) { if (entity == null) @@ -1604,9 +1604,9 @@ namespace GameCult.Aetheria.State.Verse return int.TryParse(text, out var value) ? value : -1; } - private readonly struct ProjectionContext + private readonly struct DocumentContext { - public ProjectionContext( + public DocumentContext( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeZoneSnapshotCommit zone, string runId) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsProjection.cs.meta b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsDocuments.cs.meta similarity index 100% rename from Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsProjection.cs.meta rename to Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsDocuments.cs.meta diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs index 22ecb9111..fbfd07176 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs @@ -427,67 +427,67 @@ namespace GameCult.Aetheria.State.Verse () => Task.FromResult(BootstrapVerseHostSettingsDocument()), AetheriaRuntimeVerseHostSettingsDocument.SchemaId, CatalogBootstrapSource("catalog:aetheria.verse_host_settings")), - ProjectedDocument( + ManagedFrameDocument( "aetheria.current.zone", - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectCurrentZone(frame)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.CurrentZone(frame)), AetheriaRuntimeDaemonSchemas.CurrentZone), - ProjectedDocument( + ManagedFrameDocument( "aetheria.current.entity", - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectCurrentEntity(frame)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.CurrentEntity(frame)), AetheriaRuntimeDaemonSchemas.CurrentEntity), - ProjectedDocument( + ManagedFrameDocument( "aetheria.current.docking", - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectCurrentDocking(frame)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.CurrentDocking(frame)), AetheriaRuntimeDaemonSchemas.CurrentDocking), - ProjectedDocument( + ManagedFrameDocument( "aetheria.zone.contacts", - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectZoneContacts(frame)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.ZoneContacts(frame)), AetheriaRuntimeDaemonSchemas.ZoneContacts), - ProjectedDocument( + ManagedFrameDocument( "aetheria.station.refit", - ProjectStationRefitAsync, + StationRefitAsync, AetheriaRuntimeDaemonSchemas.StationRefit, CultMesh.ProjectionSource("catalog:aetheria.runtime"), CultMesh.ProjectionSource("loadout-templates:aetheria.runtime")), - ProjectedDocument( + ManagedFrameDocument( "aetheria.sector.map", - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectSectorMap(frame)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.SectorMap(frame)), AetheriaRuntimeDaemonSchemas.SectorMap), - ProjectedDocument( + ManagedFrameDocument( "aetheria.zone.render", - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectZoneRender(frame)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.ZoneRender(frame)), AetheriaRuntimeDaemonSchemas.ZoneRender), - viewport => ProjectedDocument( + viewport => ManagedFrameDocument( ViewportDocumentId("aetheria.viewport.map", viewport), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectViewport(frame, viewport)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.Viewport(frame, viewport)), AetheriaRuntimeDaemonSchemas.RtsViewport), - viewport => ProjectedDocument( + viewport => ManagedFrameDocument( ViewportDocumentId("aetheria.viewport.objects", viewport), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectObjectsViewport(frame, viewport)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.ObjectsViewport(frame, viewport)), AetheriaRuntimeDaemonSchemas.ObjectsViewport), - viewport => ProjectedDocument( + viewport => ManagedFrameDocument( ViewportDocumentId("aetheria.viewport.gravity", viewport), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectGravityViewport(frame, viewport)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.GravityViewport(frame, viewport)), AetheriaRuntimeDaemonSchemas.GravityViewport), - viewport => ProjectedDocument( + viewport => ManagedFrameDocument( ViewportDocumentId("aetheria.viewport.render_splats", viewport), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectRenderSplatsViewport(frame, viewport)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.RenderSplatsViewport(frame, viewport)), AetheriaRuntimeDaemonSchemas.RenderSplatsViewport), - zoneIndex => ProjectedDocument( + zoneIndex => ManagedFrameDocument( IndexedDocumentId("aetheria.zone.details", zoneIndex), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectZoneDetails(frame, zoneIndex)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.ZoneDetails(frame, zoneIndex)), AetheriaRuntimeDaemonSchemas.ZoneDetails), - entityIndex => ProjectedDocument( + entityIndex => ManagedFrameDocument( IndexedDocumentId("aetheria.object.selected", entityIndex), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectSelectedObject(frame, entityIndex)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.SelectedObject(frame, entityIndex)), AetheriaRuntimeDaemonSchemas.SelectedObject), - entityIndex => ProjectedDocument( + entityIndex => ManagedFrameDocument( IndexedDocumentId("aetheria.inventory", entityIndex), - frame => Task.FromResult(AetheriaRuntimeRtsProjection.ProjectInventory(frame, entityIndex)), + frame => Task.FromResult(AetheriaRuntimeRtsDocuments.Inventory(frame, entityIndex)), AetheriaRuntimeDaemonSchemas.Inventory), starbridgeScenarioDocument, starbridgeSessionDocument, - ProjectedDocument( + ManagedFrameDocument( "aetheria.starbridge.summary", ProjectStarbridgeSummaryAsync, AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary, @@ -509,9 +509,9 @@ namespace GameCult.Aetheria.State.Verse _managedStarbridgeSession = managedStarbridgeSession; return state; - CultMeshDocumentHandle ProjectedDocument( + CultMeshDocumentHandle ManagedFrameDocument( string documentId, - Func> project, + Func> derive, string schemaId, params CultMeshProjectionSource[] additionalSources) where TDocument : class @@ -524,19 +524,19 @@ namespace GameCult.Aetheria.State.Verse "latest authoritative daemon frame") } .Concat(additionalSources ?? Array.Empty()) - .Append(CultMesh.ProjectionSource(documentId, schemaId, "projected Aetheria client document")) + .Append(CultMesh.ProjectionSource(documentId, schemaId, "managed Aetheria client document")) .ToArray(); var verse = CultMesh.Verse("aetheria.local", RuntimeId); return CultMesh.Document( documentId, verse, - async _ => await project(RequireManagedFrame()).ConfigureAwait(false), + async _ => await derive(RequireManagedFrame()).ConfigureAwait(false), _ => frameChanges .SelectAwait(async (frame, cancellationToken) => - await project(frame).ConfigureAwait(false)), + await derive(frame).ConfigureAwait(false)), sources: sources, - routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria typed projected state")); + routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria managed typed state")); } AetheriaRuntimeDaemonFrameDocument RequireManagedFrame() @@ -580,10 +580,10 @@ namespace GameCult.Aetheria.State.Verse routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria managed catalog state")); } - Task ProjectStationRefitAsync( + Task StationRefitAsync( AetheriaRuntimeDaemonFrameDocument frame) { - return Task.FromResult(AetheriaRuntimeRtsProjection.ProjectStationRefit( + return Task.FromResult(AetheriaRuntimeRtsDocuments.StationRefit( frame, RequireManagedLoadoutTemplates().Templates, RequireManagedCatalog())); @@ -606,7 +606,7 @@ namespace GameCult.Aetheria.State.Verse static string ViewportDocumentId(string prefix, AetheriaRuntimeRtsViewportBounds viewport) { - var normalized = AetheriaRuntimeRtsProjection.Normalize(viewport); + var normalized = AetheriaRuntimeRtsDocuments.Normalize(viewport); return string.Join( ".", prefix,