Project daemon celestial world through Eve SoA

This commit is contained in:
Meta Vens 2026-07-16 04:41:27 +01:00
commit fc79a61ec9
9 changed files with 453 additions and 32 deletions

View file

@ -157,23 +157,29 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
component.Id == "aetheria.daemon.game.world");
var expectedPlayableWorldProps = new Dictionary<string, string>(StringComparer.Ordinal)
{
["cameraRig"] = "planar.top-down-follow.v1",
["cameraRig"] = "perspective.entity-forward-follow.v1",
["cameraTargetEntityId"] = entityKey.ToString(),
["cameraDistance"] = "150",
["cameraDistance"] = "30",
["cameraVerticalFieldOfViewDegrees"] = "60",
["cameraTargetScreenX"] = "0.9",
["cameraTargetScreenY"] = "0.55",
["cameraPositionDamping"] = "5",
["cameraNearClipPlane"] = "0.3",
["cameraTargetScreenX"] = "0.64",
["cameraTargetScreenY"] = "0.19",
["cameraPositionDamping"] = "0",
["cameraNearClipPlane"] = "1",
["cameraFarClipPlane"] = "4096",
["ambientLightColor"] = "0.2,0.2,0.2",
["ambientLightIntensity"] = "1"
["ambientLightIntensity"] = "1.46"
};
if (expectedPlayableWorldProps.Any(expected =>
var playableWorldMismatches = expectedPlayableWorldProps
.Where(expected =>
!playableWorld.Props.TryGetValue(expected.Key, out var actual) ||
!string.Equals(actual, expected.Value, StringComparison.Ordinal)))
!string.Equals(actual, expected.Value, StringComparison.Ordinal))
.Select(expected =>
$"{expected.Key}: expected '{expected.Value}', actual '{(playableWorld.Props.TryGetValue(expected.Key, out var actual) ? actual : "<missing>")}'")
.ToArray();
if (playableWorldMismatches.Length > 0)
{
throw new InvalidOperationException("Playable world did not publish the native camera and environment contract.");
throw new InvalidOperationException(
$"Playable world did not publish the native camera and environment contract: {string.Join("; ", playableWorldMismatches)}");
}
await node.MutableDocument<AetheriaRuntimeDaemonProviderAdvertisementDocument>(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement)
.ReplaceAsync(daemonProvider);
@ -797,17 +803,17 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
component.Id == "aetheria.daemon.game.world");
var expectedReopenedPlayableWorldProps = new Dictionary<string, string>(StringComparer.Ordinal)
{
["cameraRig"] = "planar.top-down-follow.v1",
["cameraRig"] = "perspective.entity-forward-follow.v1",
["cameraTargetEntityId"] = entityKey.ToString(),
["cameraDistance"] = "150",
["cameraDistance"] = "30",
["cameraVerticalFieldOfViewDegrees"] = "60",
["cameraTargetScreenX"] = "0.9",
["cameraTargetScreenY"] = "0.55",
["cameraPositionDamping"] = "5",
["cameraNearClipPlane"] = "0.3",
["cameraTargetScreenX"] = "0.64",
["cameraTargetScreenY"] = "0.19",
["cameraPositionDamping"] = "0",
["cameraNearClipPlane"] = "1",
["cameraFarClipPlane"] = "4096",
["ambientLightColor"] = "0.2,0.2,0.2",
["ambientLightIntensity"] = "1"
["ambientLightIntensity"] = "1.46"
};
if (expectedReopenedPlayableWorldProps.Any(expected =>
!reopenedPlayableWorld.Props.TryGetValue(expected.Key, out var actual) ||
@ -993,6 +999,7 @@ static async Task ProveDirectSoaPublicationPipeline()
DaemonId = "aetheria-daemon",
SessionId = "soa-pipeline-smoke",
FrameId = 41,
SimulationTimeSeconds = 4,
Run = new AetheriaRuntimeRunCheckpointCommit
{
RunId = "soa-pipeline-smoke",
@ -1041,6 +1048,37 @@ static async Task ProveDirectSoaPublicationPipeline()
Active = true,
Stationary = true
}
],
Bodies =
[
new AetheriaRuntimeBodySnapshotCommit
{
BodyKey = "body:soa-sun",
Name = "SoA Sun",
Kind = "sun",
Mass = 100,
BodyRadiusMultiplier = 1,
GravityInfluenceCenterX = 20,
GravityInfluenceCenterZ = 30
},
new AetheriaRuntimeBodySnapshotCommit
{
BodyKey = "body:soa-belt",
Name = "SoA Belt",
Kind = "asteroid_belt",
GravityInfluenceCenterX = 40,
GravityInfluenceCenterZ = 50,
Asteroids =
[
new AetheriaRuntimeAsteroidCommit
{
Distance = 5,
Phase = 0,
Size = 2,
RotationSpeed = 0.25
}
]
}
]
}
]
@ -1053,11 +1091,19 @@ static async Task ProveDirectSoaPublicationPipeline()
string.Equals(identity.EntityId, "soa-pipeline-smoke:zone:0:physical-payload:mine:soa-witness", StringComparison.Ordinal));
var pickupIdentity = built.View.Identities.Single(identity =>
string.Equals(identity.EntityId, "pickup:0:3", StringComparison.Ordinal));
var sunIdentity = built.View.Identities.Single(identity =>
string.Equals(identity.Kind, "celestial.sun", StringComparison.Ordinal));
var asteroidIdentity = built.View.Identities.Single(identity =>
string.Equals(identity.Kind, "celestial.asteroid", StringComparison.Ordinal));
if (payloadIdentity == null || !string.Equals(payloadIdentity.AssetRef, "prefab.entity.mine", StringComparison.Ordinal) ||
!string.Equals(payloadIdentity.Kind, "physical-payload", StringComparison.Ordinal) || payloadIdentity.Selectable ||
payloadIdentity.EntityIndex >= -1 || pickupIdentity.EntityIndex >= -1 ||
payloadIdentity.EntityIndex == pickupIdentity.EntityIndex ||
built.View.Columns.Any(column => column.ElementCount != 3))
sunIdentity.AssetRef != "prefab.body.sun" || asteroidIdentity.AssetRef != "prefab.body.asteroid" ||
sunIdentity.Selectable || asteroidIdentity.Selectable ||
new[] { payloadIdentity.EntityIndex, pickupIdentity.EntityIndex, sunIdentity.EntityIndex, asteroidIdentity.EntityIndex }
.Distinct().Count() != 4 ||
built.View.Columns.Any(column => column.ElementCount != 5))
throw new InvalidOperationException("Physical payload did not enter the authoritative SoA generation with its provider asset identity.");
if (cache.Get<EveEntitySoaViewDocument>(AetheriaRuntimeVerseRecordKeys.EveEntitySoaViewLatest) != null)
throw new InvalidOperationException("SoA view became visible before its body publication.");
@ -1070,8 +1116,12 @@ static async Task ProveDirectSoaPublicationPipeline()
var nextBuilt = publisher.BuildCurrentZoneEntities(frame);
var nextPayloadIdentity = nextBuilt.View.Identities.Single(identity => identity.EntityId == payloadIdentity.EntityId);
var nextPickupIdentity = nextBuilt.View.Identities.Single(identity => identity.EntityId == pickupIdentity.EntityId);
var nextSunIdentity = nextBuilt.View.Identities.Single(identity => identity.EntityId == sunIdentity.EntityId);
var nextAsteroidIdentity = nextBuilt.View.Identities.Single(identity => identity.EntityId == asteroidIdentity.EntityId);
if (nextPayloadIdentity.EntityIndex != payloadIdentity.EntityIndex ||
nextPickupIdentity.EntityIndex != pickupIdentity.EntityIndex)
nextPickupIdentity.EntityIndex != pickupIdentity.EntityIndex ||
nextSunIdentity.EntityIndex != sunIdentity.EntityIndex ||
nextAsteroidIdentity.EntityIndex != asteroidIdentity.EntityIndex)
throw new InvalidOperationException("Synthetic SoA identity changed across immutable generations in one producer epoch.");
var next = await publisher.PublishAsync(nextBuilt);
if (published.Body.RecordKey.Equals(next.Body.RecordKey))
@ -1147,6 +1197,10 @@ static async Task ProveDirectSoaPublicationPipeline()
var networkPayloadEntityIndex = ReadInt32(view, networkLease, "entity.index", 2);
var localPayloadPosition = ReadFloat3(view, localLease, "transform.position", 2);
var networkPayloadPosition = ReadFloat3(view, networkLease, "transform.position", 2);
var localSunPosition = ReadFloat3(view, localLease, "transform.position", 3);
var networkSunPosition = ReadFloat3(view, networkLease, "transform.position", 3);
var localAsteroidPosition = ReadFloat3(view, localLease, "transform.position", 4);
var networkAsteroidPosition = ReadFloat3(view, networkLease, "transform.position", 4);
var identity = view.Identities.Single(candidate => candidate.Index == localEntityIndex);
if (localLease.TransportKind != CultMeshBodyTransportKind.SharedMemory ||
networkLease.TransportKind != CultMeshBodyTransportKind.Network ||
@ -1155,6 +1209,9 @@ static async Task ProveDirectSoaPublicationPipeline()
localPayloadEntityIndex != payloadIdentity.EntityIndex ||
networkPayloadEntityIndex != localPayloadEntityIndex ||
localPayloadPosition != (9f, 0f, 11f) || networkPayloadPosition != localPayloadPosition ||
localSunPosition.X != 20f || localSunPosition.Z != 30f || networkSunPosition != localSunPosition ||
localAsteroidPosition.X != 45f || localAsteroidPosition.Z != 50f ||
networkAsteroidPosition != localAsteroidPosition ||
identity.EntityId != "ship:soa-witness" || identity.Label != "SoA Witness")
throw new InvalidOperationException("Local and network SoA views were not logically equivalent.");

