From a1e56139505a353b898a019f812e80ab396066fa Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 17 Jul 2026 07:00:23 +0100 Subject: [PATCH] Preserve contiguous damage topology --- Aetheria.State.Daemon.Smoke/Program.cs | 82 ++++++++++++++++++- .../AetheriaRuntimeDaemonSimulation.cs | 7 +- docs/aetheria-perfect-machine-map.md | 11 ++- docs/deterministic-combat-resolution.md | 8 +- docs/original-game-migration-matrix.md | 2 +- 5 files changed, 100 insertions(+), 10 deletions(-) diff --git a/Aetheria.State.Daemon.Smoke/Program.cs b/Aetheria.State.Daemon.Smoke/Program.cs index f398c54f2..7e28a4c4c 100644 --- a/Aetheria.State.Daemon.Smoke/Program.cs +++ b/Aetheria.State.Daemon.Smoke/Program.cs @@ -165,6 +165,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks CanonicalCatalogPublishesRecoveredMineLauncher, EnergyFundedShieldInterceptsDamageBeforeHull, ArmorCellsResolveBeforeEquipmentAndHull, + PenetrationStopsAtFirstHullGap, ShipSchematicProjectsDaemonTopologyAndEquipmentState, EquipmentDestructionDisablesBehaviorAndCockpitKillsBeforeHull, DestructionDropsLootExactlyOnce, @@ -3424,13 +3425,15 @@ internal sealed class AetheriaDaemonYmirSmokeChecks target.HullItemKey = "test-cell-hull"; target.Equipment = [new AetheriaRuntimeLoadoutItemSlotCommit { - X = 0, Y = 1, + X = 0, Y = 0, Rotation = "Clockwise", Item = new AetheriaRuntimeLoadoutItemCommit { ItemKey = "test-cell-gear", Quality = 1, Durability = 2, Enabled = true } }]; var hull = HullCatalogItem("test-cell-hull", 3, 3, 5); var gear = CatalogItem("test-cell-gear"); - gear.ShapeCells = [new AetheriaRuntimeShapeCell(0, 0)]; + gear.ShapeWidth = 2; + gear.ShapeHeight = 1; + gear.ShapeCells = [new AetheriaRuntimeShapeCell(1, 0)]; var catalog = new AetheriaRuntimeCatalogSnapshot([hull, gear], [], []); var zone = new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [source, target], PhysicalPayloads = [new AetheriaRuntimePhysicalPayloadCommit @@ -3452,7 +3455,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks var armor = target.StatGrids.Single(value => value.Name == "armor"); RequireNear(0, armor.Values[3], 0.000001, "source-facing splash cells must absorb damage first"); RequireNear(1.0 / 3.0, target.Equipment.Single().Item.Durability, 0.000001, - "installed equipment at the impact cell must receive residual damage second"); + "rotated installed equipment at the impact cell must receive residual damage second"); RequireNear(100 - (10.0 / 3.0), Stat(target, "hull"), 0.000001, "only residual damage after armor and equipment may reach hull durability"); var surface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build( @@ -3469,6 +3472,79 @@ internal sealed class AetheriaDaemonYmirSmokeChecks "Eve world projection must expose the exact daemon-owned schematic grid"); } + private static void PenetrationStopsAtFirstHullGap() + { + var source = Entity(0, 0, "player"); + source.DirectionX = 1; + source.VelocityX = 1; + source.TargetEntityIndex = 1; + source.Contacts = [new AetheriaRuntimeEntityContactCommit + { + TargetEntityIndex = 1, InfoGathered = 1, Hostile = true, Visible = true + }]; + source.WeaponGroups = [new[] { 0 }]; + source.Equipment = [new AetheriaRuntimeLoadoutItemSlotCommit + { + Item = new AetheriaRuntimeLoadoutItemCommit + { ItemKey = "gap-penetrator", Quality = 1, Durability = 10, Enabled = true } + }]; + var target = Entity(1, 80, "raider"); + target.HullItemKey = "disconnected-hull"; + var hull = HullCatalogItem("disconnected-hull", 3, 1, 0); + hull.ShapeCells = + [ + new AetheriaRuntimeShapeCell(0, 0), + new AetheriaRuntimeShapeCell(2, 0) + ]; + var payload = new AetheriaRuntimeBehaviorPayload(0, AetheriaRuntimeBehaviorKinds.InstantWeapon, 0, + [ + new AetheriaRuntimeBehaviorField(2, PerformanceStat(10)), + new AetheriaRuntimeBehaviorField(3, PerformanceStat(3)), + new AetheriaRuntimeBehaviorField(6, PerformanceStat(150)), + new AetheriaRuntimeBehaviorField(16, PerformanceStat(200)), + new AetheriaRuntimeBehaviorField(17, PerformanceStat(1)), + new AetheriaRuntimeBehaviorField(19, PerformanceStat(0.1)), + new AetheriaRuntimeBehaviorField(21, PerformanceStat(100)), + new AetheriaRuntimeBehaviorField(23, PerformanceStat(180)), + new AetheriaRuntimeBehaviorField(24, PerformanceStat(1)), + new AetheriaRuntimeBehaviorField(25, PerformanceStat(1)) + ]); + var catalog = new AetheriaRuntimeCatalogSnapshot( + [WearableWeaponCatalogItem("gap-penetrator", payload), hull], [], []); + var run = new AetheriaRuntimeRunCheckpointCommit + { + RunId = "penetration-gap-smoke", GenerationSeed = 0, CurrentZoneIndex = 0, + CurrentEntityKey = "zone.0.entity.0", + Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [source, target] }] + }; + var fire = new AetheriaRuntimeDaemonIntentState(); + fire.WeaponGroups.Add(new AetheriaRuntimeDaemonWeaponGroupIntent + { ActorEntityKey = run.CurrentEntityKey, WeaponGroup = 0, Fire = true, Active = true }); + + for (var frame = 0; frame < 12 && run.ShotReceipts.Count == 0; frame++) + AetheriaRuntimeDaemonSimulation.Step(run, + frame == 0 ? fire : new AetheriaRuntimeDaemonIntentState(), 0.1, + AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault, + NewPhysics(), catalog, frame, frame * 0.1); + + var receipt = run.ShotReceipts.Single(value => value.WeaponItemKey == "gap-penetrator"); + Require(receipt.Hit && receipt.DamageCells.Count == 1 && + receipt.DamageCells[0].X == 0 && receipt.DamageCells[0].Y == 0, + $"penetration must stop at the first empty hull sample instead of damaging a disconnected island; " + + $"endpoint={receipt.EndpointX:0.###},{receipt.EndpointZ:0.###} " + + $"cells={string.Join(';', receipt.DamageCells.Select(cell => $"{cell.X},{cell.Y}"))}"); + RequireNear(90, Stat(target, "hull"), 0.000001, + "a disconnected hull island must not divide or receive penetration damage beyond a gap"); + var surface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build( + new AetheriaRuntimeDaemonFrameDocument { FrameId = receipt.FrameId, Run = run }, + new AetheriaRuntimeDaemonHealthDocument(), + AetheriaRuntimeDaemonCommandBoundaryDocument.Create("daemon")); + var shot = Flatten(surface.Surface.Root).Single(node => + node.Kind == "shot.receipt" && node.Props["itemKey"] == "gap-penetrator"); + RequireEqual("1", shot.Props["damageCellCount"], + "generic Eve shot receipts must expose the daemon's contiguous penetration result"); + } + private static void ShipSchematicProjectsDaemonTopologyAndEquipmentState() { var player = Entity(0, -50, "player"); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSimulation.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSimulation.cs index c1c715346..73c5efc71 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSimulation.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSimulation.cs @@ -2534,7 +2534,8 @@ namespace GameCult.Aetheria.State.Verse pointX += penetrationX * 0.5; pointY += penetrationY * 0.5; var cell = ((int)Math.Floor(pointX), (int)Math.Floor(pointY)); - if (occupied.Contains(cell)) result.Add(cell); + if (!occupied.Contains(cell)) break; + result.Add(cell); } } return result.OrderBy(cell => cell.Y).ThenBy(cell => cell.X).ToList(); @@ -2549,7 +2550,9 @@ namespace GameCult.Aetheria.State.Verse var slot = equipment[index]; var item = catalog?.FindItem(slot.Item?.ItemKey ?? ""); if (item?.ShapeCells == null) continue; - if (item.ShapeCells.Any(cell => slot.X + cell.X == x && slot.Y + cell.Y == y)) return (slot, index); + var rotation = AetheriaRuntimeEquipmentGridGeometry.ParseRotation(slot.Rotation); + if (AetheriaRuntimeEquipmentGridGeometry.RotatedCells(item, rotation) + .Any(cell => slot.X + cell.X == x && slot.Y + cell.Y == y)) return (slot, index); } return (null, -1); } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 15ff76b63..0d5863760 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -1026,11 +1026,18 @@ lifecycle state. their respective authoritative impact facts are resolved. All behavior consumers use the shared operational-equipment query, so disabled, thermally-offline, and destroyed items cannot keep acting through a forgotten - subsystem-specific filter. + subsystem-specific filter. Equipment interception derives occupied cells + from the same rotation-aware grid geometry as refit, thermal simulation, and + Eve schematic projection. - Cut line: scalar-hull-only and caller-specific damage paths are no longer owners. Hull/hardpoint topology initializes armor grids; only the daemon transaction mutates them thereafter. Penetration always advances by a - half-cell step, eliminating the fossil's non-advancing infinite loop. + half-cell step, eliminating the fossil's non-advancing infinite loop, and + terminates at the first empty sample instead of crossing a hull gap. +- Verification: daemon smoke proves a rotated asymmetric equipment footprint + receives residual cell damage and a penetrating direct shot cannot reach a + disconnected hull island. The exact contiguous cell count remains visible in + the generic Eve shot receipt. ### Daemon Destruction Transaction diff --git a/docs/deterministic-combat-resolution.md b/docs/deterministic-combat-resolution.md index 69fdcc291..8116e3866 100644 --- a/docs/deterministic-combat-resolution.md +++ b/docs/deterministic-combat-resolution.md @@ -143,8 +143,12 @@ damage pipeline. The implemented damage transaction maps the deterministic impact onto the target schematic. Damage spread expands through orthogonally adjacent cells. Penetration advances through the schematic in 0.5-cell increments, including -the fix for the fossil path that could fail to advance and loop forever. Damage -type remains typed and is passed through state and receipts, but does not apply +the fix for the fossil path that could fail to advance and loop forever. It +stops at the first sample outside occupied hull topology, preserving the +fossil's contiguous penetration rule rather than tunnelling into a disconnected +hull island. Equipment interception uses the same rotation-aware footprint as +refit placement, thermal simulation, and schematic projection. Damage type +remains typed and is passed through state and receipts, but does not apply resistance modifiers: the fossil carried damage types but never used them for resistance. diff --git a/docs/original-game-migration-matrix.md b/docs/original-game-migration-matrix.md index 67932153a..287675d71 100644 --- a/docs/original-game-migration-matrix.md +++ b/docs/original-game-migration-matrix.md @@ -22,7 +22,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity. | Collision | fossil entity code contains no ship/station collision gameplay callback; shield collision timing is presentation | Ymir | Ymir-owned contact facts for collidable pairs; immutable entity generations for presentation | visual interpolation only | Ymir world stepping owns entity poses, radial fields, ship/pickup Begin contacts, rejection kicks, and persistent physical-payload contacts. Ship and station bodies deliberately share one negative collision group: the fossil had no rigidbody entity response, and invented circle separation would make its 25-unit center-distance docking rule unreachable. Daemon smoke advances an overlapping ship/station pair, proves the ship remains at 24 units, then accepts docking. The released EveUnity scene sink consumes immutable presented generations and has no provider/command-transport dependency; the canonical Unity product contains no Aetheria or ServerShared gameplay assembly | upstream Box3D parity harness for any future solid-body pair and live interpolation timeline under packet delay | | Targeting/contacts | sensors + `ActionGameManager` | daemon | contact/target semantics | target HUD and indicators | daemon-owned selection now preserves the executable fossil exactly, including its oddly misnamed `Target Nearest` action selecting `MaxBy(distance)`, stable visible-contact tie order, and previous-from-no-selection choosing the second-to-last distance row when at least three contacts exist. Generic Eve nearest/next/previous/reticle/clear levers route to that owner; explicit scene targeting preserves both EveUnity's `sourceEntityId` and `targetEntityId` instead of falling back to the frame's current ship. Only daemon-visible contacts can be explicitly selected, and `target-not-visible` survives into the denied Eve receipt without disturbing the prior target. Every authored instant lock behavior evaluates on every daemon step independently of trigger/burst selection, so an idle weapon cannot retain a stale completed lock; acquisition and decay derive from facing, elapsed time, and observer-local contact confidence. Smoke proves progressive acquisition, exact target-transfer loss/start chronology, authored angular decay with one loss crossing, reacquisition without replaying start, invalid-target reset, and generic Eve projection of the prior/current lock values. `weapon.lock.started`, `weapon.lock.acquired`, and `weapon.lock.lost` publish stable one-time chronology with target, weapon identity, reason, and prior/current progress through the generic feedback stream | authored reticle/HUD parity; provider audio/effect binding is visual pull work | | Projectile flight | weapon/projectile classes | Eve presentation for ordinary tracers; Ymir for persistent physical payloads | receipt trajectory/effect facts or persistent payload state | native projectile visual | ordinary instant, charged, constant, GuidedWeapon, and Launcher execution creates no projectile body; each weapon state owns a stable shot sequence and receipts carry origin, endpoint, nominal duration, and effect identity for Eve presentation. Guided receipts additionally retain target-entity/look-direction mode, complete guidance/thrust/lift curves, evaluated thrust and top speed, and dodge frequency; these survive checkpoint restart and reach generic Eve shot facts. The fossil guided projectile only steered, split, faded, and selected hit visuals after the ordinary weapon event had committed damage, so the client path remains derived presentation rather than a Ymir gameplay body. `SpawnProjectile` and its alternate writer are deleted; Ymir projectile contacts are feedback-only for explicitly persisted payload rows and cannot write damage; Ymir.Core remains embedded for world integration, radial fields, circle contacts, pickups, and genuinely persistent/interceptable payloads | generic guided trajectory lowering, provider split/fade asset parameters, and removal of ordinary projectile terminology from runtime contracts | -| Shield/armor/equipment/hull damage | energy-funded shield, schematic armor cells, equipment and scalar hull | daemon canonical damage transaction | aggregate/exact armor grid, entity status, and layer-aware shot/damage receipts | schematic, meters, impacts, damage VFX | owner-exists; wired; exclusive; projected: daemon initializes armor/maximum-armor grids from hull plus hardpoint catalog topology; direct and deployable damage share one `shield -> armor cell -> equipment -> scalar hull` transaction; direct impacts select a cell or complete hardpoint footprint before orthogonal spread and 0.5-cell penetration, while splash payloads select the source-facing hull half; the fossil penetration infinite-loop defect is fixed; damage type is typed/pass-through without resistances because the fossil never applied them; Eve exposes aggregate and exact armor state and receipts identify reached/applied layers; fake Ymir contacts and presentation cannot decide damage | fossil parity fixtures for topology, edge impacts, orthogonal spread, multi-cell penetration, equipment interception, and generic shield/equipment effect lifecycle | +| Shield/armor/equipment/hull damage | energy-funded shield, schematic armor cells, equipment and scalar hull | daemon canonical damage transaction | aggregate/exact armor grid, entity status, and layer-aware shot/damage receipts | schematic, meters, impacts, damage VFX | owner-exists; wired; exclusive; projected: daemon initializes armor/maximum-armor grids from hull plus hardpoint catalog topology; direct and deployable damage share one `shield -> armor cell -> equipment -> scalar hull` transaction; direct impacts select a cell or complete hardpoint footprint before orthogonal spread and contiguous 0.5-cell penetration that stops at the first hull gap, while splash payloads select the source-facing hull half; rotated equipment interception shares the refit/thermal/schematic footprint owner; the fossil penetration infinite-loop defect is fixed; damage type is typed/pass-through without resistances because the fossil never applied them; Eve exposes aggregate and exact armor state and receipts identify reached/applied layers; fake Ymir contacts and presentation cannot decide damage | fossil parity fixtures for edge impacts, orthogonal spread, multi-cell penetration depth, and generic shield/equipment effect lifecycle | | Thermal/energy | cell conduction, capacitor/reactor/radiator network, and cockpit thermal exposure | daemon | ship/equipment power, temperature, medical state, risk and death feedback | schematic/post effects | owner-exists; wired; exclusive; projected; generic timing and native asset delivery lowered: catalog hull and installed-item shapes derive cell mass/conductivity/topology; local temperature derives thermal performance, wear potential and online state; all consumers share capacitor-first/reactor-residual transactions; powered radiators pump before reactor settlement; reactor heat then enters the same cell network before conduction/radiation; cockpit-cell temperature drives the fossil nonlinear heatstroke/hypothermia accumulation, linear recovery, severe-risk crossings, and ordinary exactly-once destruction with a typed cause; Eve exposes cockpit, risk, heatstroke source-weight, phasing and death-transition facts; EveUnity generically resolves the original severe pulse plus live/reconnect-safe cause-specific death crossfade; Aetheria deterministically translates the five legacy profiles into URP profiles, persists every override as a real profile sub-asset, advertises them by semantic role through CultMesh CDN, and binds them in the canonical client through a weight-only native sink; rotated equipment topology, parent/child radiation, schematic composition, legacy SSR/AO/roundness equivalents, and live/reconnect death-fade parity remain incomplete | multi-consumer ordering, multi-radiator visibility, rotated topology, generic schematic meters, renderer-feature parity, and live/reconnect death-fade screenshots | | Weapons | ServerShared behaviors + Unity effects | daemon plus Ymir geometry/kinematics | action capability, weapon state, shot/damage receipts | effects/audio/HUD | instant and constant resource/timing lifecycles are daemon-owned; charged weapons accept one semantic request, spool without requiring a solution, hold at full charge, commit automatically when a solution appears, and perform deterministic once-per-second malfunction hazard checks after the authored safe hold interval with increasing persisted risk; successful instant, constant, charged, deployable, and turret-controlled transactions publish authored transient visibility and consume the owning equipment's temperature-derived wear, with charged visibility applying its authored multiplier and turret wear remaining exact-weapon scoped; GuidedWeapon and Launcher retain ordinary authoritative shot resolution while publishing their complete fossil steering profile as derived presentation; generic Eve `weapon.state` exposes charge hold/risk and feedback exposes readiness, commit, refusal, and malfunction chronology; committed direct damage now enters the shared daemon armor-cell transaction | remaining impact-distribution parity, generic guided/effect lowering, and Unity effect reconciliation | | Destruction/drops | hull death, 25% equipment rolls, unconditional cargo drops, 25-unit launch, 30-second pickups | daemon | destruction identity, death/drop events, typed pickups | provider-advertised destruction effect and pickups | owner-exists; wired; exclusive; projected: direct and deployable lethal damage commit one deterministic destruction transaction, clear live references, retain only a non-rendered identity tombstone, and emit exact pickups/events; residual cell damage destroys installed equipment before hull, disables its behaviors immediately, and cockpit destruction kills with its fossil cause before scalar hull depletion; the reserved client `DestroyEntity` command is rejected; Aetheria advertises its original big explosion as `effect.feedback.entity.destroyed`, lowered generically by EveUnity | multiplayer reconnect chronology |