From dedfe71f11e9b8acac90e51363279837cc7b5576 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 17 Jul 2026 03:40:58 +0100 Subject: [PATCH] Gate turret controllers through behavior chains --- Aetheria.State.Daemon.Smoke/Program.cs | 26 ++++++++++++++++--- ...theriaRuntimeTurretControllerSimulation.cs | 2 +- docs/aetheria-perfect-machine-map.md | 12 ++++++--- docs/original-game-migration-matrix.md | 2 +- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Aetheria.State.Daemon.Smoke/Program.cs b/Aetheria.State.Daemon.Smoke/Program.cs index ea6ea01ef..a11213412 100644 --- a/Aetheria.State.Daemon.Smoke/Program.cs +++ b/Aetheria.State.Daemon.Smoke/Program.cs @@ -957,8 +957,14 @@ internal sealed class AetheriaDaemonYmirSmokeChecks var weaponItem = CatalogItem("turret-smoke-weapon", weaponPayload); var controllerItem = CatalogItem( "turret-smoke-controller", - new AetheriaRuntimeBehaviorPayload(0, AetheriaRuntimeBehaviorKinds.TurretController, 0, [])); - var catalog = new AetheriaRuntimeCatalogSnapshot([controllerItem, weaponItem], [], []); + new AetheriaRuntimeBehaviorPayload(0, "EnergyDraw", 0, + [ + new AetheriaRuntimeBehaviorField(1, PerformanceStat(5)), + new AetheriaRuntimeBehaviorField(2, BoolValue(false)) + ]), + new AetheriaRuntimeBehaviorPayload(1, AetheriaRuntimeBehaviorKinds.TurretController, 0, [])); + var capacitorItem = CatalogItem("turret-smoke-capacitor", CapacitorPayload(20, 1)); + var catalog = new AetheriaRuntimeCatalogSnapshot([controllerItem, weaponItem, capacitorItem], [], []); var uncontrolled = Entity(0, 0, "raider"); uncontrolled.DirectionX = 1; @@ -1014,6 +1020,11 @@ internal sealed class AetheriaDaemonYmirSmokeChecks Rotation = "Half", Item = new AetheriaRuntimeLoadoutItemCommit { ItemKey = weaponItem.ItemKey, Quality = 1, Durability = 1, Enabled = true } + }, + new AetheriaRuntimeLoadoutItemSlotCommit + { + Item = new AetheriaRuntimeLoadoutItemCommit + { ItemKey = capacitorItem.ItemKey, Quality = 1, Durability = 1, Enabled = true } } ]; turret.WeaponGroups = [new[] { 1, 2 }]; @@ -1027,12 +1038,21 @@ internal sealed class AetheriaDaemonYmirSmokeChecks { AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1, new AetheriaRuntimeDaemonSimulationSettings(), physics, catalog, 0, 0); + RequireEqual(-1, turret.TargetEntityIndex, + "an unfunded controller must remain unreachable behind its authored EnergyDraw gate"); + RequireEqual(0, run.ShotReceipts.Count, + "an unfunded controller must not aim or trigger weapons behind the behavior chain"); + + var capacitor = turret.BehaviorStates.Single(state => state.BehaviorKind == "Capacitor"); + capacitor.CapacitorCharge = 20; + AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1, + new AetheriaRuntimeDaemonSimulationSettings(), physics, catalog, 1, 0.1); RequireEqual(target.EntityIndex, turret.TargetEntityIndex, "an idle turret controller must acquire the first visible hostile ship without firing on the acquisition tick"); RequireEqual(0, run.ShotReceipts.Count, "target acquisition must not smuggle an extra trigger into the same fossil controller tick"); AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1, - new AetheriaRuntimeDaemonSimulationSettings(), physics, catalog, 1, 0.1); + new AetheriaRuntimeDaemonSimulationSettings(), physics, catalog, 2, 0.2); } var controllerState = turret.BehaviorStates.Single(state => diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTurretControllerSimulation.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTurretControllerSimulation.cs index 998c0a472..5209a0536 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTurretControllerSimulation.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTurretControllerSimulation.cs @@ -25,7 +25,7 @@ namespace GameCult.Aetheria.State.Verse IReadOnlyList entities, AetheriaRuntimeCatalogSnapshot? catalog) { - var controllers = AetheriaRuntimeEquippedBehaviorQueries.FindOperational( + var controllers = AetheriaRuntimeEquippedBehaviorQueries.FindExecuting( entity, catalog, AetheriaRuntimeBehaviorKinds.TurretController); if (controllers.Count == 0) return Array.Empty(); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 6364b98ef..8f8e52ebc 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -881,12 +881,13 @@ lifecycle state. ### Daemon Orbital Turret Controller -- Owner: each operational installed `TurretController` behavior owns automatic +- Owner: each chain-admitted operational installed `TurretController` behavior owns automatic target acquisition, predictive look direction, and its exact per-weapon trigger set. Ship agent combat remains owned by the task planner and pilot fire remains an accepted command; neither path impersonates an orbital controller. -- Inputs: visible hostile ship contacts in stable zone order, current target, +- Inputs: authored preceding behavior-chain gates, including the canonical + `EnergyDraw`; visible hostile ship contacts in stable zone order, current target, entity and target pose/velocity, operational weapon behaviors, evaluated weapon range and velocity, and catalog placement rotation. - Outputs: selected target, daemon look direction, reconnectable controller @@ -898,13 +899,16 @@ lifecycle state. shot receipts, and feedback chronology. - Forbidden writers: faction identity, entity kind, Unity update loops, and generic Eve lowerers cannot grant automatic fire. The deleted non-player - group-zero fallback is not a compatibility path. + group-zero fallback is not a compatibility path. Mere installation cannot + bypass a refused behavior-chain resource gate. - Shared paths: pilot and ship-agent group commands expand to every weapon behavior on their assigned equipment; turret control requests only the exact aligned in-range behavior. All then enter the same lock, charge, burst, energy, heat, wear, visibility, shot, and damage transactions. - Verification: daemon smoke proves no controller/no command means no hostile - auto-fire; acquisition does not fire in the same fossil tick; projectile + auto-fire; an empty capacitor prevents acquisition, aim, and fire through the + canonical `EnergyDraw -> TurretController` chain; restored power acquires + without firing in the same fossil tick; projectile velocity enables CultMath first-order intercept; and a forward weapon fires while the reversed behavior remains inactive. diff --git a/docs/original-game-migration-matrix.md b/docs/original-game-migration-matrix.md index 7067d2cd1..74692e1b2 100644 --- a/docs/original-game-migration-matrix.md +++ b/docs/original-game-migration-matrix.md @@ -45,7 +45,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity. | 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 | | Behavior engine | `ServerShared/Behaviors` composition | daemon | executable action/status projection | action bar and feedback | tick reconciles equipped catalog payloads into persistent behavior state; `Switch`, one-shot `Trigger`, normalized `Cooldown`, adjustable high/low-pass `Thermotoggle`, `EnergyDraw`, equipment `Heat`, atomic `ItemUsage`, and thermal `Wear` execute in authored group order and stop downstream effects on refusal; each row records whether the chain reached it. `Thruster`, rare `AetherDrive`, and `Radiator` now pause their groups at the specialized owner, report the exact fossil success result, and resume common tails at most once, so idle or unfunded actuators cannot consume wear; radiator emission remains its independent always-update path. Cooldown projects generic progress and thermostat target is daemon-commanded state seeded from authored data. Equipped and timed-consumable `StatModifier` sources persist daemon-owned lifecycle state and every runtime stat reader applies the fossil `base × multiplier product + constant sum` rule through one query; legacy `Data` kind references and required-behavior filters are honored | remaining specialized return-value composition and canonical consumable-content proof | | Sensors/visibility | installed sensor sensitivity and angular curve, `Visibility`, `Reflector`, decaying signature sources, stellar light, ping state, and observer information thresholds | daemon | accumulated contacts, named visibility sources, and ping events | indicators/maps and provider environment lowering | every operational installed Sensor executes the fossil visibility/sensitivity/angle/distance information equation and decay; visibility is thresholded by the provider setting. Actor-scoped ping owns energy, cooldown, expansion radius, reconnect-stable crossed-target state, one-time information boost, and transient signature. Operational `Visibility` equipment publishes evaluated constant signature; committed weapons publish authored signature including charged-shot multiplication; transient weapon and ping sources decay by the fossil exponential rule. Reflectors multiply evaluated cross-section by the exponent-8 stellar `PowerPulse` after thermal settlement. Gameplay light and environment projection share resolved authored orbit/body centers and provider-owned sun radius inputs. Contact refresh no longer invents perfect information or overwrites emitted visibility; docked craft consume one daemon-derived union of craft and dock-parent contacts through both Eve rows and SoA bodies, with sensor-source provenance | active consumable visibility/reflector effects, complete source cardinality, classification timelines, and canonical catalog station-array data | -| AI/tasks | corporation task scheduler plus agent state machines and installed orbital `TurretController` | daemon | commander task board, corporation survey ledger, controller aim/state, and shared semantic controls | Eve commander/pilot clients | point exploration, loadout-driven attack, haul, mining/offload, resource surveying, physical station towing, persistent orbit patrol, route-aware assignment, and autonomous return home are wired through shared commands. Ship combat samples the fossil DPS/range policy, selects live weapon groups, leads projectiles, strafes relative to target attitude, and gates fire on catalog placement rotation. Operational orbital controllers independently acquire the first visible hostile ship, publish predictive look direction, and trigger only exact aligned in-range weapon behaviors through the shared combat lifecycle; non-player identity no longer grants implicit group-zero fire. Cross-zone task and home routes survive the full daemon-owned wormhole timeline; attack admission rejects missing/friendly targets and unavailable weapon groups before durable queueing | cancellation, reconnect, multi-client command transfer, and model-local barrel-direction metadata | +| AI/tasks | corporation task scheduler plus agent state machines and installed orbital `TurretController` | daemon | commander task board, corporation survey ledger, controller aim/state, and shared semantic controls | Eve commander/pilot clients | point exploration, loadout-driven attack, haul, mining/offload, resource surveying, physical station towing, persistent orbit patrol, route-aware assignment, and autonomous return home are wired through shared commands. Ship combat samples the fossil DPS/range policy, selects live weapon groups, leads projectiles, strafes relative to target attitude, and gates fire on catalog placement rotation. Chain-admitted orbital controllers independently acquire the first visible hostile ship, publish predictive look direction, and trigger only exact aligned in-range weapon behaviors through the shared combat lifecycle; the canonical preceding `EnergyDraw` now blocks acquisition, aim, and fire when power is unavailable, and non-player identity grants no implicit group-zero fire. Cross-zone task and home routes survive the full daemon-owned wormhole timeline; attack admission rejects missing/friendly targets and unavailable weapon groups before durable queueing | cancellation, reconnect, multi-client command transfer, and model-local barrel-direction metadata | | Consumables | cargo-backed timed behavior containers | daemon | dynamic actions, active effects, and lifecycle facts | action bar/schematic | daemon atomically resolves typed metadata and concrete cargo, preserves consumed-instance quality, enforces authored stacking, evaluates effectiveness/quality, and executes ordered `EnergyDraw`, fossil-compatible no-op `Heat`, `ItemUsage`, and stateful `Cooldown` payloads after energy tick initialization; every effect and payload state has stable authored identity; cooldowns update before the ordered chain, require state strictly below zero, reset to one on success, and continue aging behind earlier failures; false and unsupported payloads stop later execution with a typed fact; timers retain the fossil's exact-zero final tick; Unity reconciles presentation by effect identity and cannot restore active behavior state by list index | catalog revision pinning, stat modifiers, remaining behavior families, and reconnect presentation proof | ## Ownership Invariants