Publish authoritative combat feedback events

This commit is contained in:
Meta Vens 2026-07-11 19:22:14 +01:00
commit 6c0c035ee0
5 changed files with 50 additions and 10 deletions

View file

@ -12,6 +12,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
{
YmirMovesProjectileAndReportsStableContact();
DaemonSimulationAppliesYmirHit();
ProjectileDeathEmitsOnce();
MissingPhysicsOwnerCannotAdvanceProjectiles();
MissingWorldPhysicsOwnerCannotAdvanceShips();
TractorRampsAndPullsThroughYmirWithoutTeleportingCargo();
@ -524,6 +525,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
Require(sawTargetCommand, "attack agent must target through the shared target command");
Require(sawFireCommand, "attack agent must fire through the shared weapon-group command");
Require(run.GameEvents.Any(value => value.Kind == "projectile.launched" && value.SourceEntityIndex == agent.EntityIndex),
"accepted fire control must emit authoritative projectile launch chronology");
Require(!target.IsActive,
$"attack task must end through daemon damage after Ymir projectile contacts; hull={Stat(target, "hull"):0.###} " +
$"agent={agent.PositionX:0.###},{agent.PositionZ:0.###} target={target.PositionX:0.###},{target.PositionZ:0.###} " +
@ -760,6 +763,27 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
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");
RequireEqual(1, run.GameEvents.Count(value => value.Kind == "projectile.impact" && value.SubjectKey == "smoke-projectile"),
"Ymir contact must emit one projectile-identity impact event");
RequireEqual(1, run.GameEvents.Count(value => value.Kind == "entity.damaged" && value.TargetEntityIndex == target.EntityIndex),
"daemon damage interpretation must emit one target damage event");
var feedback = AetheriaRuntimeDaemonGameSurfaceBuilder.Build(
new AetheriaRuntimeDaemonFrameDocument { FrameId = 0, Run = run },
new AetheriaRuntimeDaemonHealthDocument(),
AetheriaRuntimeDaemonCommandBoundaryDocument.Create("daemon"));
Require(Flatten(feedback.Surface.Root).Any(node => node.Kind == "feedback.event" && node.Props["eventKind"] == "projectile.impact" && node.Props["subjectKey"] == "smoke-projectile"),
"Eve feedback must project authoritative projectile impact identity");
}
private static void ProjectileDeathEmitsOnce()
{
var (run, _, target) = Scenario();
target.StatGrids.Single(grid => grid.Name == "hull").Values = [5];
AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1,
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault, new AetheriaYmirProjectilePhysics(), new AetheriaYmirWorldPhysics(), frameId: 9);
Require(!target.IsActive, "lethal Ymir projectile contact must deactivate target");
RequireEqual(1, run.GameEvents.Count(value => value.Kind == "entity.destroyed" && value.TargetEntityIndex == target.EntityIndex),
"alive-to-dead transition must emit one destruction event");
}
private static void MissingPhysicsOwnerCannotAdvanceProjectiles()

View file

@ -231,6 +231,8 @@ namespace GameCult.Aetheria.State.Verse
("targetEntityIndex", value.TargetEntityIndex.ToString(CultureInfo.InvariantCulture)),
("pickupIndex", value.PickupIndex.ToString(CultureInfo.InvariantCulture)),
("itemKey", value.ItemKey), ("scalarValue", FormatNumber(value.ScalarValue)),
("subjectKey", value.SubjectKey),
("position", string.Join(",", new[] { FormatNumber(value.PositionX), FormatNumber(value.PositionZ) })),
("currentFrameId", frameId.ToString(CultureInfo.InvariantCulture))
}))
.ToArray();

View file

