Prove durable loadout reconnect fidelity
This commit is contained in:
parent
d6562f69cb
commit
b32487a03b
3 changed files with 243 additions and 1 deletions
|
|
@ -193,6 +193,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
TradeSaleIsDaemonPricedSpatialAndAtomic,
|
||||
StationBodiesCannotConsumePickups,
|
||||
PickupShieldContactCollectsOrBounces,
|
||||
CultCacheRestartPreservesLoadoutAndBehaviorState,
|
||||
YmirRestartDoesNotReplayConsumedPickupContact,
|
||||
ThermalCellsUseFossilConductionAndRadiation,
|
||||
EnergyNetworkSettlesReactorAfterConsumers,
|
||||
|
|
@ -6937,6 +6938,222 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
throw new InvalidOperationException($"{message}. Expected {expected}; actual {actual}.");
|
||||
}
|
||||
|
||||
private static void CultCacheRestartPreservesLoadoutAndBehaviorState()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "aetheria-loadout-restart-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(root);
|
||||
var statePath = Path.Combine(root, "world.cc");
|
||||
try
|
||||
{
|
||||
var controller = CatalogItem("reconnect-controller",
|
||||
new AetheriaRuntimeBehaviorPayload(0, "Thermotoggle", 0,
|
||||
[
|
||||
new AetheriaRuntimeBehaviorField(1, Number(300)),
|
||||
new AetheriaRuntimeBehaviorField(2, BoolValue(false)),
|
||||
new AetheriaRuntimeBehaviorField(3, BoolValue(true))
|
||||
]));
|
||||
controller.Name = "Reconnect Controller";
|
||||
var catalog = new AetheriaRuntimeCatalogSnapshot([controller], [], []);
|
||||
var ship = Entity(0, 0, "player");
|
||||
ship.HullItemKey = "reconnect-hull";
|
||||
ship.Equipment =
|
||||
[
|
||||
new AetheriaRuntimeLoadoutItemSlotCommit
|
||||
{
|
||||
X = 3,
|
||||
Y = 4,
|
||||
Rotation = "CounterClockwise",
|
||||
Item = new AetheriaRuntimeLoadoutItemCommit
|
||||
{
|
||||
ItemKey = controller.ItemKey,
|
||||
Quality = 0.73,
|
||||
Durability = 0.61,
|
||||
Quantity = 1,
|
||||
Enabled = true,
|
||||
OverrideShutdown = true,
|
||||
Temperature = 417
|
||||
}
|
||||
}
|
||||
];
|
||||
ship.CargoBays =
|
||||
[
|
||||
new AetheriaRuntimeLoadoutItemSlotCommit
|
||||
{
|
||||
Item = new AetheriaRuntimeLoadoutItemCommit
|
||||
{
|
||||
ItemKey = "reconnect-cargo-bay",
|
||||
Quantity = 1,
|
||||
Quality = 1,
|
||||
Durability = 1,
|
||||
Enabled = true
|
||||
}
|
||||
}
|
||||
];
|
||||
ship.CargoContents = [Cargo(("reconnect-salvage", 7, 2, 1))];
|
||||
ship.WeaponGroups = [new[] { 0 }];
|
||||
ship.ActiveWeaponGroups = [true];
|
||||
ship.EquipmentStates =
|
||||
[
|
||||
new AetheriaRuntimeEquipmentStateCommit
|
||||
{
|
||||
EquipmentIndex = 0,
|
||||
Temperature = 417,
|
||||
PreviousTemperature = 410,
|
||||
ThermalPerformance = 0.8,
|
||||
DurabilityPerformance = 0.61,
|
||||
Wear = 0.12,
|
||||
ThermalOnline = true,
|
||||
DurabilityOnline = true,
|
||||
Online = true
|
||||
}
|
||||
];
|
||||
ship.BehaviorStates =
|
||||
[
|
||||
new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
OwnerKind = AetheriaRuntimeBehaviorStateProjector.EquipmentOwnerKind,
|
||||
OwnerIndex = 0,
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = "Thermotoggle",
|
||||
ThermotoggleTargetTemperature = 412,
|
||||
ChainReached = true,
|
||||
ChainSucceeded = true,
|
||||
ChainCompleted = true
|
||||
}
|
||||
];
|
||||
ship.WeaponStates =
|
||||
[
|
||||
new AetheriaRuntimeWeaponStateCommit
|
||||
{
|
||||
OwnerKind = "equipment",
|
||||
OwnerIndex = 0,
|
||||
BehaviorIndex = 1,
|
||||
BehaviorKind = AetheriaRuntimeBehaviorKinds.InstantWeapon,
|
||||
Ammo = 9,
|
||||
CooldownProgress = 0.37,
|
||||
LockProgress = 0.82,
|
||||
LockTargetEntityIndex = 4,
|
||||
ShotSequence = 23
|
||||
}
|
||||
];
|
||||
ship.ActiveConsumables =
|
||||
[
|
||||
new AetheriaRuntimeActiveConsumableCommit
|
||||
{
|
||||
EffectId = "effect:reconnect-tonic:1",
|
||||
ItemKey = "reconnect-tonic",
|
||||
Quality = 0.67,
|
||||
Duration = 30,
|
||||
RemainingDuration = 12,
|
||||
BehaviorStates =
|
||||
[
|
||||
new AetheriaRuntimeConsumableBehaviorStateCommit
|
||||
{
|
||||
BehaviorId = "tonic-modifier",
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = AetheriaRuntimeBehaviorKinds.StatModifier,
|
||||
ScalarState = 0.42,
|
||||
StatModifierApplied = true,
|
||||
StatModifierExecuted = true,
|
||||
StatModifierTargetStatCount = 3
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
ship.LoadoutGeneration = new AetheriaRuntimeLoadoutGenerationReceiptCommit
|
||||
{
|
||||
Seed = 0xA37E,
|
||||
SourceZoneIndex = 2,
|
||||
AvailabilityFactionKey = "player",
|
||||
PriceExponent = 0.25,
|
||||
Selections =
|
||||
[
|
||||
new AetheriaRuntimeLoadoutGenerationSelectionCommit
|
||||
{
|
||||
Role = "controller",
|
||||
ItemKey = controller.ItemKey,
|
||||
ManufacturerKey = "player",
|
||||
Price = 1200,
|
||||
ManufacturerDistance = 1,
|
||||
Allegiance = 0.9
|
||||
}
|
||||
]
|
||||
};
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit
|
||||
{
|
||||
RunId = "loadout-restart-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [ship] }]
|
||||
};
|
||||
run.CurrentEntityKey = run.EntityRecordKey(0, ship.EntityIndex);
|
||||
var frame = AetheriaRuntimeDaemonFrameDocument.Create(
|
||||
run, "smoke", "loadout-restart", 41, 4.1, 0.1);
|
||||
|
||||
using (var node = AetheriaStateNode.OpenAsync(statePath).GetAwaiter().GetResult())
|
||||
{
|
||||
node.MutableDocument<AetheriaRuntimeDaemonFrameDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)
|
||||
.ReplaceAsync(frame).GetAwaiter().GetResult();
|
||||
node.FlushAsync(soft: false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
using (var node = AetheriaStateNode.OpenAsync(statePath).GetAwaiter().GetResult())
|
||||
{
|
||||
var durable = node.MutableDocument<AetheriaRuntimeDaemonFrameDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)
|
||||
.ReadAsync().GetAwaiter().GetResult()
|
||||
?? throw new InvalidOperationException("Durable loadout restart frame is missing.");
|
||||
var restored = durable.Run.Zones.Single().Entities.Single();
|
||||
var installed = restored.Equipment.Single();
|
||||
RequireEqual("reconnect-hull", restored.HullItemKey,
|
||||
"CultCache restart must preserve daemon-owned hull identity");
|
||||
Require(installed.X == 3 && installed.Y == 4 && installed.Rotation == "CounterClockwise",
|
||||
"CultCache restart must preserve exact equipment placement and rotation");
|
||||
RequireNear(0.73, installed.Item.Quality, 0.000001,
|
||||
"CultCache restart must preserve installed item quality");
|
||||
RequireNear(0.61, installed.Item.Durability, 0.000001,
|
||||
"CultCache restart must preserve installed item durability");
|
||||
Require(installed.Item.OverrideShutdown && installed.Item.Temperature == 417,
|
||||
"CultCache restart must preserve per-instance thermal controls");
|
||||
RequireEqual(7, restored.CargoContents.Single().Items.Single().Item.Quantity,
|
||||
"CultCache restart must preserve cargo stack quantity");
|
||||
Require(restored.WeaponGroups.Single().SequenceEqual(new[] { 0 }) &&
|
||||
restored.ActiveWeaponGroups.SequenceEqual(new[] { true }),
|
||||
"CultCache restart must preserve weapon membership and held state");
|
||||
RequireNear(0.12, restored.EquipmentStates.Single().Wear, 0.000001,
|
||||
"CultCache restart must preserve equipment wear state");
|
||||
RequireNear(412, restored.BehaviorStates.Single().ThermotoggleTargetTemperature, 0.000001,
|
||||
"CultCache restart must preserve executable behavior state");
|
||||
Require(restored.BehaviorStates.Single().ChainCompleted,
|
||||
"CultCache restart must preserve specialized chain chronology");
|
||||
Require(restored.WeaponStates.Single().ShotSequence == 23 &&
|
||||
restored.WeaponStates.Single().Ammo == 9,
|
||||
"CultCache restart must preserve weapon chronology and ammunition");
|
||||
var consumableState = restored.ActiveConsumables.Single().BehaviorStates.Single();
|
||||
Require(consumableState.StatModifierApplied && consumableState.StatModifierExecuted &&
|
||||
consumableState.StatModifierTargetStatCount == 3,
|
||||
"CultCache restart must preserve active consumable execution state");
|
||||
Require(restored.LoadoutGeneration?.Selections.Single().ItemKey == controller.ItemKey,
|
||||
"CultCache restart must preserve generated-loadout provenance");
|
||||
|
||||
var capability = AetheriaRuntimeInputCapabilityDocument.FromFrame(
|
||||
durable, catalog: catalog);
|
||||
RequireEqual("1", capability.Actions.Single(action =>
|
||||
action.ActionId == "weapon-group.0.fire").Payload["currentValue"],
|
||||
"generic Eve reconnect must observe the daemon-owned held weapon state");
|
||||
RequireNear(412, capability.Actions.Single(action =>
|
||||
action.ActionId == "equipment.0.behavior.0").InputValue?.CurrentValue ?? double.NaN,
|
||||
0.000001,
|
||||
"generic Eve reconnect must observe the daemon-owned thermostat target");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(root))
|
||||
Directory.Delete(root, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void YmirRestartDoesNotReplayConsumedPickupContact()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "aetheria-ymir-restart-" + Guid.NewGuid().ToString("N"));
|
||||
|
|
|
|||
|
|
@ -887,6 +887,31 @@ one `weapon.lock.acquired`, and one `shot.committed` event. Ymir reconstructs
|
|||
process-local bodies from committed world state; it does not own weapon
|
||||
lifecycle state.
|
||||
|
||||
### Durable Loadout Restart Contract
|
||||
|
||||
- Owner: `AetheriaRuntimeDaemonFrameDocument` at `DaemonFrameLatest` is the
|
||||
durable live-run checkpoint. `AetheriaRunState`, `AetheriaZoneState`, and
|
||||
`AetheriaEntitySnapshot` seed a run only when no playable live frame exists;
|
||||
they are not a second writer for an active session.
|
||||
- Inputs: accepted daemon transactions plus the complete runtime entity state:
|
||||
hull, installed placement and rotation, per-instance item fields, cargo and
|
||||
bay contents, weapon groups, equipment/behavior/weapon/consumable state, and
|
||||
loadout-generation receipts.
|
||||
- Outputs: one typed CultCache frame that can be closed, reopened in a fresh
|
||||
state node, resumed by the daemon, and projected into Eve without rebuilding
|
||||
gameplay state from Unity objects or client input.
|
||||
- Reconnect invariant: exact item placement, authored rotation, quality,
|
||||
durability, thermal state, cargo quantity, held groups, wear, specialized
|
||||
chain chronology, ammunition, shot sequence, active-effect execution state,
|
||||
and generation provenance survive the real directory store. Restored Eve
|
||||
weapon and thermostat levers derive from that same frame.
|
||||
- Forbidden writers: Unity loadout mirrors, Eve lowerers, and bootstrap entity
|
||||
documents cannot overwrite an active latest-frame checkpoint.
|
||||
- Verification layer: daemon smoke hard-flushes the frame, disposes the first
|
||||
`AetheriaStateNode`, opens a second node, verifies the complete loadout and
|
||||
behavior state, then rebuilds generic Eve input capabilities from the
|
||||
restored frame.
|
||||
|
||||
### Daemon Orbital Turret Controller
|
||||
|
||||
- Owner: each chain-admitted operational installed `TurretController` behavior owns automatic
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
|
|||
| Organ | Original authority/evidence | Target owner | Eve contract | Runtime lowering | Current status | Required proof |
|
||||
|---|---|---|---|---|---|---|
|
||||
| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement plus run lifecycle bindings | all clients | active/failed lifecycle is daemon-owned and restart-stable: controlled-entity destruction commits the fossil cause, terminal frame, one `run.failed` fact, releases control, rejects later gameplay commands, and freezes the world; Eve receives terminal presentation/input levers without becoming an owner. Docked, travelling, fighting, mining, looting, and refitting remain derived world conditions rather than counterfeit durable phases | full-daemon death/restart witness, multi-client convergence, and a source-backed game-mode completion rule; the fossil supplied no victory transition |
|
||||
| Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | owner-exists; wired; projected; not proven | loadout round trip and reconnect |
|
||||
| Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | daemon-owned hull identity, exact installed placement/rotation and instance state, cargo stacks, weapon membership/held state, equipment wear, executable behavior state, weapon chronology, active-effect state, and loadout-generation provenance survive a hard CultCache close/reopen through the durable latest-frame checkpoint. Generic Eve rebuilds weapon and scalar thermostat controls from that restored truth; legacy per-entity documents are bootstrap inputs only when no live frame exists | live refit-to-restart witness and multi-client convergence |
|
||||
| Loadout generation | map/faction availability, item cost, hull hardpoints and role constraints | daemon using canonical galaxy, faction knowledge/economy and typed catalog | generated loadout plus provenance/availability facts | Eve inspection and refit surfaces | daemon now uses the fossil candidate filter and seeded weighted selection: manufacturer must be present and allied, ally weight decays by home-zone graph distance, price uses the authored exponent, and hardpoints require matching semantic type, rotated footprint containment, and controller role; the April 2021 catalog fossil restores the distinct common `Longinus`, rare AetherDrive-compatible `LonginusX`, and `Djinni` rows with their original IDs, shapes, hardpoints, prices, drag, and prefabs, plus missing Thruster rows required to fill their authored mounts; typed `rarity:rare` tags apply a 0.05 generation multiplier to `LonginusX` and AetherDrive equipment; the generator owns one mutable CultMath stream, fixing the readonly-struct defensive-copy bug that restarted every weighted draw; placement rotation survives durable state and reconnect; generation fills the largest compatible footprint before economic weighting; cargo/capacitor plus station docking equipment must fit remaining hull space; stations pack faction-available inventory largest-first; ordinary ships begin without invented scenario cargo; every generated entity persists a source/selection receipt that reaches Eve as `loadout.item` semantics | multi-zone generated-world parity and exact root-to-zone stream sequencing against the fossil |
|
||||
| Flight intent | `Ship`, `Thruster`, `AetherDrive`, `VelocityConversion`, `VelocityLimit`, input paths | daemon actuator simulation + Ymir integration | analog local helm/look/tractor plus actuator state | generic Eve input and scene lowerers | direct faction-speed velocity ownership is deleted; daemon persists local strafe/forward helm and desired look, allocates ordinary directional thruster banks by authored rotation, derives torque from hull/item placement, compensates lateral torque, gates execution through the shared energy ledger, deposits equipment-cell heat, publishes plume visibility and actuator state, applies hull drag, then runs operational velocity conversion with the fossil exponential damp equation and clamps the result through evaluated velocity limits before giving velocity/direction to Ymir. The evaluated limit remains in durable behavior state for reconnect and Eve inspection. Autonomous tasks translate world travel into the same local helm axes and issue look commands instead of mutating heading. AetherDrive rotor/coupling simulation is additive and explicitly non-default: common `Longinus` and `Djinni` hulls use ordinary thrusters; the rare `LonginusX` replaces those mounts with the single rare `Traction` AetherDrive path | hardpoint-transform direction parity, exact cross-equipment behavior execution ordering, CultMath/float32 parity harness, live production-frequency evidence, generic thrust/turn feedback lowering, and live handling screenshots |
|
||||
| Collision | Unity physics and entity handlers | Ymir | collision/result facts | visual interpolation only | Ymir.Core world stepping wired for entity bodies, radial fields and contacts; missing-owner negative proof passes | publish authoritative collision events and prove Unity cannot write transforms back |
|
||||
|
|
|
|||
Loading…
Reference in a new issue