Publish authoritative pickup feedback events

This commit is contained in:
Meta Vens 2026-07-11 19:19:47 +01:00
commit ecad6e2f4b
7 changed files with 108 additions and 9 deletions

View file

@ -853,6 +853,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-pickup-expiry-smoke.cc"), run,
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 1, FixedDeltaSeconds = 30, SimulationTimeSeconds = 30, ProjectilePhysics = AetheriaRuntimeProjectilePhysicsUnavailable.Instance, BuildPublications = false });
RequireEqual(0, zone.DroppedPickups.Count, "pickup must expire after the fossil thirty-second lifetime");
Require(run.GameEvents.Any(value => value.Kind == "pickup.expired" && value.PickupIndex == 8),
"daemon lifetime owner must emit authoritative pickup expiry event");
}
private static void PickupShieldContactCollectsOrBounces()
@ -871,12 +873,22 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 1, FixedDeltaSeconds = 0.1, SimulationTimeSeconds = 0.1, Catalog = catalog, ProjectilePhysics = AetheriaRuntimeProjectilePhysicsUnavailable.Instance, BuildPublications = false });
RequireEqual(0, open.Zones[0].DroppedPickups.Count, "shield contact with capacity must collect pickup automatically");
RequireEqual(1, CargoQuantity(open.Zones[0].Entities[0], salvage.ItemKey), "contact collection must commit cargo once");
RequireEqual(1, open.GameEvents.Count(value => value.Kind == "pickup.collected" && value.PickupIndex == 10),
"contact collection must emit one stable event");
var full = Scenario(true);
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-pickup-contact-full.cc"), full,
new AetheriaRuntimeDaemonTickOptions { WorldPhysics = new AetheriaYmirWorldPhysics(), FrameId = 1, FixedDeltaSeconds = 0.1, SimulationTimeSeconds = 0.1, Catalog = catalog, ProjectilePhysics = AetheriaRuntimeProjectilePhysicsUnavailable.Instance, BuildPublications = false });
RequireEqual(1, full.Zones[0].DroppedPickups.Count, "full hold must leave contacted pickup alive");
Require(full.Zones[0].DroppedPickups[0].VelocityX > 20, "failed pickup must receive the fossil outward kick");
RequireEqual(1, full.GameEvents.Count(value => value.Kind == "pickup.rejected" && value.PickupIndex == 10),
"capacity rejection must emit one stable event");
var feedback = AetheriaRuntimeDaemonGameSurfaceBuilder.Build(
new AetheriaRuntimeDaemonFrameDocument { FrameId = 1, Run = full },
new AetheriaRuntimeDaemonHealthDocument(),
AetheriaRuntimeDaemonCommandBoundaryDocument.Create("daemon"));
Require(Flatten(feedback.Surface.Root).Any(node => node.Kind == "feedback.event" && node.Props["eventKind"] == "pickup.rejected" && node.Props["pickupIndex"] == "10"),
"Eve surface must project authoritative pickup feedback chronology");
}
private static (AetheriaRuntimeRunCheckpointCommit Run, AetheriaRuntimeZoneSnapshotCommit Zone, AetheriaRuntimeEntitySnapshotCommit Target) Scenario()

View file