@ -53,7 +53,7 @@ namespace GameCult.Aetheria.State.Verse
StepTargetPursuit(entities, settings);
var worldStep = StepWorldPhysics(zone, entities, deltaSeconds, worldPhysics);
ResolvePickupContacts(run, zone, entities, worldStep, catalog, frameId);
StepCombat(run, zone, entities, intents, deltaSeconds, settings, projectilePhysics);
StepCombat(run, zone, entities, intents, deltaSeconds, settings, projectilePhysics, frameId);
AetheriaRuntimeMiningSimulation.Step(run, zone, entities, intents, catalog, frameId, simulationTimeSeconds, deltaSeconds);
AetheriaRuntimeSurveySimulation.Step(run, zone, entities, intents, catalog, frameId, simulationTimeSeconds, deltaSeconds);
RefreshContacts(entities, settings);
@ -232,7 +232,8 @@ namespace GameCult.Aetheria.State.Verse
AetheriaRuntimeDaemonIntentState intents,
double deltaSeconds,
AetheriaRuntimeDaemonSimulationSettings settings,
IAetheriaRuntimeProjectilePhysics projectilePhysics)
IAetheriaRuntimeProjectilePhysics projectilePhysics,
long frameId)
{
var byIndex = entities.ToDictionary(entity => entity.EntityIndex);
foreach (var attacker in entities)
@ -264,7 +265,8 @@ namespace GameCult.Aetheria.State.Verse
if (IsPlayerOwned(attacker) && !WantsFire(run, zone, attacker, intents))
continue;
SpawnProjectile(zone, attacker, target, settings);
var projectile = SpawnProjectile(zone, attacker, target, settings);
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"projectile:{projectile.ProjectileId}:launched", Kind = "projectile.launched", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = attacker.EntityIndex, TargetEntityIndex = target.EntityIndex, SubjectKey = projectile.ProjectileId, ItemKey = projectile.WeaponKind, ScalarValue = projectile.Damage, PositionX = projectile.PositionX, PositionZ = projectile.PositionZ });
weaponState.Firing = true;
weaponState.CoolingDown = true;
weaponState.CooldownProgress = settings.WeaponCooldownSeconds;
@ -283,7 +285,14 @@ namespace GameCult.Aetheria.State.Verse
foreach (var hit in projectileStep.Hits)
{
if (byIndex.TryGetValue(hit.TargetEntityIndex, out var target))
{
var aliveBefore = IsAlive(target);
Damage(target, hit.Projectile.Damage);
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"projectile:{hit.Projectile.ProjectileId}:impact", Kind = "projectile.impact", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = hit.Projectile.SourceEntityIndex, TargetEntityIndex = target.EntityIndex, SubjectKey = hit.Projectile.ProjectileId, ItemKey = hit.Projectile.WeaponKind, ScalarValue = hit.Projectile.Damage, PositionX = hit.PointX, PositionZ = hit.PointZ });
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"projectile:{hit.Projectile.ProjectileId}:damage", Kind = "entity.damaged", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = hit.Projectile.SourceEntityIndex, TargetEntityIndex = target.EntityIndex, SubjectKey = hit.Projectile.ProjectileId, ScalarValue = hit.Projectile.Damage, PositionX = hit.PointX, PositionZ = hit.PointZ });
if (aliveBefore && !IsAlive(target))
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"projectile:{hit.Projectile.ProjectileId}:destroyed:{target.EntityIndex}", Kind = "entity.destroyed", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = hit.Projectile.SourceEntityIndex, TargetEntityIndex = target.EntityIndex, SubjectKey = hit.Projectile.ProjectileId, PositionX = hit.PointX, PositionZ = hit.PointZ });
}
}
foreach (var entity in entities)
@ -397,7 +406,7 @@ namespace GameCult.Aetheria.State.Verse
return state;
}
private static void SpawnProjectile(
private static AetheriaRuntimeProjectileCommit SpawnProjectile(
AetheriaRuntimeZoneSnapshotCommit zone,
AetheriaRuntimeEntitySnapshotCommit attacker,
AetheriaRuntimeEntitySnapshotCommit target,
@ -412,7 +421,7 @@ namespace GameCult.Aetheria.State.Verse
var projectiles = (zone.Projectiles ?? Array.Empty<AetheriaRuntimeProjectileCommit>())
.Where(projectile => projectile != null && projectile.Active)
.ToList();
projectiles.Add(new AetheriaRuntimeProjectileCommit
var projectile = new AetheriaRuntimeProjectileCommit
{
ProjectileId = CreateProjectileId(zone, attacker, target, projectiles.Count),
SourceEntityIndex = attacker.EntityIndex,
@ -431,8 +440,10 @@ namespace GameCult.Aetheria.State.Verse
Guided = true,
Active = true,
WeaponKind = IsPlayerOwned(attacker) ? "vanguard-bolt" : "raider-bolt"
});
};
projectiles.Add(projectile);
zone.Projectiles = projectiles.ToArray();
return projectile;
}
private static string CreateProjectileId(

View file

@ -443,6 +443,9 @@ namespace GameCult.Aetheria.State.Verse
[Key(6)] public int PickupIndex { get; set; } = -1;
[Key(7)] public string ItemKey { get; set; } = "";
[Key(8)] public double ScalarValue { get; set; }
[Key(9)] public string SubjectKey { get; set; } = "";
[Key(10)] public double PositionX { get; set; }
[Key(11)] public double PositionZ { get; set; }
}
[MessagePackObject]

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 | 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 |
| 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 plus projectile launch/impact, entity damage and alive-to-dead destruction chronology | add lock transitions, 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 |
@ -86,9 +86,9 @@ These are source-confirmed ownership failures, not feature backlog:
broad equipment/behavior state while active simulation executes one
synthetic projectile weapon and simplified raider pursuit.
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.
expiry, projectile launch/impact, damage, and destruction now use a bounded
deduplicated daemon ledger projected through Eve, but lock transitions,
damage topology, 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.