Move daemon world advancement into Ymir
This commit is contained in:
parent
55664c377a
commit
31c1dc71b4
9 changed files with 153 additions and 37 deletions
|
|
@ -12,6 +12,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
YmirMovesProjectileAndReportsStableContact();
|
||||
DaemonSimulationAppliesYmirHit();
|
||||
MissingPhysicsOwnerCannotAdvanceProjectiles();
|
||||
MissingWorldPhysicsOwnerCannotAdvanceShips();
|
||||
ThermalCellsUseFossilConductionAndRadiation();
|
||||
MultipleActorsUseTheSameMovementLever();
|
||||
AgentClaimsAndCompletesExploreTaskThroughCommands();
|
||||
|
|
@ -45,12 +46,12 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
AgentTasks = [new AetheriaRuntimeAgentTaskCommit { TaskId = "tow-1", CorporationKey = "workers", TaskType = AetheriaRuntimeAgentTaskTypes.Tow, ZoneIndex = 0, Status = AetheriaRuntimeAgentTaskStatuses.Queued, TargetEntityIndex = 1, OrbitParentKey = "parent-body", OrbitDistance = 20, CompletionRadius = 5 }]
|
||||
};
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-tow-attach-smoke.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 1, FixedDeltaSeconds = 0.1, SimulationTimeSeconds = 1, BuildPublications = false });
|
||||
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 1, FixedDeltaSeconds = 0.1, SimulationTimeSeconds = 1, BuildPublications = false });
|
||||
Require(run.Zones[0].Entities[0].ChildEntityIndices.Contains(1), "tow pickup must attach station to tug parentage");
|
||||
RequireEqual("", run.Zones[0].Entities[1].OrbitKey, "attached station must no longer own an orbit");
|
||||
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-tow-detach-smoke.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 2, FixedDeltaSeconds = 0.1, SimulationTimeSeconds = 2, BuildPublications = false });
|
||||
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 2, FixedDeltaSeconds = 0.1, SimulationTimeSeconds = 2, BuildPublications = false });
|
||||
Require(!run.Zones[0].Entities[0].ChildEntityIndices.Contains(1), "tow delivery must detach station parentage");
|
||||
Require(!string.IsNullOrWhiteSpace(run.Zones[0].Entities[1].OrbitKey), "delivered station must own a persistent orbit");
|
||||
Require(run.Zones[0].Orbits.Any(orbit => orbit.OrbitKey == run.Zones[0].Entities[1].OrbitKey && orbit.ParentOrbitKey == "parent-orbit" && Math.Abs(orbit.Distance - 20) < 0.001),
|
||||
|
|
@ -78,14 +79,14 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
AgentTasks = [new AetheriaRuntimeAgentTaskCommit { TaskId = "survey-1", CorporationKey = "workers", TaskType = AetheriaRuntimeAgentTaskTypes.Explore, ZoneIndex = 0, Status = AetheriaRuntimeAgentTaskStatuses.Queued, TargetBodyKeys = ["survey-world"] }]
|
||||
};
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-survey-smoke.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 1, FixedDeltaSeconds = 1, SimulationTimeSeconds = 1, Catalog = catalog, BuildPublications = false });
|
||||
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 1, FixedDeltaSeconds = 1, SimulationTimeSeconds = 1, Catalog = catalog, BuildPublications = false });
|
||||
var knowledge = run.CorporationSurveys.Single();
|
||||
RequireEqual("workers", knowledge.CorporationKey, "survey knowledge must belong to the agent corporation");
|
||||
RequireEqual("survey-world", knowledge.BodyKey, "survey knowledge must identify the scanned body");
|
||||
RequireNear(4, knowledge.DensityFloor, 0.000001, "survey must publish the scanner minimum density");
|
||||
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-survey-complete-smoke.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 2, FixedDeltaSeconds = 1, SimulationTimeSeconds = 2, Catalog = catalog, BuildPublications = false });
|
||||
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 2, FixedDeltaSeconds = 1, SimulationTimeSeconds = 2, Catalog = catalog, BuildPublications = false });
|
||||
RequireEqual(AetheriaRuntimeAgentTaskStatuses.Completed, run.AgentTasks[0].Status,
|
||||
"survey order must complete when corporation knowledge satisfies the scanner threshold");
|
||||
}
|
||||
|
|
@ -150,7 +151,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
};
|
||||
|
||||
var result = AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-mining-smoke.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 1, FixedDeltaSeconds = 1, SimulationTimeSeconds = 1, Catalog = catalog, BuildPublications = false });
|
||||
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 1, FixedDeltaSeconds = 1, SimulationTimeSeconds = 1, Catalog = catalog, BuildPublications = false });
|
||||
|
||||
Require(run.AgentTasks[0].Phase == "mining", "mining task must activate its equipped tool");
|
||||
Require(result.OperationResult.Intents.Behaviors.Count == 1,
|
||||
|
|
@ -162,7 +163,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
"historical mining yield must enter daemon-owned cargo");
|
||||
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-mining-offload-smoke.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 2, FixedDeltaSeconds = 1, SimulationTimeSeconds = 2, Catalog = catalog, BuildPublications = false });
|
||||
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 2, FixedDeltaSeconds = 1, SimulationTimeSeconds = 2, Catalog = catalog, BuildPublications = false });
|
||||
Require(!run.Zones[0].Entities[0].CargoContents.SelectMany(bay => bay.Items).Any(),
|
||||
"full miner must offload through the shared cargo transfer command");
|
||||
Require(run.Zones[0].Entities[1].CargoContents.SelectMany(bay => bay.Items).Any(slot => slot.Item.ItemKey == "iron" && slot.Item.Quantity == 1),
|
||||
|
|
@ -215,6 +216,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
run,
|
||||
new AetheriaRuntimeDaemonTickOptions
|
||||
{
|
||||
WorldPhysics = new AetheriaYmirWorldPhysics(),
|
||||
FrameId = 1,
|
||||
FixedDeltaSeconds = 0,
|
||||
Catalog = catalog,
|
||||
|
|
@ -312,6 +314,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
run,
|
||||
new AetheriaRuntimeDaemonTickOptions
|
||||
{
|
||||
WorldPhysics = new AetheriaYmirWorldPhysics(),
|
||||
FrameId = frame,
|
||||
FixedDeltaSeconds = 0.1,
|
||||
SimulationTimeSeconds = frame * 0.1,
|
||||
|
|
@ -421,6 +424,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
run,
|
||||
new AetheriaRuntimeDaemonTickOptions
|
||||
{
|
||||
WorldPhysics = new AetheriaYmirWorldPhysics(),
|
||||
FrameId = frame,
|
||||
FixedDeltaSeconds = 0.1,
|
||||
SimulationTimeSeconds = frame * 0.1,
|
||||
|
|
@ -500,6 +504,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
run,
|
||||
new AetheriaRuntimeDaemonTickOptions
|
||||
{
|
||||
WorldPhysics = new AetheriaYmirWorldPhysics(),
|
||||
FrameId = frame,
|
||||
FixedDeltaSeconds = 0.1,
|
||||
SimulationTimeSeconds = frame * 0.1,
|
||||
|
|
@ -593,6 +598,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
run,
|
||||
new AetheriaRuntimeDaemonTickOptions
|
||||
{
|
||||
WorldPhysics = new AetheriaYmirWorldPhysics(),
|
||||
FrameId = frame,
|
||||
FixedDeltaSeconds = 0.1,
|
||||
SimulationTimeSeconds = frame * 0.1,
|
||||
|
|
@ -653,7 +659,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
operation.Intents,
|
||||
0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
AetheriaRuntimeProjectilePhysicsUnavailable.Instance);
|
||||
AetheriaRuntimeProjectilePhysicsUnavailable.Instance,
|
||||
new AetheriaYmirWorldPhysics());
|
||||
Require(player.VelocityX > 0 && Math.Abs(player.VelocityY) < 0.001,
|
||||
"player command must drive its actor through the shared movement lever");
|
||||
Require(agent.VelocityY > 0 && Math.Abs(agent.VelocityX) < 0.001,
|
||||
|
|
@ -744,7 +751,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
new AetheriaRuntimeDaemonIntentState(),
|
||||
0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
new AetheriaYmirProjectilePhysics());
|
||||
new AetheriaYmirProjectilePhysics(),
|
||||
new AetheriaYmirWorldPhysics());
|
||||
|
||||
RequireEqual(88.0, Stat(target, "hull"), "Aetheria must interpret the Ymir contact as damage");
|
||||
RequireEqual(0, run.Zones[0].Projectiles.Count, "spent projectile must leave daemon state");
|
||||
|
|
@ -760,7 +768,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
new AetheriaRuntimeDaemonIntentState(),
|
||||
0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
AetheriaRuntimeProjectilePhysicsUnavailable.Instance);
|
||||
AetheriaRuntimeProjectilePhysicsUnavailable.Instance,
|
||||
new AetheriaYmirWorldPhysics());
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
|
|
@ -770,10 +779,28 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
throw new InvalidOperationException("daemon advanced a projectile without an authoritative physics owner");
|
||||
}
|
||||
|
||||
private static void MissingWorldPhysicsOwnerCannotAdvanceShips()
|
||||
{
|
||||
var entity = Entity(0, 0, "player");
|
||||
entity.VelocityX = 10;
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit { CurrentZoneIndex = 0, CurrentEntityKey = "zone.0.entity.0", Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [entity] }] };
|
||||
try
|
||||
{
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-missing-world-physics.cc"), run,
|
||||
new AetheriaRuntimeDaemonTickOptions { FrameId = 1, FixedDeltaSeconds = 0.1, ProjectilePhysics = AetheriaRuntimeProjectilePhysicsUnavailable.Instance, BuildPublications = false });
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
RequireNear(0, entity.PositionX, 0.000001, "ship must not advance without Ymir world authority");
|
||||
return;
|
||||
}
|
||||
throw new InvalidOperationException("daemon advanced a ship without an authoritative world physics owner");
|
||||
}
|
||||
|
||||
private static (AetheriaRuntimeRunCheckpointCommit Run, AetheriaRuntimeZoneSnapshotCommit Zone, AetheriaRuntimeEntitySnapshotCommit Target) Scenario()
|
||||
{
|
||||
var source = Entity(1, 0, "player");
|
||||
var target = Entity(2, 30, "raider");
|
||||
var source = Entity(1, -100, "player");
|
||||
var target = Entity(2, 30, "enemy");
|
||||
var zone = new AetheriaRuntimeZoneSnapshotCommit
|
||||
{
|
||||
ZoneIndex = 0,
|
||||
|
|
|
|||
33
Aetheria.State.Daemon/AetheriaYmirWorldPhysics.cs
Normal file
33
Aetheria.State.Daemon/AetheriaYmirWorldPhysics.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using GameCult.Aetheria.State.Verse;
|
||||
using Ymir.Core;
|
||||
|
||||
namespace Aetheria.State.Daemon;
|
||||
|
||||
public sealed class AetheriaYmirWorldPhysics : IAetheriaRuntimeWorldPhysics
|
||||
{
|
||||
private const string Prefix = "aetheria.daemon.entity.";
|
||||
private readonly YmirSimulator _simulator;
|
||||
public AetheriaYmirWorldPhysics(YmirSimulator? simulator = null) => _simulator = simulator ?? new YmirSimulator();
|
||||
public string AuthorityId => "ymir.core";
|
||||
|
||||
public AetheriaRuntimeWorldStep Step(AetheriaRuntimeZoneSnapshotCommit zone, IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities, double deltaSeconds)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(zone);
|
||||
if (deltaSeconds <= 0) throw new ArgumentOutOfRangeException(nameof(deltaSeconds));
|
||||
var attached = (entities ?? Array.Empty<AetheriaRuntimeEntitySnapshotCommit>()).SelectMany(entity => entity.ChildEntityIndices ?? Array.Empty<int>()).ToHashSet();
|
||||
var bodies = (entities ?? Array.Empty<AetheriaRuntimeEntitySnapshotCommit>()).Where(entity => entity.IsActive && !attached.Contains(entity.EntityIndex))
|
||||
.Select(entity => new PhysicsBody(Prefix + entity.EntityIndex, new Vec2((float)entity.PositionX, (float)entity.PositionZ), new Vec2((float)entity.VelocityX, (float)entity.VelocityY),
|
||||
string.Equals(entity.Kind, "station", StringComparison.OrdinalIgnoreCase) ? 48 : 20, 1,
|
||||
IsStatic: string.Equals(entity.Kind, "station", StringComparison.OrdinalIgnoreCase), Restitution: 0.2f,
|
||||
Direction: new Vec2((float)entity.DirectionX, (float)entity.DirectionY))).ToArray();
|
||||
var fields = AetheriaRuntimeDaemonRenderQueries.QueryBodyPoses(zone)
|
||||
.Select(pose => (Pose: pose, Body: (zone.Bodies ?? Array.Empty<AetheriaRuntimeBodySnapshotCommit>()).FirstOrDefault(body => body != null && body.BodyKey == pose.BodyKey)))
|
||||
.Where(pair => pair.Body != null && pair.Body.GravityInfluenceRadius > 0 && pair.Body.GravityWellDepth != 0)
|
||||
.Select(pair => new RadialField("aetheria.daemon.gravity." + pair.Pose.BodyKey, new Vec2((float)pair.Pose.CenterX, (float)pair.Pose.CenterZ), (float)pair.Body!.GravityWellDepth, (float)pair.Body.GravityInfluenceRadius)).ToArray();
|
||||
var result = _simulator.Step(new SimulationStepRequest((float)deltaSeconds, new YmirWorld((float)zone.SimulationTimeSeconds, bodies, fields)));
|
||||
int Index(string id) => int.TryParse(id.AsSpan(Prefix.Length), out var value) ? value : -1;
|
||||
return new AetheriaRuntimeWorldStep(
|
||||
result.World.Bodies.Select(body => new AetheriaRuntimeWorldBodyStep { EntityIndex = Index(body.Id), PositionX = body.Position.X, PositionZ = body.Position.Y, VelocityX = body.Velocity.X, VelocityY = body.Velocity.Y, DirectionX = body.Direction?.X ?? 0, DirectionY = body.Direction?.Y ?? 1 }).ToArray(),
|
||||
result.Contacts.Select(contact => new AetheriaRuntimeWorldContact { EntityAIndex = Index(contact.BodyA), EntityBIndex = Index(contact.BodyB), PointX = contact.Point.X, PointZ = contact.Point.Y, NormalX = contact.Normal.X, NormalZ = contact.Normal.Y, RelativeSpeed = contact.RelativeSpeed }).ToArray());
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ using System.Net.Sockets;
|
|||
var options = AetheriaDaemonHostOptions.Parse(args);
|
||||
var startedAtUtc = DateTimeOffset.UtcNow.ToString("O");
|
||||
var projectilePhysics = new AetheriaYmirProjectilePhysics();
|
||||
var worldPhysics = new AetheriaYmirWorldPhysics();
|
||||
|
||||
Console.WriteLine($"Aetheria Verse daemon starting: {options.StatePath}");
|
||||
Console.WriteLine(options.EnableOdinAnnouncements
|
||||
|
|
@ -44,7 +45,7 @@ using var cultMeshRudpHost = StartClientCultMeshHost(node, options, () => latest
|
|||
using var clientPumpCancellation = new CancellationTokenSource();
|
||||
var clientPump = RunClientCultMeshPumpAsync(cultMeshRudpHost, clientPumpCancellation.Token);
|
||||
var nextApiPublicationUtc = DateTimeOffset.UtcNow;
|
||||
var firstTick = await TickAsync(node, options, projectilePhysics, latestFrame, buildPublications: true).ConfigureAwait(false);
|
||||
var firstTick = await TickAsync(node, options, projectilePhysics, worldPhysics, latestFrame, buildPublications: true).ConfigureAwait(false);
|
||||
ThrowIfClientPumpFaulted(clientPump);
|
||||
latestFrame = firstTick.Frame;
|
||||
nextApiPublicationUtc = DateTimeOffset.UtcNow.Add(options.ApiPublicationInterval);
|
||||
|
|
@ -81,7 +82,7 @@ while (!stopped.Task.IsCompleted)
|
|||
}
|
||||
|
||||
var buildPublications = DateTimeOffset.UtcNow >= nextApiPublicationUtc;
|
||||
var tick = await TickAsync(node, options, projectilePhysics, latestFrame, buildPublications).ConfigureAwait(false);
|
||||
var tick = await TickAsync(node, options, projectilePhysics, worldPhysics, latestFrame, buildPublications).ConfigureAwait(false);
|
||||
ThrowIfClientPumpFaulted(clientPump);
|
||||
latestFrame = tick.Frame;
|
||||
nextTickUtc += options.TickInterval;
|
||||
|
|
@ -117,6 +118,7 @@ static async Task<AetheriaRuntimeDaemonTickResult> TickAsync(
|
|||
AetheriaStateNode node,
|
||||
AetheriaDaemonHostOptions options,
|
||||
IAetheriaRuntimeProjectilePhysics projectilePhysics,
|
||||
IAetheriaRuntimeWorldPhysics worldPhysics,
|
||||
AetheriaRuntimeDaemonFrameDocument? currentFrame,
|
||||
bool buildPublications)
|
||||
{
|
||||
|
|
@ -185,6 +187,7 @@ static async Task<AetheriaRuntimeDaemonTickResult> TickAsync(
|
|||
RenderSettings = options.RenderSettings,
|
||||
SimulationSettings = options.SimulationSettings,
|
||||
ProjectilePhysics = projectilePhysics,
|
||||
WorldPhysics = worldPhysics,
|
||||
StarbridgeScenario = starbridgeScenario,
|
||||
StarbridgeSession = starbridgeSession,
|
||||
BuildPublications = buildPublications,
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ These files define the deprecated reference surface. They should be treated as A
|
|||
| SoA documents | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSoaDocuments.cs` | SoA backends, sync modes, column ids, dirty ranges, render groups. |
|
||||
| Command application | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperations.cs` | Current meaning of every gameplay command and rejection. |
|
||||
| Tick composition | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs` | Current order of command filtering, operation execution, sim step, frame creation, publication payloads. |
|
||||
| Daemon sim | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSimulation.cs` | Existing movement, hostile AI, combat, heat, and contact rules. |
|
||||
| Daemon sim | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSimulation.cs` | Gameplay intents, hostile AI, combat meaning, heat, and projection of mandatory Ymir world results. |
|
||||
| Ymir world adapter | `Aetheria.State.Daemon/AetheriaYmirWorldPhysics.cs` | Entity bodies, radial fields, collision resolution, and authoritative position/velocity advancement. |
|
||||
| Game viewport documents | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeGameViewportDocuments.cs` | Existing map, object, gravity, selected object, docking, refit, sector, and inventory projections. |
|
||||
| Client facade | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaClient.cs` | C# client observation and typed operation ergonomics. |
|
||||
| Verse client | `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeVerseClient.cs` | Current lower-level typed document reads/watches and command submission. |
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
task.Phase = "offload";
|
||||
var homeDx = home.PositionX - agent.PositionX;
|
||||
var homeDz = home.PositionZ - agent.PositionZ;
|
||||
if (Math.Sqrt(homeDx * homeDx + homeDz * homeDz) > Math.Max(0.01, task.CompletionRadius))
|
||||
if (Math.Max(0, Math.Sqrt(homeDx * homeDx + homeDz * homeDz) - InteractionRadius(agent) - InteractionRadius(home)) > Math.Max(0.01, task.CompletionRadius))
|
||||
return new[] { Movement(task, agent, frameId, homeDx, homeDz, 1) };
|
||||
|
||||
var commodity = (agent.CargoContents ?? Array.Empty<AetheriaRuntimeCargoBayLoadoutCommit>())
|
||||
|
|
@ -429,7 +429,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
var dx = endpoint.PositionX - agent.PositionX;
|
||||
var dz = endpoint.PositionZ - agent.PositionZ;
|
||||
var distance = Math.Sqrt(dx * dx + dz * dz);
|
||||
var distance = Math.Max(0, Math.Sqrt(dx * dx + dz * dz) - InteractionRadius(agent) - InteractionRadius(endpoint));
|
||||
if (distance > Math.Max(0.01, task.CompletionRadius))
|
||||
return new[] { Movement(task, agent, frameId, dx, dz, 1) };
|
||||
|
||||
|
|
@ -563,6 +563,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
});
|
||||
}
|
||||
|
||||
private static double InteractionRadius(AetheriaRuntimeEntitySnapshotCommit entity) =>
|
||||
string.Equals(entity.Kind, "station", StringComparison.OrdinalIgnoreCase) ? 48 : 20;
|
||||
|
||||
private static AetheriaRuntimeDaemonCommandDocument Command(
|
||||
AetheriaRuntimeAgentTaskCommit task,
|
||||
AetheriaRuntimeEntitySnapshotCommit agent,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
double deltaSeconds,
|
||||
AetheriaRuntimeDaemonSimulationSettings settings,
|
||||
IAetheriaRuntimeProjectilePhysics projectilePhysics,
|
||||
IAetheriaRuntimeWorldPhysics worldPhysics,
|
||||
AetheriaRuntimeCatalogSnapshot? catalog = null,
|
||||
long frameId = 0,
|
||||
double simulationTimeSeconds = 0)
|
||||
|
|
@ -26,6 +27,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return;
|
||||
if (projectilePhysics == null)
|
||||
throw new ArgumentNullException(nameof(projectilePhysics));
|
||||
if (worldPhysics == null)
|
||||
throw new ArgumentNullException(nameof(worldPhysics));
|
||||
|
||||
foreach (var zone in run.Zones ?? Array.Empty<AetheriaRuntimeZoneSnapshotCommit>())
|
||||
{
|
||||
|
|
@ -45,7 +48,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
ApplyMovementIntent(run, entities, movement, settings);
|
||||
StepRaiderAi(entities);
|
||||
StepTargetPursuit(entities, settings);
|
||||
StepMovement(entities, deltaSeconds);
|
||||
StepWorldPhysics(zone, entities, deltaSeconds, worldPhysics);
|
||||
StepCombat(run, zone, entities, intents, deltaSeconds, settings, projectilePhysics);
|
||||
AetheriaRuntimeMiningSimulation.Step(run, zone, entities, intents, catalog, frameId, simulationTimeSeconds, deltaSeconds);
|
||||
AetheriaRuntimeSurveySimulation.Step(run, zone, entities, intents, catalog, frameId, simulationTimeSeconds, deltaSeconds);
|
||||
|
|
@ -162,21 +165,20 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
}
|
||||
|
||||
private static void StepMovement(
|
||||
private static void StepWorldPhysics(
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities,
|
||||
double deltaSeconds)
|
||||
double deltaSeconds,
|
||||
IAetheriaRuntimeWorldPhysics worldPhysics)
|
||||
{
|
||||
foreach (var entity in entities)
|
||||
var result = worldPhysics.Step(zone, entities, deltaSeconds);
|
||||
var byIndex = entities.ToDictionary(entity => entity.EntityIndex);
|
||||
foreach (var body in result.Bodies)
|
||||
{
|
||||
if (!IsAlive(entity))
|
||||
continue;
|
||||
|
||||
entity.PositionX += entity.VelocityX * deltaSeconds;
|
||||
entity.PositionZ += entity.VelocityY * deltaSeconds;
|
||||
entity.VelocityX *= 0.992;
|
||||
entity.VelocityY *= 0.992;
|
||||
if (Math.Abs(entity.VelocityX) + Math.Abs(entity.VelocityY) > 0.01)
|
||||
Face(entity, entity.VelocityX, entity.VelocityY);
|
||||
if (!byIndex.TryGetValue(body.EntityIndex, out var entity)) continue;
|
||||
entity.PositionX = body.PositionX; entity.PositionZ = body.PositionZ;
|
||||
entity.VelocityX = body.VelocityX; entity.VelocityY = body.VelocityY;
|
||||
entity.DirectionX = body.DirectionX; entity.DirectionY = body.DirectionY;
|
||||
}
|
||||
foreach (var parent in entities)
|
||||
foreach (var childIndex in parent.ChildEntityIndices ?? Array.Empty<int>())
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault;
|
||||
public IAetheriaRuntimeProjectilePhysics ProjectilePhysics { get; set; } =
|
||||
AetheriaRuntimeProjectilePhysicsUnavailable.Instance;
|
||||
public IAetheriaRuntimeWorldPhysics? WorldPhysics { get; set; }
|
||||
public bool BuildPublications { get; set; } = true;
|
||||
}
|
||||
|
||||
|
|
@ -163,6 +164,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
options.FixedDeltaSeconds,
|
||||
options.SimulationSettings,
|
||||
options.ProjectilePhysics,
|
||||
options.WorldPhysics ?? throw new InvalidOperationException("Ymir world physics owner is required."),
|
||||
options.Catalog,
|
||||
options.FrameId,
|
||||
options.SimulationTimeSeconds);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace GameCult.Aetheria.State.Verse
|
||||
{
|
||||
public interface IAetheriaRuntimeWorldPhysics
|
||||
{
|
||||
string AuthorityId { get; }
|
||||
AetheriaRuntimeWorldStep Step(AetheriaRuntimeZoneSnapshotCommit zone, IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities, double deltaSeconds);
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeWorldStep
|
||||
{
|
||||
public AetheriaRuntimeWorldStep(IReadOnlyList<AetheriaRuntimeWorldBodyStep> bodies, IReadOnlyList<AetheriaRuntimeWorldContact> contacts)
|
||||
{ Bodies = bodies ?? Array.Empty<AetheriaRuntimeWorldBodyStep>(); Contacts = contacts ?? Array.Empty<AetheriaRuntimeWorldContact>(); }
|
||||
public IReadOnlyList<AetheriaRuntimeWorldBodyStep> Bodies { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeWorldContact> Contacts { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeWorldBodyStep
|
||||
{
|
||||
public int EntityIndex { get; set; } = -1;
|
||||
public double PositionX { get; set; }
|
||||
public double PositionZ { get; set; }
|
||||
public double VelocityX { get; set; }
|
||||
public double VelocityY { get; set; }
|
||||
public double DirectionX { get; set; }
|
||||
public double DirectionY { get; set; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeWorldContact
|
||||
{
|
||||
public int EntityAIndex { get; set; } = -1;
|
||||
public int EntityBIndex { get; set; } = -1;
|
||||
public double PointX { get; set; }
|
||||
public double PointZ { get; set; }
|
||||
public double NormalX { get; set; }
|
||||
public double NormalZ { get; set; }
|
||||
public double RelativeSpeed { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -17,8 +17,8 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
|
|||
|---|---|---|---|---|---|---|
|
||||
| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement | all clients | owner-exists; wired; projected; not proven | restart and multi-client convergence |
|
||||
| Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | owner-exists; wired; projected; not proven | loadout round trip and reconnect |
|
||||
| Flight intent | `Ship`, `Thruster`, `AetherDrive`, input paths | daemon intent + Ymir physics | analog movement/look/tractor | EveUnity input driver | simplified daemon path wired; Ymir not wired | thrust allocation, torque, energy, heat, drag and gravity |
|
||||
| Collision | Unity physics and entity handlers | Ymir | collision/result facts | visual interpolation only | owner-exists; not wired; not exclusive | link Aetheria to Ymir.Core/service, share one world, and fail old-writer negative checks |
|
||||
| Flight intent | `Ship`, `Thruster`, `AetherDrive`, input paths | daemon intent + Ymir physics | analog movement/look/tractor | EveUnity input driver | movement intents feed Ymir-owned body integration; authored thrust allocation, torque, energy and heat remain simplified | prove original drive/equipment behavior ordering and runtime interpolation |
|
||||
| Collision | Unity physics and entity handlers | Ymir | collision/result facts | visual interpolation only | Ymir.Core world stepping wired for entity bodies, radial fields and contacts; missing-owner negative proof passes | publish authoritative collision events and prove Unity cannot write transforms back |
|
||||
| Targeting/contacts | sensors + `ActionGameManager` | daemon | contact/target semantics | target HUD and indicators | simplified owner wired/projected; not parity | visibility/nearest/explicit/lock cases |
|
||||
| Projectile flight | weapon/projectile classes | Ymir | projectile entity/event projection | native projectile visual | Ymir.Core adapter wired for spawn/travel/contact/despawn; native presentation and broader weapon parity incomplete | prove every authored projectile family and runtime visual lifecycle |
|
||||
| Shield/hull damage | energy-funded shield, armor cells, equipment and hull | daemon | entity status + damage events | meters, impacts, damage VFX | synthetic scalar owner wired; not parity | typed absorption, penetration, item damage and death causes |
|
||||
|
|
@ -78,9 +78,10 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
|
|||
|
||||
These are source-confirmed ownership failures, not feature backlog:
|
||||
|
||||
1. **Physics delegation is incomplete.** Daemon projectile integration and
|
||||
contacts now use `Ymir.Core`, but ship flight, tractor, gravity, docking
|
||||
placement, and the Unity bridge/query path remain outside that authority.
|
||||
1. **Physics delegation is incomplete.** Daemon projectile and entity-world
|
||||
integration now use `Ymir.Core`, including radial fields and body contacts,
|
||||
but tractor forces, docking placement, authored drive torque, and the Unity
|
||||
bridge/query path still need full authority and parity proofs.
|
||||
2. **Persisted behavior is not executable behavior.** Snapshot schemas preserve
|
||||
broad equipment/behavior state while active simulation executes one
|
||||
synthetic projectile weapon and simplified raider pursuit.
|
||||
|
|
@ -94,9 +95,10 @@ These are source-confirmed ownership failures, not feature backlog:
|
|||
encounter, loot, docking, trade, refit, narrative, boss progression,
|
||||
completion, failure, and continue exist as pieces rather than one explicit
|
||||
run-state machine.
|
||||
6. **Two Aetheria-local spatial owners.** Daemon ship movement and the
|
||||
Unity bridge/query path independently implement Ymir-shaped behavior and can
|
||||
disagree while standalone Ymir remains unwired.
|
||||
6. **Unity spatial feedback remains insufficiently fenced.** The daemon now
|
||||
requires Ymir for world advancement, but the Unity bridge/query path still
|
||||
needs a negative proof that presentation transforms cannot write spatial
|
||||
truth back into provider state.
|
||||
7. **Live conformance has no complete owner.** Static provider packs can pass
|
||||
while daemon, runtime, or split-target dependencies are absent. The current
|
||||
Eve consumer smoke fails because its expected EveElectron proof is missing.
|
||||
|
|
|
|||
Loading…
Reference in a new issue