From 3ac9058ce86394bb2b17741953b8968352bd7868 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 17 Jul 2026 07:28:53 +0100 Subject: [PATCH] Interrupt compressed time at decision events --- Aetheria.State.Daemon.Smoke/Program.cs | 91 +++++++++++++ Aetheria.State.Daemon/Program.cs | 36 ++++- Aetheria.State/AetheriaEveSurfaceDocuments.cs | 1 + .../Documents/AetheriaGameSessionState.cs | 1 + .../Runtime/AetheriaRuntimeDaemonDocuments.cs | 15 +++ ...AetheriaRuntimeDaemonGameSurfaceBuilder.cs | 7 + .../AetheriaRuntimeDaemonTickRunner.cs | 124 ++++++++++++++++-- docs/aetheria-perfect-machine-map.md | 24 ++++ docs/original-game-migration-matrix.md | 2 +- docs/renderless-aetheria-architecture.md | 19 +-- 10 files changed, 301 insertions(+), 19 deletions(-) diff --git a/Aetheria.State.Daemon.Smoke/Program.cs b/Aetheria.State.Daemon.Smoke/Program.cs index 0a8a434f8..9b2e16d5b 100644 --- a/Aetheria.State.Daemon.Smoke/Program.cs +++ b/Aetheria.State.Daemon.Smoke/Program.cs @@ -154,6 +154,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks PositiveGravityDepthAttractsAndProjectsAsAWell, VolumeSurfaceKeepsNativeShaderAbiInAssetVariant, YmirMovesProjectileAndReportsStableContact, + CompressedTerminusStopsAtAttentionBoundary, InstantWeaponRequestSurvivesLockAcquisition, GuidedWeaponPublishesPresentationProfileWithoutPhysicalAuthority, CombatLockSurvivesPublicFrameRestart, @@ -237,6 +238,96 @@ internal sealed class AetheriaDaemonYmirSmokeChecks RunCheck(check); } + private static void CompressedTerminusStopsAtAttentionBoundary() + { + var source = Entity(0, -100, "player"); + var target = Entity(1, 0, "raider"); + var run = new AetheriaRuntimeRunCheckpointCommit + { + RunId = "terminus-attention-smoke", + CurrentZoneIndex = 0, + CurrentEntityKey = "zone.0.entity.0", + Zones = [new AetheriaRuntimeZoneSnapshotCommit + { + ZoneIndex = 0, + Entities = [source, target], + PhysicalPayloads = [new AetheriaRuntimePhysicalPayloadCommit + { + PayloadId = "attention-mine", + PayloadKind = "mine", + WeaponItemKey = "attention-charge", + SourceEntityIndex = source.EntityIndex, + PositionX = target.PositionX, + PositionZ = target.PositionZ, + LifetimeSeconds = 30, + BlastRadius = 200, + PayloadMagnitude = 10, + DamageType = "Kinetic", + TriggeredAtSeconds = 0, + DetonationDelaySeconds = 0, + Stationary = true, + Active = true + }] + }] + }; + + var tick = AetheriaRuntimeDaemonTickRunner.Tick( + Path.Combine(Path.GetTempPath(), "aetheria-terminus-attention-smoke.cc"), + run, + new AetheriaRuntimeDaemonTickOptions + { + FrameId = 7, + SimulationTimeSeconds = 0.4, + FixedDeltaSeconds = 0.1, + AdvanceSimulation = true, + SimulationStepCount = 4, + StopCompressedSimulationOnAttention = true, + WorldPhysics = NewPhysics(), + BuildPublications = false + }); + + RequireEqual(1, tick.SimulationStepsExecuted, + "compressed Terminus must stop on the internal step that produces a decision event"); + RequireNear(0.1, tick.Frame.SimulationTimeSeconds, 0.000001, + "authoritative frame time must stop at the attention boundary instead of claiming the requested batch horizon"); + Require(tick.AttentionInterruption != null && + tick.AttentionInterruption.CauseKind == "entity.damaged" && + Math.Abs(tick.AttentionInterruption.SimulationTimeSeconds - 0.1) < 0.000001, + "tick result must retain the exact event and simulation time that interrupted compression"); + RequireNear(90, Stat(target, "hull"), 0.000001, + "the causal damage step must commit before compressed simulation pauses"); + var interruption = run.GameEvents.Single(value => value.Kind == "simulation.interrupted"); + Require(interruption.Reason == "entity.damaged" && interruption.ScalarValue == 4 && + interruption.AuxiliaryValue == 1, + "daemon must publish requested versus executed steps with the attention cause"); + tick.Frame.GameMode = "terminus"; + tick.Frame.RequestedSimulationRate = 4; + tick.Frame.EffectiveSimulationRate = 0; + tick.Frame.SimulationStepsExecuted = tick.SimulationStepsExecuted; + tick.Frame.AttentionCauseKind = tick.AttentionInterruption?.CauseKind ?? ""; + var surface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build( + tick.Frame, + new AetheriaRuntimeDaemonHealthDocument(), + AetheriaRuntimeDaemonCommandBoundaryDocument.Create("daemon")); + Require(Flatten(surface.Surface.Root).Any(node => node.Kind == "feedback.event" && + node.Props["eventKind"] == "simulation.interrupted" && + node.Props["reason"] == "entity.damaged" && + node.Props["scalarValue"] == "4" && node.Props["auxiliaryValue"] == "1"), + "generic Eve feedback must expose why compressed world time stopped"); + var world = Flatten(surface.Surface.Root).Single(node => node.Kind == "world.scene3d"); + Require(world.Props["gameMode"] == "terminus" && + world.Props["requestedSimulationRate"] == "4" && + world.Props["effectiveSimulationRate"] == "0" && + world.Props["simulationStepsExecuted"] == "1" && + world.Props["attentionCauseKind"] == "entity.damaged", + "generic Eve world state must expose requested and effective clock state without owning it"); + var restoredFrame = MessagePack.MessagePackSerializer.Deserialize( + MessagePack.MessagePackSerializer.Serialize(tick.Frame)); + Require(restoredFrame.RequestedSimulationRate == 4 && restoredFrame.EffectiveSimulationRate == 0 && + restoredFrame.SimulationStepsExecuted == 1 && restoredFrame.AttentionCauseKind == "entity.damaged", + "clock interruption state must survive authoritative frame serialization"); + } + private static void BehaviorChainsGateAuthoritativeStatModifiers() { var thruster = CatalogItem("modifier-target", new AetheriaRuntimeBehaviorPayload( diff --git a/Aetheria.State.Daemon/Program.cs b/Aetheria.State.Daemon/Program.cs index 999bf8353..bef71ebe4 100644 --- a/Aetheria.State.Daemon/Program.cs +++ b/Aetheria.State.Daemon/Program.cs @@ -280,6 +280,7 @@ static async Task TickAsync( WorldPhysics = worldPhysics, AdvanceSimulation = advanceSimulation, SimulationStepCount = simulationStepCount, + StopCompressedSimulationOnAttention = terminus && simulationStepCount > 1, StarbridgeScenario = starbridgeScenario, StarbridgeSession = starbridgeSession, BuildPublications = buildPublications, @@ -289,6 +290,13 @@ static async Task TickAsync( LoadoutTemplates = loadoutTemplates } }); + if (terminus && result.AttentionInterruption != null) + await PauseTerminusForAttentionAsync(node, ingressState).ConfigureAwait(false); + result.Frame.GameMode = ingressState.GameMode; + result.Frame.RequestedSimulationRate = ingressState.RequestedSimulationRate; + result.Frame.EffectiveSimulationRate = ingressState.SimulationRate; + result.Frame.SimulationStepsExecuted = result.SimulationStepsExecuted; + result.Frame.AttentionCauseKind = result.AttentionInterruption?.CauseKind ?? ""; TracePhase("simulation"); if (string.Equals(Environment.GetEnvironmentVariable("AETHERIA_TRACE_EVE_SNAPSHOTS"), "1", StringComparison.Ordinal) && result.Frame.AppliedCommandIds.Count > 0) @@ -409,7 +417,8 @@ static async Task RefreshControlPlaneInputsAsync( var gameSession = await node.MutableDocument(AetheriaStateNode.GameSessionStateKey) .ReadAsync().ConfigureAwait(false); ingressState.GameMode = gameSession?.Mode ?? ""; - ingressState.SimulationRate = gameSession?.SimulationRate ?? 0; + ingressState.RequestedSimulationRate = gameSession?.SimulationRate ?? 0; + ingressState.SimulationRate = gameSession?.EffectiveSimulationRate ?? gameSession?.SimulationRate ?? 0; ingressState.LoadoutTemplates = node.Cache .GetAll() .Select(ToLoadoutTemplateCommit) @@ -443,12 +452,30 @@ static async Task ApplySimulationClockCommandsAsync( continue; } if (AetheriaRuntimeDaemonOperations.IsSupportedSimulationRate(command.ScalarValue)) + { session.SimulationRate = command.ScalarValue; + session.EffectiveSimulationRate = command.ScalarValue; + } } session.UpdatedAtUtc = DateTimeOffset.UtcNow.ToString("O"); await node.MutableDocument(AetheriaStateNode.GameSessionStateKey) .ReplaceAsync(session).ConfigureAwait(false); - ingressState.SimulationRate = session.SimulationRate; + ingressState.RequestedSimulationRate = session.SimulationRate; + ingressState.SimulationRate = session.EffectiveSimulationRate ?? session.SimulationRate; +} + +static async Task PauseTerminusForAttentionAsync( + AetheriaStateNode node, + AetheriaDaemonIngressState ingressState) +{ + var session = await node.MutableDocument(AetheriaStateNode.GameSessionStateKey) + .ReadAsync().ConfigureAwait(false) ?? new AetheriaGameSessionState(); + session.EffectiveSimulationRate = 0; + session.UpdatedAtUtc = DateTimeOffset.UtcNow.ToString("O"); + await node.MutableDocument(AetheriaStateNode.GameSessionStateKey) + .ReplaceAsync(session).ConfigureAwait(false); + ingressState.SimulationRate = 0; + ingressState.SimulationStepAccumulator = 0; } static async Task PublishCommittedCommandFactsAsync( @@ -2480,6 +2507,8 @@ static async Task EnsureTerminusGameSessionAsync( RunId = AetheriaDaemonZoneGenerator.RunIdFor(options.TerminusScenario), ControlledEntityKey = AetheriaDaemonZoneGenerator.EntityKey(options.TerminusScenario, 0, 1), EntrySurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.PilotSurfaceId, + SimulationRate = 1, + EffectiveSimulationRate = 1, UpdatedAtUtc = now }).ConfigureAwait(false); await node.FlushAsync().ConfigureAwait(false); @@ -2513,6 +2542,8 @@ static async Task ApplyRequestedTerminusSessionAsync( session.RunId = AetheriaDaemonZoneGenerator.RunIdFor(options.TerminusScenario); session.ControlledEntityKey = AetheriaDaemonZoneGenerator.EntityKey(options.TerminusScenario, 0, 1); session.EntrySurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.PilotSurfaceId; + session.SimulationRate = 1; + session.EffectiveSimulationRate = 1; session.LastStartCommandId = menu.LastCommandId; session.UpdatedAtUtc = now; await node.MutableDocument(AetheriaStateNode.GameSessionStateKey) @@ -3041,6 +3072,7 @@ internal sealed class AetheriaDaemonIngressState public int ObservedEveCommandCount { get; set; } = -1; public bool ControlPlaneInitialized { get; set; } public string GameMode { get; set; } = ""; + public double RequestedSimulationRate { get; set; } public double SimulationRate { get; set; } public double SimulationStepAccumulator { get; set; } public AetheriaRuntimeLoadoutTemplateCommit[] LoadoutTemplates { get; set; } = []; diff --git a/Aetheria.State/AetheriaEveSurfaceDocuments.cs b/Aetheria.State/AetheriaEveSurfaceDocuments.cs index f3c665f42..891773b52 100644 --- a/Aetheria.State/AetheriaEveSurfaceDocuments.cs +++ b/Aetheria.State/AetheriaEveSurfaceDocuments.cs @@ -231,6 +231,7 @@ public static class AetheriaEveSurfaceDocuments "aetheria.name_file.v2", "aetheria.trade_value_policy.v1", "aetheria.player_settings.v1", + "aetheria.game_session.v1", "aetheria.loadout_template.v1", "aetheria.run_state.v1", "aetheria.zone_state.v1", diff --git a/Aetheria.State/Documents/AetheriaGameSessionState.cs b/Aetheria.State/Documents/AetheriaGameSessionState.cs index e241705df..87e62e995 100644 --- a/Aetheria.State/Documents/AetheriaGameSessionState.cs +++ b/Aetheria.State/Documents/AetheriaGameSessionState.cs @@ -18,4 +18,5 @@ public sealed class AetheriaGameSessionState [Key(5)] public string LastStartCommandId { get; set; } = ""; [Key(6)] public string UpdatedAtUtc { get; set; } = ""; [Key(7)] public double SimulationRate { get; set; } = 1; + [Key(8)] public double? EffectiveSimulationRate { get; set; } = 1; } diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs index 223107359..56a0b4399 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs @@ -550,6 +550,21 @@ namespace GameCult.Aetheria.State.Verse public IReadOnlyDictionary RejectedCommandReasons { get; set; } = new Dictionary(); + [Key(24)] + public string GameMode { get; set; } = ""; + + [Key(25)] + public double RequestedSimulationRate { get; set; } = 1; + + [Key(26)] + public double EffectiveSimulationRate { get; set; } = 1; + + [Key(27)] + public int SimulationStepsExecuted { get; set; } + + [Key(28)] + public string AttentionCauseKind { get; set; } = ""; + public static AetheriaRuntimeDaemonFrameDocument Create( AetheriaRuntimeRunCheckpointCommit run, string daemonId, diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonGameSurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonGameSurfaceBuilder.cs index 786f47d5d..5c7cab46d 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonGameSurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonGameSurfaceBuilder.cs @@ -38,6 +38,7 @@ namespace GameCult.Aetheria.State.Verse run, zone, run.CurrentEntityKey, + frame, frame.SimulationSettings, catalog), CockpitOverlay(entity, target, frame.SimulationSettings), @@ -805,6 +806,7 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeZoneSnapshotCommit zone, string currentEntityKey, + AetheriaRuntimeDaemonFrameDocument frame, AetheriaRuntimeDaemonSimulationSettings simulationSettings, AetheriaRuntimeCatalogSnapshot? catalog) { @@ -871,6 +873,11 @@ namespace GameCult.Aetheria.State.Verse ["runLifecycle"] = run.LifecyclePhase ?? "", ["runTerminalReason"] = run.TerminalReason ?? "", ["runTerminalFrameId"] = run.TerminalFrameId.ToString(CultureInfo.InvariantCulture), + ["gameMode"] = frame.GameMode ?? "", + ["requestedSimulationRate"] = F(frame.RequestedSimulationRate), + ["effectiveSimulationRate"] = F(frame.EffectiveSimulationRate), + ["simulationStepsExecuted"] = frame.SimulationStepsExecuted.ToString(CultureInfo.InvariantCulture), + ["attentionCauseKind"] = frame.AttentionCauseKind ?? "", ["presentationMode"] = !AetheriaRuntimeRunLifecycle.IsActive(run) ? "terminal" : isDocked ? "docked" : "world", diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs index 3a25ab4c1..e8a3210d5 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs @@ -38,6 +38,7 @@ namespace GameCult.Aetheria.State.Verse public IAetheriaRuntimeWorldPhysics? WorldPhysics { get; set; } public bool AdvanceSimulation { get; set; } = true; public int SimulationStepCount { get; set; } = 1; + public bool StopCompressedSimulationOnAttention { get; set; } public bool BuildPublications { get; set; } = true; public AetheriaRuntimeDaemonSoaFramePublisher? SoaFramePublisher { get; set; } } @@ -57,7 +58,9 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeSurfaceDocument? gameSurface = null, AetheriaRuntimeSurfaceDocument? gameTuiSurface = null, AetheriaRuntimeSurfaceDocument? editorSurface = null, - AetheriaRuntimeSurfaceDocument? editorTuiSurface = null) + AetheriaRuntimeSurfaceDocument? editorTuiSurface = null, + int simulationStepsExecuted = 0, + AetheriaRuntimeSimulationInterruption? attentionInterruption = null) { Run = run ?? new AetheriaRuntimeRunCheckpointCommit(); OperationResult = operationResult ?? new AetheriaRuntimeDaemonOperationResult( @@ -75,6 +78,8 @@ namespace GameCult.Aetheria.State.Verse GameTuiSurface = gameTuiSurface; EditorSurface = editorSurface; EditorTuiSurface = editorTuiSurface; + SimulationStepsExecuted = simulationStepsExecuted; + AttentionInterruption = attentionInterruption; } public AetheriaRuntimeRunCheckpointCommit Run { get; } @@ -91,9 +96,54 @@ namespace GameCult.Aetheria.State.Verse public AetheriaRuntimeSurfaceDocument? GameTuiSurface { get; } public AetheriaRuntimeSurfaceDocument? EditorSurface { get; } public AetheriaRuntimeSurfaceDocument? EditorTuiSurface { get; } + public int SimulationStepsExecuted { get; } + public AetheriaRuntimeSimulationInterruption? AttentionInterruption { get; } public AetheriaRuntimeDaemonIntentState Intents => OperationResult.Intents; } + public sealed class AetheriaRuntimeSimulationInterruption + { + public AetheriaRuntimeSimulationInterruption(string causeEventId, string causeKind, double simulationTimeSeconds) + { + CauseEventId = causeEventId ?? ""; + CauseKind = causeKind ?? ""; + SimulationTimeSeconds = simulationTimeSeconds; + } + + public string CauseEventId { get; } + public string CauseKind { get; } + public double SimulationTimeSeconds { get; } + } + + public static class AetheriaRuntimeTerminusAttentionPolicy + { + private static readonly HashSet InterruptingKinds = new HashSet(StringComparer.Ordinal) + { + "consumable.activation.refused", + "entity.damaged", + "entity.destroyed", + "equipment.destroyed", + "pickup.collected", + "pickup.rejected", + "pilot.heatstroke.risk", + "pilot.hypothermia.risk", + "run.failed", + "ship.docked", + "ship.undocked", + "weapon.charge.malfunctioned", + "weapon.fire.refused", + "wormhole.transferred", + "wormhole.exit.completed" + }; + + public static AetheriaRuntimeGameEventCommit? FirstInterruptingEvent( + IEnumerable events) => + (events ?? Array.Empty()) + .Where(value => value != null && InterruptingKinds.Contains(value.Kind ?? "")) + .OrderBy(value => value.EventId, StringComparer.Ordinal) + .FirstOrDefault(); + } + public static class AetheriaRuntimeDaemonTickRunner { public static AetheriaRuntimeDaemonTickResult Tick( @@ -160,10 +210,19 @@ namespace GameCult.Aetheria.State.Verse var simulationStepCount = options.AdvanceSimulation && AetheriaRuntimeRunLifecycle.IsActive(operationResult.Run) ? Math.Max(1, options.SimulationStepCount) : 0; + var simulationStartTimeSeconds = options.SimulationTimeSeconds - + simulationStepCount * options.FixedDeltaSeconds; + var simulationStepsExecuted = 0; + AetheriaRuntimeSimulationInterruption? attentionInterruption = null; for (var simulationStep = 0; simulationStep < simulationStepCount; simulationStep++) { - var stepTime = options.SimulationTimeSeconds - - ((simulationStepCount - simulationStep - 1) * options.FixedDeltaSeconds); + var stepTime = simulationStartTimeSeconds + + (simulationStep + 1) * options.FixedDeltaSeconds; + var eventIdsBeforeStep = new HashSet( + (operationResult.Run.GameEvents ?? Array.Empty()) + .Where(value => value != null) + .Select(value => value.EventId ?? ""), + StringComparer.Ordinal); var agentCommands = AetheriaRuntimeAgentScheduler.AssignAndPlan( operationResult.Run, options.FrameId, @@ -204,14 +263,50 @@ namespace GameCult.Aetheria.State.Verse options.RenderSettings); Trace("world-step"); StampZoneSimulationTime(operationResult.Run, stepTime); + simulationStepsExecuted++; + + if (options.StopCompressedSimulationOnAttention && simulationStepCount > 1) + { + var cause = AetheriaRuntimeTerminusAttentionPolicy.FirstInterruptingEvent( + (operationResult.Run.GameEvents ?? Array.Empty()) + .Where(value => value != null && !eventIdsBeforeStep.Contains(value.EventId ?? ""))); + if (cause != null) + { + attentionInterruption = new AetheriaRuntimeSimulationInterruption( + cause.EventId, cause.Kind, stepTime); + AetheriaRuntimeGameEvents.Append(operationResult.Run, new AetheriaRuntimeGameEventCommit + { + EventId = $"frame:{options.FrameId}:simulation:interrupted:{cause.EventId}", + Kind = "simulation.interrupted", + FrameId = options.FrameId, + ZoneIndex = cause.ZoneIndex, + SourceEntityIndex = cause.SourceEntityIndex, + TargetEntityIndex = cause.TargetEntityIndex, + SubjectKey = cause.EventId, + ItemKey = cause.ItemKey, + Reason = cause.Kind, + ScalarValue = simulationStepCount, + AuxiliaryValue = simulationStepsExecuted, + PositionX = cause.PositionX, + PositionZ = cause.PositionZ + }); + break; + } + } + + if (!AetheriaRuntimeRunLifecycle.IsActive(operationResult.Run)) + break; } + var committedSimulationTimeSeconds = simulationStartTimeSeconds + + simulationStepsExecuted * options.FixedDeltaSeconds; + var frame = AetheriaRuntimeDaemonFrameDocument.Create( operationResult.Run, options.DaemonId, options.SessionId, options.FrameId, - options.SimulationTimeSeconds, + committedSimulationTimeSeconds, options.FixedDeltaSeconds, renderSettings: options.RenderSettings, simulationSettings: options.SimulationSettings); @@ -254,10 +349,19 @@ namespace GameCult.Aetheria.State.Verse return new AetheriaRuntimeDaemonTickResult( operationResult.Run, operationResult, - frame); + frame, + simulationStepsExecuted: simulationStepsExecuted, + attentionInterruption: attentionInterruption); } - return BuildPublications(stateFilePath, operationResult, frame, options, observedCommands.Length); + return BuildPublications( + stateFilePath, + operationResult, + frame, + options, + observedCommands.Length, + simulationStepsExecuted, + attentionInterruption); } public static AetheriaRuntimeDaemonTickResult BuildPublications( @@ -265,7 +369,9 @@ namespace GameCult.Aetheria.State.Verse AetheriaRuntimeDaemonOperationResult operationResult, AetheriaRuntimeDaemonFrameDocument frame, AetheriaRuntimeDaemonTickOptions options, - int observedCommandCount) + int observedCommandCount, + int simulationStepsExecuted = 0, + AetheriaRuntimeSimulationInterruption? attentionInterruption = null) { var soaPublisher = options.SoaFramePublisher ?? throw new InvalidOperationException("The daemon-lifetime Aetheria SoA publisher is required."); @@ -332,7 +438,9 @@ namespace GameCult.Aetheria.State.Verse gameSurface, gameSurface, editorSurface, - editorSurface); + editorSurface, + simulationStepsExecuted, + attentionInterruption); } private static AetheriaRuntimeDaemonIntentState MergeIntents( diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 35f77d11b..716f90ddb 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -1082,6 +1082,30 @@ future daemon-owned tutorial completion transaction may cross that flag. The fossil selected tutorial New Game while the flag was false, so merely entering the Terminus proof arena cannot award completion. +### Daemon Terminus Clock And Attention Ownership + +- Owner: the daemon session clock owns requested rate, effective rate, fixed-step + execution, and the decision to interrupt compressed time. +- Inputs: accepted clock commands, the active game mode, and new authoritative + gameplay facts committed by each fixed simulation step. +- Outputs: committed simulation time, actual steps executed, + `simulation.interrupted`, effective pause state, and Eve scene properties that + expose the requested rate, effective rate, and cause without granting control + authority to the renderer. +- Derived state: Unity interpolation and visible pause/attention affordances are + projections. They do not advance time or classify gameplay facts. +- Forbidden writers: Eve lowerers, wall-clock cadence, publication batching, and + presentation effects cannot change the effective simulation clock. +- Shared paths: compressed transit, single-step inspection, failure, combat, + docking, thermal, cargo, and wormhole events all commit through the same + daemon tick and event ledger. +- Cut line: executing the full requested compressed batch before inspecting its + intermediate facts is dead. Requested rate is no longer overloaded as the + current effective rate. +- Verification layer: daemon smoke detonates a mine in the first of four + requested steps, proves the causal damage commits at that step, proves later + steps do not execute, and round-trips the clock/cause fields through Eve. + ### Daemon Pickup Contact Transaction - Owner: the daemon simulation owns pickup collection by interpreting typed diff --git a/docs/original-game-migration-matrix.md b/docs/original-game-migration-matrix.md index 79636aa4d..831579384 100644 --- a/docs/original-game-migration-matrix.md +++ b/docs/original-game-migration-matrix.md @@ -15,7 +15,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity. | Organ | Original authority/evidence | Target owner | Eve contract | Runtime lowering | Current status | Required proof | |---|---|---|---|---|---|---| -| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement plus run lifecycle bindings | all clients | active/failed lifecycle is daemon-owned and restart-stable: controlled-entity destruction commits the fossil cause, terminal frame, one `run.failed` fact, releases control, rejects later gameplay commands, and freezes the world; Eve receives terminal presentation/input levers without becoming an owner. Docked, travelling, fighting, mining, looting, and refitting remain derived world conditions rather than counterfeit durable phases. Terminus scenario generation preserves `TutorialPassed`: entering a generated/proof arena cannot impersonate the missing tutorial-completion transaction | full-daemon death/restart witness, multi-client convergence, daemon-owned tutorial generation/completion, and a source-backed game-mode completion rule; the fossil supplied no victory transition | +| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement plus run lifecycle bindings | all clients | active/failed lifecycle is daemon-owned and restart-stable: controlled-entity destruction commits the fossil cause, terminal frame, one `run.failed` fact, releases control, rejects later gameplay commands, and freezes the world; Eve receives terminal presentation/input levers without becoming an owner. Terminus keeps persistent requested simulation rate distinct from effective rate: compressed batches inspect authoritative facts after each fixed step, stop at the causal damage/destruction/cargo/thermal/docking/weapon/wormhole/run event, pause effectively without erasing the request, and project the exact cause and executed-step count through Eve. Docked, travelling, fighting, mining, looting, and refitting remain derived world conditions rather than counterfeit durable phases. Terminus scenario generation preserves `TutorialPassed`: entering a generated/proof arena cannot impersonate the missing tutorial-completion transaction | full-daemon death/restart witness, broader attention taxonomy (contact, targeting, readiness, arrival, discovery, and failed orders), multi-client convergence, daemon-owned tutorial generation/completion, and a source-backed game-mode completion rule; the fossil supplied no victory transition | | Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | daemon-owned hull identity, exact installed placement/rotation and instance state, cargo stacks, weapon membership/held state, equipment wear, executable behavior state, weapon chronology, active-effect state, and loadout-generation provenance survive a hard CultCache close/reopen through the durable latest-frame checkpoint. An advertised generic Eve equip operation now translates into the typed daemon transaction before that checkpoint; its accepted placement survives restart and its consumed station-cargo source does not resurrect. Generic Eve rebuilds weapon and scalar thermostat controls from that restored truth; legacy per-entity documents are bootstrap inputs only when no live frame exists | live client refit witness and multi-client convergence | | Loadout generation | map/faction availability, item cost, hull hardpoints and role constraints | daemon using canonical galaxy, faction knowledge/economy and typed catalog | generated loadout plus provenance/availability facts | Eve inspection and refit surfaces | daemon now uses the fossil candidate filter and seeded weighted selection: manufacturer must be present and allied, ally weight decays by home-zone graph distance, price uses the authored exponent, and hardpoints require matching semantic type, rotated footprint containment, and controller role; the April 2021 catalog fossil restores the distinct common `Longinus`, rare AetherDrive-compatible `LonginusX`, and `Djinni` rows with their original IDs, shapes, hardpoints, prices, drag, and prefabs, plus missing Thruster rows required to fill their authored mounts; typed `rarity:rare` tags apply a 0.05 generation multiplier to `LonginusX` and AetherDrive equipment; the generator owns one mutable CultMath stream, fixing the readonly-struct defensive-copy bug that restarted every weighted draw; placement rotation survives durable state and reconnect; generation fills the largest compatible footprint before economic weighting; cargo/capacitor plus station docking equipment must fit remaining hull space; stations pack faction-available inventory largest-first; ordinary ships begin without invented scenario cargo; every generated entity persists a source/selection receipt that reaches Eve as `loadout.item` semantics | multi-zone generated-world parity and exact root-to-zone stream sequencing against the fossil | | Flight intent | `Ship`, `Thruster`, `AetherDrive`, `VelocityConversion`, `VelocityLimit`, input paths | daemon actuator simulation + Ymir integration | analog local helm/look/tractor plus actuator state | generic Eve input and scene lowerers | direct faction-speed velocity ownership is deleted; daemon persists local strafe/forward helm and desired look, allocates ordinary directional thruster banks by authored rotation, derives torque from hull/item placement, compensates lateral torque, gates execution through the shared energy ledger, deposits equipment-cell heat, publishes plume visibility and actuator state, applies hull drag, then runs operational velocity conversion with the fossil exponential damp equation and clamps the result through evaluated velocity limits before giving velocity/direction to Ymir. The evaluated limit remains in durable behavior state for reconnect and Eve inspection. Autonomous tasks translate world travel into the same local helm axes and issue look commands instead of mutating heading. AetherDrive rotor/coupling simulation is additive and explicitly non-default: common `Longinus` and `Djinni` hulls use ordinary thrusters; the rare `LonginusX` replaces those mounts with the single rare `Traction` AetherDrive path | hardpoint-transform direction parity, exact cross-equipment behavior execution ordering, CultMath/float32 parity harness, live production-frequency evidence, generic thrust/turn feedback lowering, and live handling screenshots | diff --git a/docs/renderless-aetheria-architecture.md b/docs/renderless-aetheria-architecture.md index 12cbd7cf4..89eeeaab3 100644 --- a/docs/renderless-aetheria-architecture.md +++ b/docs/renderless-aetheria-architecture.md @@ -112,14 +112,17 @@ sample of the resulting state. Unity, Electron, bots, and other Eve clients may interpolate presentation between samples, but cannot advance committed game time or invent intermediate outcomes. -Time compression must eventually distinguish requested rate from effective -rate. Decision-relevant daemon facts, including contact, hostile targeting, -damage, weapon readiness, arrival, resource discovery, cargo events, docking, -and failed orders, will clamp or pause the effective rate according to an -explicit player policy. The interruption fact must name its reason and the -simulation time at which it occurred; the daemon may not simulate past that -boundary before publishing it. This attention policy is daemon-owned gameplay -state, not client heuristics. +Time compression distinguishes the persistent requested rate from the effective +rate currently being executed. During a compressed batch, the daemon inspects +new gameplay facts after every fixed step. Damage, destruction, pickup outcomes, +thermal risk, docking transitions, weapon failures, wormhole transitions, and +run failure stop the batch at the causal step, publish `simulation.interrupted`, +and set the effective rate to pause without erasing the requested rate. The +interruption names its cause and exact simulation time; the daemon never commits +later steps before publishing it. Contact, hostile targeting, weapon readiness, +arrival, resource discovery, and failed-order coverage remain to be added to the +explicit policy as their authoritative facts mature. This attention policy is +daemon-owned gameplay state, not client heuristics. Compressed stepping must not multiply control-plane traffic. Commands and receipts retain their ordinary typed CultMesh path, SoA consumers receive the