@ -37,6 +37,7 @@ namespace GameCult.Aetheria.State.Verse
zone,
run.CurrentEntityKey,
frame.SimulationSettings),
FeedbackStream(run, frame.FrameId),
GravityFieldSurface("aetheria.daemon.game.field"),
MainMenuOverlay("aetheria.daemon.game.main_menu", activeMainMenuSurfaceId),
Node(
@ -212,6 +213,30 @@ namespace GameCult.Aetheria.State.Verse
tasks);
}
private static AetheriaRuntimeSurfaceComponent FeedbackStream(AetheriaRuntimeRunCheckpointCommit run, long frameId)
{
var events = (run.GameEvents ?? Array.Empty<AetheriaRuntimeGameEventCommit>())
.Where(value => value != null)
.OrderBy(value => value.FrameId)
.ThenBy(value => value.EventId, StringComparer.Ordinal)
.Select(value => Node(
$"aetheria.daemon.game.feedback.{SurfaceToken(value.EventId)}",
"feedback.event",
new[]
{
("eventId", value.EventId), ("eventKind", value.Kind),
("frameId", value.FrameId.ToString(CultureInfo.InvariantCulture)),
("zoneIndex", value.ZoneIndex.ToString(CultureInfo.InvariantCulture)),
("sourceEntityIndex", value.SourceEntityIndex.ToString(CultureInfo.InvariantCulture)),
("targetEntityIndex", value.TargetEntityIndex.ToString(CultureInfo.InvariantCulture)),
("pickupIndex", value.PickupIndex.ToString(CultureInfo.InvariantCulture)),
("itemKey", value.ItemKey), ("scalarValue", FormatNumber(value.ScalarValue)),
("currentFrameId", frameId.ToString(CultureInfo.InvariantCulture))
}))
.ToArray();
return Node("aetheria.daemon.game.feedback", "feedback.stream", new[] { ("retainedCount", events.Length.ToString(CultureInfo.InvariantCulture)) }, events);
}
private static AetheriaRuntimeSurfaceComponent BuildSurveyKnowledge(AetheriaRuntimeRunCheckpointCommit run)
{
var entries = (run.CorporationSurveys ?? Array.Empty<AetheriaRuntimeCorporationSurveyCommit>())

View file

@ -803,7 +803,19 @@ namespace GameCult.Aetheria.State.Verse
return false;
var pickup = pickups[pickupIndex];
return AetheriaRuntimePickupTransactions.TryCollect(zone, entity, pickup.PickupIndex, catalog);
var collected = AetheriaRuntimePickupTransactions.TryCollect(zone, entity, pickup.PickupIndex, catalog);
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit
{
EventId = $"command:{command.CommandId}:{(collected ? "pickup-collected" : "pickup-rejected")}",
Kind = collected ? "pickup.collected" : "pickup.rejected",
FrameId = command.ObservedFrameId,
ZoneIndex = zoneIndex,
TargetEntityIndex = entity.EntityIndex,
PickupIndex = pickup.PickupIndex,
ItemKey = pickup.Item?.ItemKey ?? "",
ScalarValue = Math.Max(1, pickup.Item?.Quantity ?? 1)
});
return collected;
}
private static bool ApplyToggleHullConductivity(

View file

@ -41,7 +41,7 @@ namespace GameCult.Aetheria.State.Verse
if (entities.Length == 0)
continue;
StepPickupLifetimes(zone, deltaSeconds);
StepPickupLifetimes(run, zone, frameId, deltaSeconds);
EnsureStats(entities, settings);
foreach (var entity in entities)
@ -52,7 +52,7 @@ namespace GameCult.Aetheria.State.Verse
StepRaiderAi(entities);
StepTargetPursuit(entities, settings);
var worldStep = StepWorldPhysics(zone, entities, deltaSeconds, worldPhysics);
ResolvePickupContacts(zone, entities, worldStep, catalog);
ResolvePickupContacts(run, zone, entities, worldStep, catalog, frameId);
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);
@ -60,10 +60,13 @@ namespace GameCult.Aetheria.State.Verse
}
}
private static void StepPickupLifetimes(AetheriaRuntimeZoneSnapshotCommit zone, double deltaSeconds)
private static void StepPickupLifetimes(AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeZoneSnapshotCommit zone, long frameId, double deltaSeconds)
{
foreach (var pickup in zone.DroppedPickups ?? Array.Empty<AetheriaRuntimeDroppedPickupCommit>())
if (pickup != null) pickup.AgeSeconds += deltaSeconds;
foreach (var pickup in (zone.DroppedPickups ?? Array.Empty<AetheriaRuntimeDroppedPickupCommit>())
.Where(pickup => pickup != null && pickup.AgeSeconds >= pickup.LifetimeSeconds))
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"frame:{frameId}:zone:{zone.ZoneIndex}:pickup:{pickup.PickupIndex}:expired", Kind = "pickup.expired", FrameId = frameId, ZoneIndex = zone.ZoneIndex, PickupIndex = pickup.PickupIndex, ItemKey = pickup.Item?.ItemKey ?? "" });
zone.DroppedPickups = (zone.DroppedPickups ?? Array.Empty<AetheriaRuntimeDroppedPickupCommit>())
.Where(pickup => pickup != null && pickup.AgeSeconds < pickup.LifetimeSeconds)
.ToArray();
@ -194,10 +197,12 @@ namespace GameCult.Aetheria.State.Verse
}
private static void ResolvePickupContacts(
AetheriaRuntimeRunCheckpointCommit run,
AetheriaRuntimeZoneSnapshotCommit zone,
IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities,
AetheriaRuntimeWorldStep worldStep,
AetheriaRuntimeCatalogSnapshot? catalog)
AetheriaRuntimeCatalogSnapshot? catalog,
long frameId)
{
foreach (var contact in worldStep.Contacts.Where(contact => contact.PickupIndex >= 0))
{
@ -207,7 +212,11 @@ namespace GameCult.Aetheria.State.Verse
.FirstOrDefault(value => value != null && value.PickupIndex == contact.PickupIndex);
if (entity == null || pickup == null) continue;
if (AetheriaRuntimePickupTransactions.TryCollect(zone, entity, pickup.PickupIndex, catalog, requireRange: false))
{
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"frame:{frameId}:zone:{zone.ZoneIndex}:entity:{entity.EntityIndex}:pickup:{pickup.PickupIndex}:collected", Kind = "pickup.collected", FrameId = frameId, ZoneIndex = zone.ZoneIndex, TargetEntityIndex = entity.EntityIndex, PickupIndex = pickup.PickupIndex, ItemKey = pickup.Item?.ItemKey ?? "", ScalarValue = Math.Max(1, pickup.Item?.Quantity ?? 1) });
continue;
}
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"frame:{frameId}:zone:{zone.ZoneIndex}:entity:{entity.EntityIndex}:pickup:{pickup.PickupIndex}:rejected", Kind = "pickup.rejected", FrameId = frameId, ZoneIndex = zone.ZoneIndex, TargetEntityIndex = entity.EntityIndex, PickupIndex = pickup.PickupIndex, ItemKey = pickup.Item?.ItemKey ?? "", ScalarValue = Math.Max(1, pickup.Item?.Quantity ?? 1) });
var dx = pickup.PositionX - entity.PositionX; var dz = pickup.PositionZ - entity.PositionZ;
var length = Math.Sqrt(dx * dx + dz * dz);
if (length < 0.001) { dx = 1; dz = 0; length = 1; }

