Project typed hull assets through Eve

This commit is contained in:
Meta Vens 2026-07-16 16:57:37 +01:00
commit 141689dd8e
8 changed files with 120 additions and 20 deletions

View file

@ -1081,6 +1081,45 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
"provider must advertise the script-free mine presentation role");
RequireEqual("0.25", asset.Ref.Metadata["triggeredPulseSeconds"],
"mine presentation must retain the fossil triggered pulse cadence");
var rareHull = driveHulls.Single();
var rareHullAssetKey = AetheriaRuntimeAssets.HullPrefabAssetKey(rareHull.ItemKey);
var rareHullAsset = manifest.Assets.Single(value => value.Ref.AssetKey == rareHullAssetKey);
var expectedHullResourcePath = rareHull.HullPrefab.Replace('\\', '/');
const string resourcesPrefix = "Assets/Resources/";
if (expectedHullResourcePath.StartsWith(resourcesPrefix, StringComparison.OrdinalIgnoreCase))
expectedHullResourcePath = expectedHullResourcePath[resourcesPrefix.Length..];
if (expectedHullResourcePath.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase))
expectedHullResourcePath = expectedHullResourcePath[..^".prefab".Length];
RequireEqual("entity.hull", rareHullAsset.Ref.Metadata["presentationRole"],
"provider manifest must type catalog hull prefabs as generic hull presentation assets");
RequireEqual(expectedHullResourcePath, rareHullAsset.Ref.Metadata["resourcesPath"],
"provider hull asset must retain the catalog-authored prefab instead of a faction fallback");
var rareShip = Entity(0, 0, "player");
rareShip.HullItemKey = rareHull.ItemKey;
var rareRun = new AetheriaRuntimeRunCheckpointCommit
{
RunId = "rare-hull-presentation-smoke",
CurrentZoneIndex = 0,
CurrentEntityKey = "zone.0.entity.0",
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [rareShip] }]
};
var rareFrame = new AetheriaRuntimeDaemonFrameDocument { FrameId = 1, Run = rareRun };
var rareSurface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build(
rareFrame,
new AetheriaRuntimeDaemonHealthDocument(),
AetheriaRuntimeDaemonCommandBoundaryDocument.Create("daemon"),
catalog: catalog);
var rareSurfaceEntity = Flatten(rareSurface.Surface.Root).Single(node =>
node.Id == "aetheria.daemon.game.world.entity.0");
RequireEqual(rareHullAssetKey, rareSurfaceEntity.Props["assetRef"],
"Eve scene projection must select the typed hull asset rather than the player Djinni fallback");
using var rareSoaCache = new CultCache();
using var rareSoaPublisher = new AetheriaRuntimeDaemonSoaFramePublisher(rareSoaCache, producerEpoch: 1);
var rareSoa = rareSoaPublisher.BuildCurrentZoneEntities(rareFrame, catalog);
RequireEqual(rareHullAssetKey, rareSoa.View.Identities.Single().AssetRef,
"SoA identity and Eve scene projection must share the catalog-owned hull asset key");
}
private static void EnergyFundedShieldInterceptsDamageBeforeHull()

View file

@ -1569,7 +1569,8 @@ static async Task PublishDaemonApiDocumentsAsync(
result.Frame,
result.Health ?? new AetheriaRuntimeDaemonHealthDocument(),
result.CommandBoundary ?? AetheriaRuntimeDaemonCommandBoundaryDocument.Create(options.DaemonId),
activeMainMenuSurfaceId);
activeMainMenuSurfaceId,
inputCatalog);
await node.MutableDocument<EveSurfaceDocument>(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface)
.ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(gameSurface))
.ConfigureAwait(false);

View file