View file

@ -9,6 +9,6 @@
"org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.14",
"org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.2.3",
"org.gamecult.eve.surface": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.2",
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.50"
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.51"
}
}

View file

@ -144,7 +144,7 @@
"hash": "140e1bd963a0033e66777a3b2c5fe6e9c97dfe32"
},
"org.gamecult.eve.unity-scene": {
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.50",
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.51",
"depth": 0,
"source": "git",
"dependencies": {
@ -155,7 +155,7 @@
"com.unity.render-pipelines.universal": "17.4.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"hash": "7c8442e12264806a53a9e0e08b7b090dcddb8c90"
"hash": "21ac39e7bdfca9d81a0b7d89834f7e9da60aaad6"
},
"com.unity.modules.assetbundle": {
"version": "1.0.0",

View file

@ -95,6 +95,7 @@ namespace Aetheria.Editor
var root = PrefabUtility.LoadPrefabContents(sourcePath);
try
{
KeepAdvertisedPresentationVisual(root, entry);
ExtractExternalizedEffects(root, entry.Ref.AssetKey);
StripNonPresentationScripts(root);
StripPresentationPhysics(root);
@ -113,6 +114,23 @@ namespace Aetheria.Editor
VerifyPrefab(savedRoot, outputPath);
}
private static void KeepAdvertisedPresentationVisual(
GameObject root,
AetheriaRuntimeAssetManifestEntry entry)
{
if (!entry.Ref.Metadata.TryGetValue("presentationVisualPath", out var visualPath) ||
string.IsNullOrWhiteSpace(visualPath))
return;
var visual = root.transform.Find(visualPath);
if (visual == null)
throw new InvalidOperationException(
$"Prefab {entry.Ref.AssetKey} has no advertised presentation visual '{visualPath}'.");
foreach (var child in root.transform.Cast<Transform>().Where(child => child != visual).ToArray())
UnityEngine.Object.DestroyImmediate(child.gameObject, true);
}
private static void ExtractExternalizedEffects(GameObject root, string assetKey)
{
if (!string.Equals(assetKey, "prefab.entity.player", StringComparison.Ordinal) &&

View file

@ -47,6 +47,15 @@ namespace GameCult.Aetheria.State.Verse
Add(entries, MapPrefab("prefab.effect.beam.tractor", "Tractor beam", "Prefabs/Tractor Beam", "effect.beam.tractor"));
Add(entries, DestructionEffect());
Add(entries, MapProjectPrefab("prefab.entity.pickup", "Pickup", "Assets/Prefabs/RPG/Pickups/Tetrahedron.prefab"));
Add(entries, MapCelestialPrefab(
"prefab.body.planet", "Planet", "Assets/Prefabs/RPG/Planets/Planet.prefab", "Terrain Mesh", "celestial.planet"));
Add(entries, MapCelestialPrefab(
"prefab.body.gas-giant", "Gas Giant", "Assets/Prefabs/RPG/Planets/Gas Giant.prefab", "Sphere", "celestial.gas-giant"));
Add(entries, MapCelestialPrefab(
"prefab.body.sun", "Sun", "Assets/Prefabs/RPG/Planets/Sun.prefab", "Sphere", "celestial.sun"));
Add(entries, MapCelestialPrefab(
"prefab.body.asteroid", "Asteroid",
"Assets/Plugins/LowPoly_AsteroidsPack/Prefabs/Asteroid_Huge_v01.prefab", "", "celestial.asteroid"));
Add(entries, MinePrefab());
foreach (var profile in ThermalPresentationProfiles()) Add(entries, profile);
foreach (var inventoryAsset in InventoryUiAssets())
@ -379,6 +388,23 @@ namespace GameCult.Aetheria.State.Verse
};
}
private static AetheriaRuntimeAssetManifestEntry MapCelestialPrefab(
string key,
string label,
string unityAssetPath,
string presentationVisualPath,
string presentationRole)
{
var entry = MapProjectPrefab(key, label, unityAssetPath);
var metadata = entry.Ref.Metadata.ToDictionary(pair => pair.Key, pair => pair.Value, StringComparer.Ordinal);
metadata["presentationRole"] = presentationRole ?? "";
if (!string.IsNullOrWhiteSpace(presentationVisualPath))
metadata["presentationVisualPath"] = presentationVisualPath;
entry.Ref.Metadata = metadata;
entry.Tags = new[] { "world", "prefab", "celestial", label };
return entry;
}
private static AetheriaRuntimeAssetManifestEntry MapProjectAsset(
string key, string kind, string label, string unityAssetPath, string presentationRole)
{

View file

@ -111,6 +111,8 @@ namespace GameCult.Aetheria.State.Verse
.Where(payload => payload != null && payload.Active)
.OrderBy(payload => payload.PayloadId, StringComparer.Ordinal)
.ToArray();
var celestialBodies = BuildCelestialBodies(frame, zone);
var asteroidInstances = BuildAsteroidInstances(frame, zone);
var unsupportedPayload = payloads.FirstOrDefault(payload =>
!string.Equals(payload.PayloadKind, "mine", StringComparison.Ordinal));
if (unsupportedPayload != null)
@ -122,14 +124,19 @@ namespace GameCult.Aetheria.State.Verse
var payloadEntityIds = payloads
.Select(payload => $"{run.RunId}:zone:{run.CurrentZoneIndex}:physical-payload:{payload.PayloadId}")
.ToArray();
var syntheticEntityIds = pickupEntityIds.Concat(payloadEntityIds).ToArray();
var syntheticEntityIds = pickupEntityIds
.Concat(payloadEntityIds)
.Concat(celestialBodies.Select(value => value.EntityId))
.Concat(asteroidInstances.Select(value => value.EntityId))
.ToArray();
if (syntheticEntityIds.Distinct(StringComparer.Ordinal).Count() != syntheticEntityIds.Length)
throw new InvalidOperationException("Current-zone synthetic SoA entity identities are not unique.");
var syntheticEntityIndices = syntheticEntityIds.ToDictionary(
entityId => entityId,
GetOrAllocateSyntheticEntityIndex,
StringComparer.Ordinal);
var count = entities.Length + pickups.Length + payloads.Length;
var count = entities.Length + pickups.Length + payloads.Length +
celestialBodies.Count + asteroidInstances.Count;
if (count > Capacity)
throw new InvalidOperationException($"Aetheria entity SoA capacity {Capacity} was exceeded by {count} rows.");
var generation = Math.Max(frame.FrameId, 0);
@ -138,6 +145,18 @@ namespace GameCult.Aetheria.State.Verse
WriteEntities(bytes, layout, entities);
WritePickups(bytes, layout, pickups, pickupEntityIds, syntheticEntityIndices, entities.Length);
WritePayloads(bytes, layout, payloads, payloadEntityIds, syntheticEntityIndices, entities.Length + pickups.Length);
WriteCelestialBodies(
bytes,
layout,
celestialBodies,
syntheticEntityIndices,
entities.Length + pickups.Length + payloads.Length);
WriteAsteroidInstances(
bytes,
layout,
asteroidInstances,
syntheticEntityIndices,
entities.Length + pickups.Length + payloads.Length + celestialBodies.Count);
var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
string.IsNullOrWhiteSpace(frame.DaemonId) ? "aetheria-daemon" : frame.DaemonId,
@ -161,7 +180,7 @@ namespace GameCult.Aetheria.State.Verse
layout.CreateDirtyRanges(count, generation),
backend: AetheriaRuntimeDaemonSoaBackends.CultMesh,
synchronizationMode: AetheriaRuntimeDaemonSoaSynchronizationModes.ImmutableFrame,
renderGroups: CreateRenderGroups(entities, pickups, payloads),
renderGroups: CreateRenderGroups(entities, pickups, payloads, celestialBodies, asteroidInstances),
identities: entities.Select(entity => new AetheriaRuntimeDaemonSoaIdentityDocument
{
EntityIndex = entity.EntityIndex,
@ -195,6 +214,28 @@ namespace GameCult.Aetheria.State.Verse
Controllable = false,
AssetRef = "prefab.entity.mine"
}))
.Concat(celestialBodies.Select(value => new AetheriaRuntimeDaemonSoaIdentityDocument
{
EntityIndex = syntheticEntityIndices[value.EntityId],
EntityId = value.EntityId,
Kind = value.EntityKind,
Label = value.Label,
Faction = "",
Selectable = false,
Controllable = false,
AssetRef = value.AssetRef
}))
.Concat(asteroidInstances.Select(value => new AetheriaRuntimeDaemonSoaIdentityDocument
{
EntityIndex = syntheticEntityIndices[value.EntityId],
EntityId = value.EntityId,
Kind = "celestial.asteroid",
Label = "Asteroid",
Faction = "",
Selectable = false,
Controllable = false,
AssetRef = "prefab.body.asteroid"
}))
.ToArray());
return new AetheriaRuntimeDaemonSoaFrame(view, bytes);
@ -248,14 +289,19 @@ namespace GameCult.Aetheria.State.Verse
private static IReadOnlyList<AetheriaRuntimeDaemonRenderGroupDocument> CreateRenderGroups(
IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities,
IReadOnlyList<AetheriaRuntimeDroppedPickupCommit> pickups,
IReadOnlyList<AetheriaRuntimePhysicalPayloadCommit> payloads)
IReadOnlyList<AetheriaRuntimePhysicalPayloadCommit> payloads,
IReadOnlyList<CelestialBodyPresentation> celestialBodies,
IReadOnlyList<AsteroidPresentation> asteroidInstances)
{
if (entities.Count == 0 && pickups.Count == 0 && payloads.Count == 0)
if (entities.Count == 0 && pickups.Count == 0 && payloads.Count == 0 &&
celestialBodies.Count == 0 && asteroidInstances.Count == 0)
return Array.Empty<AetheriaRuntimeDaemonRenderGroupDocument>();
var positions = entities.Select(entity => (entity.PositionX, entity.PositionY, entity.PositionZ))
.Concat(pickups.Select(pickup => (pickup.PositionX, pickup.PositionY, pickup.PositionZ)))
.Concat(payloads.Select(payload => (payload.PositionX, PositionY: payload.PositionY, payload.PositionZ)))
.Concat(celestialBodies.Select(value => (value.PositionX, value.PositionY, value.PositionZ)))
.Concat(asteroidInstances.Select(value => (value.PositionX, value.PositionY, value.PositionZ)))
.ToArray();
var minX = positions.Min(position => (float)position.PositionX);
var minY = positions.Min(position => (float)position.PositionY);
@ -286,7 +332,8 @@ namespace GameCult.Aetheria.State.Verse
Layer = 0,
ShaderKey = "aetheria.daemon.entity-proxy",
DisplayName = "Daemon current-zone entities",
InstanceCount = entities.Count + pickups.Count + payloads.Count,
InstanceCount = entities.Count + pickups.Count + payloads.Count +
celestialBodies.Count + asteroidInstances.Count,
BoundsCenterX = (minX + maxX) * 0.5f,
BoundsCenterY = (minY + maxY) * 0.5f,
BoundsCenterZ = (minZ + maxZ) * 0.5f,
@ -378,6 +425,180 @@ namespace GameCult.Aetheria.State.Verse
}
}
private static IReadOnlyList<CelestialBodyPresentation> BuildCelestialBodies(
AetheriaRuntimeDaemonFrameDocument frame,
AetheriaRuntimeZoneSnapshotCommit? zone)
{
if (zone == null)
return Array.Empty<CelestialBodyPresentation>();
var poses = AetheriaRuntimeDaemonRenderQueries.QueryBodyPoses(zone)
.ToDictionary(pose => pose.BodyKey, StringComparer.Ordinal);
var values = new List<CelestialBodyPresentation>();
foreach (var body in zone.Bodies ?? Array.Empty<AetheriaRuntimeBodySnapshotCommit>())
{
if (body == null ||
string.Equals(body.Kind, "asteroid_belt", StringComparison.OrdinalIgnoreCase) ||
string.IsNullOrWhiteSpace(body.BodyKey) ||
!poses.TryGetValue(body.BodyKey, out var pose))
continue;
var scale = Math.Max(
0.1,
frame.RenderSettings.ResolveBodyRadius(body.Mass) * Math.Max(0, body.BodyRadiusMultiplier));
var terrainHeight = AetheriaRuntimeDaemonRenderQueries.EvaluateGravityTerrainHeight(
zone,
pose.CenterX,
pose.CenterZ,
frame.SimulationTimeSeconds);
var kind = NormalizeCelestialKind(body.Kind);
values.Add(new CelestialBodyPresentation(
$"{frame.Run.RunId}:zone:{zone.ZoneIndex}:body:{body.BodyKey}",
kind,
string.IsNullOrWhiteSpace(body.Name) ? body.BodyKey : body.Name,
ResolveCelestialAssetRef(kind),
pose.CenterX,
terrainHeight + scale * 2.0,
pose.CenterZ,
frame.SimulationTimeSeconds * frame.RenderSettings.PlanetRotationSpeed * Math.PI / 180.0,
scale));
}
return values;
}
private static IReadOnlyList<AsteroidPresentation> BuildAsteroidInstances(
AetheriaRuntimeDaemonFrameDocument frame,
AetheriaRuntimeZoneSnapshotCommit? zone)
{
if (zone == null)
return Array.Empty<AsteroidPresentation>();
var values = new List<AsteroidPresentation>();
foreach (var belt in zone.Bodies ?? Array.Empty<AetheriaRuntimeBodySnapshotCommit>())
{
if (belt == null ||
!string.Equals(belt.Kind, "asteroid_belt", StringComparison.OrdinalIgnoreCase) ||
string.IsNullOrWhiteSpace(belt.BodyKey))
continue;
foreach (var pose in AetheriaRuntimeDaemonRenderQueries.QueryAsteroidInstancePoses(
zone,
belt.BodyKey,
frame.SimulationTimeSeconds))
{
if (pose.Size <= 0)
continue;
var terrainHeight = AetheriaRuntimeDaemonRenderQueries.EvaluateGravityTerrainHeight(
zone,
pose.PositionX,
pose.PositionZ,
frame.SimulationTimeSeconds);
values.Add(new AsteroidPresentation(
$"{frame.Run.RunId}:zone:{zone.ZoneIndex}:asteroid:{belt.BodyKey}:{pose.AsteroidIndex}",
pose.PositionX,
terrainHeight + frame.RenderSettings.AsteroidVerticalOffset,
pose.PositionZ,
pose.Rotation,
pose.Size));
}
}
return values;
}
private static string NormalizeCelestialKind(string? kind)
{
var normalized = (kind ?? "").Trim().ToLowerInvariant().Replace('_', '-');
return normalized switch
{
"sun" => "sun",
"gas-giant" => "gas-giant",
_ => "planet"
};
}
private static string ResolveCelestialAssetRef(string kind)
{
return kind switch
{
"sun" => "prefab.body.sun",
"gas-giant" => "prefab.body.gas-giant",
_ => "prefab.body.planet"
};
}
private static void WriteCelestialBodies(
byte[] bytes,
EntityHotSlabLayout layout,
IReadOnlyList<CelestialBodyPresentation> values,
IReadOnlyDictionary<string, int> syntheticEntityIndices,
int rowOffset)
{
for (var valueIndex = 0; valueIndex < values.Count; valueIndex++)
{
var value = values[valueIndex];
var row = rowOffset + valueIndex;
WritePresentationRow(
bytes,
layout,
row,
syntheticEntityIndices[value.EntityId],
value.PositionX,
value.PositionY,
value.PositionZ,
value.RotationRadians,
value.Scale);
}
}
private static void WriteAsteroidInstances(
byte[] bytes,
EntityHotSlabLayout layout,
IReadOnlyList<AsteroidPresentation> values,
IReadOnlyDictionary<string, int> syntheticEntityIndices,
int rowOffset)
{
for (var valueIndex = 0; valueIndex < values.Count; valueIndex++)
{
var value = values[valueIndex];
var row = rowOffset + valueIndex;
WritePresentationRow(
bytes,
layout,
row,
syntheticEntityIndices[value.EntityId],
value.PositionX,
value.PositionY,
value.PositionZ,
value.RotationRadians,
value.Scale);
}
}
private static void WritePresentationRow(
byte[] bytes,
EntityHotSlabLayout layout,
int row,
int entityIndex,
double positionX,
double positionY,
double positionZ,
double rotationRadians,
double scale)
{
WriteInt32(bytes, layout.EntityIndex + row * IntStride, entityIndex);
WriteInt32(bytes, layout.CargoQuantity + row * IntStride, 0);
WriteFloat3(bytes, layout.Position, row, positionX, positionY, positionZ);
WriteFloat(bytes, layout.RotationRadians, row, rotationRadians);
WriteFloat3(bytes, layout.Velocity, row, 0, 0, 0);
WriteFloat(bytes, layout.PhysicsBodyRadius, row, Math.Max(0.01, scale));
WriteFloat(bytes, layout.PhysicsBodyMass, row, 0);
WriteFloat(bytes, layout.PhysicsBodyInverseMass, row, 0);
WriteFloat(bytes, layout.RenderScale, row, Math.Max(0.01, scale));
bytes[checked((int)(layout.RenderVisibility + row * ByteStride))] = 1;
WriteInt32(bytes, layout.RenderLod + row * IntStride, 0);
WriteUInt32(bytes, layout.RenderGroupId + row * IntStride, EntityRenderGroupId);
}
private int GetOrAllocateSyntheticEntityIndex(string entityId)
{
if (_syntheticEntityIndices.TryGetValue(entityId, out var existing))
@ -390,6 +611,67 @@ namespace GameCult.Aetheria.State.Verse
return allocated;
}
private sealed class CelestialBodyPresentation
{
public CelestialBodyPresentation(
string entityId,
string kind,
string label,
string assetRef,
double positionX,
double positionY,
double positionZ,
double rotationRadians,
double scale)
{
EntityId = entityId;
EntityKind = "celestial." + kind;
Label = label;
AssetRef = assetRef;
PositionX = positionX;
PositionY = positionY;
PositionZ = positionZ;
RotationRadians = rotationRadians;
Scale = scale;
}
public string EntityId { get; }
public string EntityKind { get; }
public string Label { get; }
public string AssetRef { get; }
public double PositionX { get; }
public double PositionY { get; }
public double PositionZ { get; }
public double RotationRadians { get; }
public double Scale { get; }
}
private sealed class AsteroidPresentation
{
public AsteroidPresentation(
string entityId,
double positionX,
double positionY,
double positionZ,
double rotationRadians,
double scale)
{
EntityId = entityId;
PositionX = positionX;
PositionY = positionY;
PositionZ = positionZ;
RotationRadians = rotationRadians;
Scale = scale;
}
public string EntityId { get; }
public double PositionX { get; }
public double PositionY { get; }
public double PositionZ { get; }
public double RotationRadians { get; }
public double Scale { get; }
}
private static void WriteFloat(byte[] bytes, long byteOffset, int index, double value)
{
WriteBytes(bytes, byteOffset + index * FloatStride, BitConverter.GetBytes(IsFinite(value) ? (float)value : 0.0f));

View file

@ -910,6 +910,43 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
not a surviving runtime owner. Missing or incompatible advertised profiles
fail closed instead of silently rendering a different look.
### Celestial World Presentation Contract
- Owner: the daemon owns which celestial bodies and asteroid instances exist,
their authoritative orbit-derived XZ positions, terrain-derived altitude,
authored scale, and presentation identity. Aetheria's provider catalog owns
the native visual assets. EveUnity owns only generic entity instantiation.
- Inputs: the current zone's typed body and asteroid rows, daemon simulation
time, canonical orbit evaluation, gravity-terrain evaluation, and daemon
render settings.
- Outputs: planets, suns, gas giants, and asteroids occupy ordinary rows in the
shared Eve entity SoA generation. Stable synthetic identities distinguish
these presentation rows from simulation entities; each row carries a generic
entity kind and provider asset reference.
- Derived state: the Unity `GameObject`, prefab instance, renderer bounds,
material instances, native layer, and pilot-frustum intersection are client
projections. Celestial synthetic identities are not selectable, controllable,
damageable, or valid command targets.
- Forbidden writers: the fossil `ZoneRenderer`, planet scripts, Unity physics,
and runtime-side terrain sampling cannot create, position, scale, rotate, or
remove celestial rows. EveUnity cannot import Aetheria types or branch on
Aetheria celestial asset keys.
- Shared paths: cold download, warm cache, reconnect, and every committed SoA
generation use the same provider assets and immutable generation swap as
ships, stations, pickups, and persistent payloads.
- Cut line: the Aetheria-specific zone-render document is not a client ABI.
Provider packaging extracts only the advertised visual child from each fossil
celestial prefab, then applies the common script, physics, material, and
bundle verification pipeline. Gravity wells, map icons, runtime scripts, and
other fossil authorities do not hitch a ride inside the presentation prefab.
- Verification layer: the daemon smoke proves stable, unique negative synthetic
indices, provider asset references, body/asteroid positions, and equivalent
local/network SoA bodies. The released generic-client witness records every
presented entity's kind, asset, scale, renderer count, and pilot-frustum
intersection. Its warm run instantiated eleven bodies and eighteen asteroids
with enabled provider renderers; seven celestial instances intersected the
pilot frustum. This proves projection and lowering, not final art parity.
### Gravity Fog Presentation Contract
- Owner: Aetheria owns gravity/fog brush placement and values, authored volume

View file

@ -34,10 +34,11 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
| Pilot camera | ARPG follow/dock cameras | Eve view semantics + runtime | camera rig and semantic view id | EveUnity camera rig | daemon dock state selects distinct contracts instead of collapsing both fossil cameras: undocked flight advertises the entity-forward `Third Person Rig` framing (distance 30, screen 0.64/0.19, FOV 60, lens 1-4096) and the shared `aim.presentation` convergence point as its look-at; Aetheria translates the fossil Cinemachine top-origin screen Y of `0.81` to Eve's bottom-origin viewport Y of `0.19`; EveUnity solves native pose while preserving both optical aim and advertised entity framing, without provider types; the retained dock projection remains separate | reproduce the dock camera's separate follow/look-at subjects, blend timeline, noise, and reconnect state |
| Render channels | Unity layers/culling masks | provider surface policy + runtime asset variant | semantic channel exclusions | EveUnity native layer mapping | wired, exclusive, and lowered: the pilot surface excludes the semantic `map` channel; the Unity asset variant maps `map` to its authored native layer; EveUnity subtracts that layer from the configured camera mask; portable state contains no Unity layer or mask; the released warm witness proves the pilot camera excludes map glyphs while the map camera retains them | preserve the channel proof while world presentation and transport continue to evolve |
| Minimap/tactical map | `ZoneRenderer`, map cameras | daemon world facts | explicit map projections | Unity and Electron | facts fragmented; generic lowerers absent | same state in both runtimes |
| Fields/fog/gravity | zone renderer and shaders | daemon/plugin semantics | Fields plugin documents | EveUnity fields lowerer | daemon publishes canonical gravity/fog splat layers through `field.volume3d`; Eve Fields `0.2.3` owns portable `PowerPulse` and `AnimatedRadialCosine` semantics; Aetheria emits the fossil global animated simplex/cellular/ambient stack, body-owned radial waves, and separate negative gameplay `gravity.height` and positive visual `fog.surface_height`; the field viewport matches the fossil splat cameras' 2000-by-2000 orthographic footprint while the larger 3000-scale brush parent remains brush coverage, not sampling extent; daemon entities follow fossil terrain height plus hull grid offset after Ymir XZ motion; released EveUnity `0.3.50` lowers the authored 2048/256/512 layer topology, provider shader ABI, pre-postprocess URP pass, authoritative flow time, explicit camera matrix, and float32 packed-output diagnostics without provider code. Translating the fossil camera's top-origin screen Y into Eve's bottom-origin convention places the camera above the field and restores a live fog horizon with the original `-36.17` noise amplitude; the deterministic Terminus sun now owns a blue fog tint instead of the unrelated brown calibration, and both camera-channel screenshots pass without runtime-specific color rules | restore readable patch structure, gravity waves, surrounding world geometry, and final luminance/composition parity; visual parity remains explicitly open |
| Celestial world | `ZoneRenderer`, body/asteroid prefab scripts | daemon render projection plus provider assets | ordinary generic Eve entity SoA rows | EveUnity generic entity/prefab lowerer | wired, exclusive, projected, and lowered: daemon orbit and terrain queries emit stable presentation-only identities for suns, planets, gas giants, and live asteroid instances; provider packaging extracts only each advertised visual child and strips fossil scripts/physics; released EveUnity `0.3.51` applies semantic scale around provider-authored local scale and contains no celestial or Aetheria branch. The released warm witness records eleven bodies and eighteen asteroids with provider refs and enabled renderers, including seven celestial instances intersecting the pilot frustum | body material/light readability, close-range composition matching the fossil, asteroid variation, and Electron lowering |
| Fields/fog/gravity | zone renderer and shaders | daemon/plugin semantics | Fields plugin documents | EveUnity fields lowerer | daemon publishes canonical gravity/fog splat layers through `field.volume3d`; Eve Fields `0.2.3` owns portable `PowerPulse` and `AnimatedRadialCosine` semantics; Aetheria emits the fossil global animated simplex/cellular/ambient stack, body-owned radial waves, and separate negative gameplay `gravity.height` and positive visual `fog.surface_height`; the field viewport matches the fossil splat cameras' 2000-by-2000 orthographic footprint while the larger 3000-scale brush parent remains brush coverage, not sampling extent; daemon entities follow fossil terrain height plus hull grid offset after Ymir XZ motion; released EveUnity `0.3.51` lowers the authored 2048/256/512 layer topology, provider shader ABI, pre-postprocess URP pass, authoritative flow time, explicit camera matrix, and float32 packed-output diagnostics without provider code. Translating the fossil camera's top-origin screen Y into Eve's bottom-origin convention places the camera above the field and restores a live fog horizon with the original `-36.17` noise amplitude; the deterministic Terminus sun now owns a blue fog tint instead of the unrelated brown calibration, and both camera-channel screenshots pass without runtime-specific color rules | restore readable patch structure, gravity waves, surrounding world geometry, and final luminance/composition parity; visual parity remains explicitly open |
| HUD/schematic | ARPG HUD and `SchematicDisplay` | Eve composition from daemon facts | semantic status/components | EveUnity UI | provider-authored transparent cockpit is wired, projected, and lowered through generic UI Toolkit panes, metrics, and progress components for hull, shield, capacitor, temperature, cargo, weapon cooldown/groups, selected target, target lock, target shield, and target hull; the original armor/equipment schematic and transient warning choreography remain reference-only | schematic topology, warning timelines, dynamic action state, and composited live capture |
| Hit/lock/warnings | `ActionGameManager` feedback | daemon event facts | transient feedback stream | VFX/UI/audio | bounded deduplicated game-event ledger and Eve `feedback.stream` wired for pickup outcomes, projectile launch/impact, entity damage, alive-to-dead destruction, authoritative weapon reload chronology, and episode-deduplicated `weapon.fire.refused` facts for insufficient energy or missing ammunition; refusal identity, authored weapon, target, reason, and remaining magazine state are runtime-independent cockpit inputs | add lock transitions, thermal and docking event families, negative transaction fixtures, and runtime effect consumption |
| Assets | `Assets/Resources` | Aetheria provider | asset catalog + CultMesh CDN | runtime cache/load | provider manifests name deterministic bundle-internal paths; the authoring build derives presentation-only prefabs, strips missing and non-Eve `MonoBehaviour` components, verifies both saved prefabs and the loaded bundle, and publishes the immutable bundle through CultMesh; the released cold profile starts empty, receives and verifies the 46,412,384-byte body through `cultmesh.content.v1`, atomically promotes the exact hash with no partial, and lowers rendered provider identity; the warm profile reuses the committed body. Negotiated mapped/zero-copy delivery remains unproven | negotiated mapped/network body selection and same-machine zero-copy proof |
| Assets | `Assets/Resources` | Aetheria provider | asset catalog + CultMesh CDN | runtime cache/load | provider manifests name deterministic bundle-internal paths; the authoring build derives presentation-only prefabs, strips missing and non-Eve `MonoBehaviour` components, verifies both saved prefabs and the loaded bundle, and publishes the immutable bundle through CultMesh; the released cold profile starts empty, receives and verifies the 55,529,775-byte body through `cultmesh.content.v1`, atomically promotes the exact hash with no partial, and lowers rendered provider identity; the warm profile reuses the committed body. Negotiated mapped/zero-copy delivery remains unproven | negotiated mapped/network body selection and same-machine zero-copy proof |
| Save/resume | original persistence paths | daemon/CultCache | published current state | clients rehydrate | owner-exists; not parity-proven | mid-loop restart |
| Terminus loop | original game composition | daemon/Ymir/Eve | pilot surface | Aetheria.Unity | live minimum-loop proof: generic Unity discovers the provider, lowers the pilot world/assets, single-steps dock and undock while paused, buys daemon-priced station stock, single-steps Ymir salvage collection, resumes, moves, targets, fires, and presents authoritative receipts/shot outcome; the released full-session profile starts with no pickup, destroys a deterministic target, observes its canonical cargo drop, tractors it into a Ymir Begin contact, and proves exactly one `ymir-fact:` collection receipt plus cargo `0` to `1` | richer trade content, docking transitions, and sustained combat encounters |
| Starbridge | original/shared architecture intent | one daemon session | pilot + commander surfaces | Unity + Electron | commander task board and autonomous explore execution wired; Electron Eve lowering and split-target proof missing | commander orders plus four pilots and autonomous workers |

View file

@ -20,8 +20,8 @@ $expected = @{
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.2",
"140e1bd963a0033e66777a3b2c5fe6e9c97dfe32")
"org.gamecult.eve.unity-scene" = @(
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.50",
"7c8442e12264806a53a9e0e08b7b090dcddb8c90")
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.51",
"21ac39e7bdfca9d81a0b7d89834f7e9da60aaad6")
}
foreach ($packageName in $expected.Keys) {