View file

@ -0,0 +1,22 @@
using System;
using System.Linq;
#nullable enable
namespace GameCult.Aetheria.State.Verse
{
public static class AetheriaRuntimeGameEvents
{
public const int RetainedEventCount = 256;
public static void Append(AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeGameEventCommit gameEvent)
{
if (run == null || gameEvent == null || string.IsNullOrWhiteSpace(gameEvent.EventId)) return;
var events = (run.GameEvents ?? Array.Empty<AetheriaRuntimeGameEventCommit>())
.Where(value => value != null && !string.Equals(value.EventId, gameEvent.EventId, StringComparison.Ordinal))
.Append(gameEvent)
.OrderBy(value => value.FrameId).ThenBy(value => value.EventId, StringComparer.Ordinal)
.ToArray();
run.GameEvents = events.Length <= RetainedEventCount ? events : events.Skip(events.Length - RetainedEventCount).ToArray();
}
}
}

View file

@ -203,6 +203,10 @@ namespace GameCult.Aetheria.State.Verse
public IReadOnlyList<AetheriaRuntimeCorporationSurveyCommit> CorporationSurveys { get; set; } =
Array.Empty<AetheriaRuntimeCorporationSurveyCommit>();
[Key(14)]
public IReadOnlyList<AetheriaRuntimeGameEventCommit> GameEvents { get; set; } =
Array.Empty<AetheriaRuntimeGameEventCommit>();
public AetheriaRuntimeLoadoutTemplateCommit CreateLoadoutTemplate(string entityKey)
{
return TryParseEntityKey(entityKey, out var zoneIndex, out var entityIndex)
@ -427,6 +431,20 @@ namespace GameCult.Aetheria.State.Verse
}
}
[MessagePackObject]
public sealed class AetheriaRuntimeGameEventCommit
{
[Key(0)] public string EventId { get; set; } = "";
[Key(1)] public string Kind { get; set; } = "";
[Key(2)] public long FrameId { get; set; } = -1;
[Key(3)] public int ZoneIndex { get; set; } = -1;
[Key(4)] public int SourceEntityIndex { get; set; } = -1;
[Key(5)] public int TargetEntityIndex { get; set; } = -1;
[Key(6)] public int PickupIndex { get; set; } = -1;
[Key(7)] public string ItemKey { get; set; } = "";
[Key(8)] public double ScalarValue { get; set; }
}
[MessagePackObject]
public sealed class AetheriaRuntimeCorporationSurveyCommit
{

View file

@ -35,7 +35,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
| 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 | owner-exists; basic lowering; composition parity absent | visual parity captures |
| HUD/schematic | ARPG HUD and `SchematicDisplay` | Eve composition from daemon facts | semantic status/components | EveUnity UI | reference | source-fact and timing matrix |
| Hit/lock/warnings | `ActionGameManager` feedback | daemon event facts | transient feedback stream | VFX/UI/audio | reference | event identity and duration |
| 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 collected/rejected/expired chronology; combat and thermal families remain missing | add hit, lock, damage, death, thermal and docking event families with runtime effect consumption |
| Assets | `Assets/Resources` | Aetheria provider | asset catalog + CultMesh CDN | runtime cache/load | wired; basic lowering; not live-proven remotely | cold/warm remote-only live load and cache 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 | incomplete; no scenario proof | fly/fire/loot/dock/trade |
@ -85,9 +85,10 @@ These are source-confirmed ownership failures, not feature backlog:
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.
3. **Client feedback lacks authoritative chronology.** Hits, lock transitions,
damage topology, weapon transitions, death causes, effects, and drops have
no complete deduplicated event stream.
3. **Client feedback chronology is incomplete.** Pickup collection, rejection,
and expiry now use a bounded deduplicated daemon ledger projected through
Eve, but hits, lock transitions, damage topology, weapon transitions, death
causes, thermal warnings, and docking effects still need event families.
4. **View composition is implicit.** Provider prefabs contain pilot and map
subviews, but portable render channels, entity presentation graphs, effects,
attachment sockets, and map products are not yet first-class contracts.