@ -85,6 +85,7 @@ RequireUnityObserverDoesNotTickLocalSimulation(root);
RequireUnityDoesNotCallSharedSimulationTicks(root);
RequireDaemonEnergyAndThermalAuthority(root);
RequireThermalPresentationAssetAuthority(root);
RequireCatalogHullPresentationAuthority(root);
RequireUnityPhysicsIsNotGameplayAuthority(root);
RequireDeadPropertiesPanelShellDeleted(root);
RequireTypedBehaviorMetadataCoverage(root);
@ -12145,7 +12146,7 @@ static void RequireDaemonVersePublication(string root)
"CultMeshAddress",
"BuildPublications",
"AetheriaRuntimeDaemonCommandBoundaryDocument.Create",
"soaPublisher.BuildCurrentZoneEntities(frame)",
"soaPublisher.BuildCurrentZoneEntities(frame, catalog)",
"AetheriaRuntimeDaemonProviderAdvertisementDocument.Create",
"AetheriaRuntimeStarbridgeDocuments.SessionSummary(",
"StarbridgeScenario",
@ -16672,6 +16673,37 @@ static void RequireThermalPresentationAssetAuthority(string root)
"The Aetheria Unity thermal sink may bind profiles and weights but may not reconstruct medical or phasing authority.");
}
static void RequireCatalogHullPresentationAuthority(string root)
{
var assets = File.ReadAllText(Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeAssets.cs"));
var surface = File.ReadAllText(Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonGameSurfaceBuilder.cs"));
var soa = File.ReadAllText(Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonSoaFramePublisher.cs"));
var tick = File.ReadAllText(Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonTickRunner.cs"));
var builder = File.ReadAllText(Path.Combine(root, "Assets", "Editor", "EveAssetBundleBuilder.cs"));
var required = new[]
{
"catalog?.FindItem(entity.HullItemKey",
"HullPrefabAssetKey(hull.ItemKey)",
"!string.IsNullOrWhiteSpace(item.HullPrefab)",
"ResolveEntityPrefabAssetRef(entity, catalog)",
"soaPublisher.BuildCurrentZoneEntities(frame, catalog)",
"AetheriaRuntimeCatalogStore.OpenReadOnly(",
"AetheriaRuntimeAssets.ProjectManifest(catalog).Assets"
};
var body = assets + surface + soa + tick + builder;
var missing = required.Where(symbol => !body.Contains(symbol, StringComparison.Ordinal)).ToArray();
if (missing.Length > 0)
throw new InvalidOperationException(
"Typed hull identity must choose one provider-owned catalog prefab across the manifest, Eve scene, and SoA paths: " +
string.Join(", ", missing));
var catalogLookup = assets.IndexOf("catalog?.FindItem(entity.HullItemKey", StringComparison.Ordinal);
var fallbackLookup = assets.IndexOf("var kind = (entity.Kind", StringComparison.Ordinal);
if (catalogLookup < 0 || fallbackLookup < 0 || catalogLookup > fallbackLookup)
throw new InvalidOperationException(
"Faction/category prefab fallbacks must not override an authored typed hull prefab.");
}
static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
{
var checkedRoots = new[]

View file

@ -33,7 +33,9 @@ namespace Aetheria.Editor
var output = ResolveOutput(target);
Directory.CreateDirectory(output);
var assets = AetheriaRuntimeAssets.ProjectManifest(null).Assets;
var catalog = AetheriaRuntimeCatalogStore.OpenReadOnly(
Path.GetFullPath(Path.Combine("GameData", "aetheria-world.cc")));
var assets = AetheriaRuntimeAssets.ProjectManifest(catalog).Assets;
foreach (var entry in assets.Where(entry =>
string.Equals(entry.Ref.Kind, AetheriaRuntimeAssetKinds.Prefab, StringComparison.Ordinal)))
BuildPresentationPrefab(entry);

View file

@ -8,9 +8,14 @@ namespace GameCult.Aetheria.State.Verse
{
public static class AetheriaRuntimeAssets
{
public static string ResolveEntityPrefabAssetRef(AetheriaRuntimeEntitySnapshotCommit entity)
public static string ResolveEntityPrefabAssetRef(
AetheriaRuntimeEntitySnapshotCommit entity,
AetheriaRuntimeCatalogSnapshot? catalog = null)
{
if (entity == null) return "";
var hull = catalog?.FindItem(entity.HullItemKey ?? "");
if (hull != null && !string.IsNullOrWhiteSpace(hull.HullPrefab))
return HullPrefabAssetKey(hull.ItemKey);
var kind = (entity.Kind ?? "").Trim().ToLowerInvariant();
if (kind.Contains("station")) return "prefab.entity.station";
if (kind.Contains("projectile")) return "prefab.entity.projectile";
@ -19,6 +24,9 @@ namespace GameCult.Aetheria.State.Verse
? "prefab.entity.player"
: "prefab.entity.ship";
}
public static string HullPrefabAssetKey(string hullItemKey) =>
string.IsNullOrWhiteSpace(hullItemKey) ? "" : $"prefab.hull.{hullItemKey.Trim()}";
public static AetheriaRuntimeAssetManifestDocument ProjectManifest(
AetheriaRuntimeCatalogSnapshot? catalog,
string runId = "",
@ -69,6 +77,15 @@ namespace GameCult.Aetheria.State.Verse
if (item == null || string.IsNullOrWhiteSpace(item.ItemKey))
continue;
if (!string.IsNullOrWhiteSpace(item.HullPrefab))
{
Add(entries, MapPrefab(
HullPrefabAssetKey(item.ItemKey),
string.IsNullOrWhiteSpace(item.Name) ? item.ItemKey : item.Name,
item.HullPrefab,
"entity.hull"));
}
var icon = AssetRefFromCatalogIcon(item.ActionBarIcon, $"item.{item.ItemKey}.icon");
if (!string.IsNullOrWhiteSpace(icon.AssetKey))
{

View file

@ -19,7 +19,8 @@ namespace GameCult.Aetheria.State.Verse
AetheriaRuntimeDaemonFrameDocument frame,
AetheriaRuntimeDaemonHealthDocument health,
AetheriaRuntimeDaemonCommandBoundaryDocument commandBoundary,
string activeMainMenuSurfaceId = AetheriaRuntimeMainMenuCommands.RootSurfaceId)
string activeMainMenuSurfaceId = AetheriaRuntimeMainMenuCommands.RootSurfaceId,
AetheriaRuntimeCatalogSnapshot? catalog = null)
{
frame ??= new AetheriaRuntimeDaemonFrameDocument();
health ??= new AetheriaRuntimeDaemonHealthDocument();
@ -37,7 +38,8 @@ namespace GameCult.Aetheria.State.Verse
run,
zone,
run.CurrentEntityKey,
frame.SimulationSettings),
frame.SimulationSettings,
catalog),
CockpitOverlay(entity, target, frame.SimulationSettings),
FeedbackStream(run, frame.FrameId),
ShotReceiptStream(run),
@ -607,7 +609,8 @@ namespace GameCult.Aetheria.State.Verse
AetheriaRuntimeRunCheckpointCommit run,
AetheriaRuntimeZoneSnapshotCommit zone,
string currentEntityKey,
AetheriaRuntimeDaemonSimulationSettings simulationSettings)
AetheriaRuntimeDaemonSimulationSettings simulationSettings,
AetheriaRuntimeCatalogSnapshot? catalog)
{
run ??= new AetheriaRuntimeRunCheckpointCommit();
zone ??= new AetheriaRuntimeZoneSnapshotCommit();
@ -671,7 +674,8 @@ namespace GameCult.Aetheria.State.Verse
var presentationChildren = (zone.Entities ?? Array.Empty<AetheriaRuntimeEntitySnapshotCommit>())
.Where(entity => entity != null && entity.IsActive)
.Select(entity => PlayableEntityPresentation(entity, run, zone, currentEntityKey, simulationSettings))
.Select(entity => PlayableEntityPresentation(
entity, run, zone, currentEntityKey, simulationSettings, catalog))
.ToList();
var combatPresentation = CombatPresentation(run, zone, playerEntityId, simulationSettings);
if (combatPresentation != null)
@ -900,7 +904,8 @@ namespace GameCult.Aetheria.State.Verse
AetheriaRuntimeRunCheckpointCommit run,
AetheriaRuntimeZoneSnapshotCommit zone,
string currentEntityKey,
AetheriaRuntimeDaemonSimulationSettings simulationSettings)
AetheriaRuntimeDaemonSimulationSettings simulationSettings,
AetheriaRuntimeCatalogSnapshot? catalog)
{
var entityId = run.EntityRecordKey(zone.ZoneIndex, entity.EntityIndex);
var playerEntityId = PlayableWorldEntityId(run, zone, currentEntityKey);
@ -958,7 +963,7 @@ namespace GameCult.Aetheria.State.Verse
["homeEntityId"] = entity.HomeEntityId ?? "",
["agentCapabilities"] = string.Join(",", entity.AgentTaskCapabilities ?? Array.Empty<string>()),
["assignedTaskId"] = entity.AssignedAgentTaskId ?? "",
["assetRef"] = PlayableWorldAssetRef(entity),
["assetRef"] = PlayableWorldAssetRef(entity, catalog),
["hull"] = FormatNumber(hull),
["maximumHull"] = FormatNumber(maximumHull),
["hullRatio"] = FormatRatio(hull, maximumHull),
@ -1151,8 +1156,10 @@ namespace GameCult.Aetheria.State.Verse
weapons);
}
private static string PlayableWorldAssetRef(AetheriaRuntimeEntitySnapshotCommit entity)
=> AetheriaRuntimeAssets.ResolveEntityPrefabAssetRef(entity);
private static string PlayableWorldAssetRef(
AetheriaRuntimeEntitySnapshotCommit entity,
AetheriaRuntimeCatalogSnapshot? catalog)
=> AetheriaRuntimeAssets.ResolveEntityPrefabAssetRef(entity, catalog);
private static double EntityStat(AetheriaRuntimeEntitySnapshotCommit entity, string name) =>
(entity.StatGrids ?? Array.Empty<AetheriaRuntimeEntityStatGridCommit>())

View file

@ -72,7 +72,8 @@ namespace GameCult.Aetheria.State.Verse
}
public AetheriaRuntimeDaemonSoaFrame BuildCurrentZoneEntities(
AetheriaRuntimeDaemonFrameDocument frame)
AetheriaRuntimeDaemonFrameDocument frame,
AetheriaRuntimeCatalogSnapshot? catalog = null)
{
if (frame == null)
throw new ArgumentNullException(nameof(frame));
@ -190,7 +191,7 @@ namespace GameCult.Aetheria.State.Verse
Faction = entity.FactionKey,
Selectable = entity.EntityIndex != controlled?.EntityIndex,
Controllable = entity.EntityIndex == controlled?.EntityIndex,
AssetRef = AetheriaRuntimeAssets.ResolveEntityPrefabAssetRef(entity)
AssetRef = AetheriaRuntimeAssets.ResolveEntityPrefabAssetRef(entity, catalog)
})
.Concat(pickups.Select((pickup, pickupRow) => new AetheriaRuntimeDaemonSoaIdentityDocument
{

View file

@ -254,7 +254,11 @@ namespace GameCult.Aetheria.State.Verse
{
var soaPublisher = options.SoaFramePublisher ??
throw new InvalidOperationException("The daemon-lifetime Aetheria SoA publisher is required.");
var soaFrame = soaPublisher.BuildCurrentZoneEntities(frame);
var catalog = options.Catalog ?? new AetheriaRuntimeCatalogSnapshot(
Array.Empty<AetheriaRuntimeCatalogItem>(),
Array.Empty<AetheriaRuntimeCorporation>(),
Array.Empty<AetheriaRuntimeNameFile>());
var soaFrame = soaPublisher.BuildCurrentZoneEntities(frame, catalog);
var commandBoundary = AetheriaRuntimeDaemonCommandBoundaryDocument.Create(options.DaemonId);
var providerAdvertisement = AetheriaRuntimeDaemonProviderAdvertisementDocument.Create(
stateFilePath,
@ -276,10 +280,6 @@ namespace GameCult.Aetheria.State.Verse
Transport = "cultmesh-managed",
CommandBoundaryPath = AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary.ToString()
};
var catalog = options.Catalog ?? new AetheriaRuntimeCatalogSnapshot(
Array.Empty<AetheriaRuntimeCatalogItem>(),
Array.Empty<AetheriaRuntimeCorporation>(),
Array.Empty<AetheriaRuntimeNameFile>());
var assetManifest = AetheriaRuntimeAssets.ProjectManifest(
catalog,
frame.Run?.RunId ?? "",
@ -292,7 +292,8 @@ namespace GameCult.Aetheria.State.Verse
var gameSurface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build(
frame,
health,
commandBoundary);
commandBoundary,
catalog: catalog);
var designerSurfaces = new[]
{
AetheriaRuntimeStatRecipeSurfaceBuilder.BuildFromCatalog(catalog),