Move mine lifecycle into daemon simulation
This commit is contained in:
parent
d687e275d8
commit
602766ee78
9 changed files with 291 additions and 5 deletions
|
|
@ -14,6 +14,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
ConstantWeaponRunsOnDaemonThroughYmirBeamContact();
|
||||
ChargedWeaponCannotBypassChargeLifecycle();
|
||||
ChargedWeaponHoldRiskMalfunctionsDeterministically();
|
||||
DeployableWeaponRunsThroughYmirAndDetonatesOnDaemon();
|
||||
DaemonSimulationTreatsYmirHitAsPresentationOnly();
|
||||
ProjectileContactCannotKill();
|
||||
MissingPhysicsOwnerCannotAdvanceProjectiles();
|
||||
|
|
@ -219,6 +220,87 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
"Eve feedback must expose charged solution commit chronology");
|
||||
}
|
||||
|
||||
private static void DeployableWeaponRunsThroughYmirAndDetonatesOnDaemon()
|
||||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
source.DirectionX = 1;
|
||||
source.WeaponGroups = [new[] { 0 }];
|
||||
source.Equipment = [new AetheriaRuntimeLoadoutItemSlotCommit
|
||||
{
|
||||
Item = new AetheriaRuntimeLoadoutItemCommit
|
||||
{ ItemKey = "test-mine-layer", Quality = 1, Durability = 1, Enabled = true }
|
||||
}];
|
||||
var target = Entity(1, 50, "neutral");
|
||||
var zone = new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [source, target] };
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit
|
||||
{
|
||||
RunId = "deployable-smoke", CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0", Zones = [zone]
|
||||
};
|
||||
var payload = new AetheriaRuntimeBehaviorPayload(0, AetheriaRuntimeBehaviorKinds.DeployableWeapon, 0,
|
||||
[
|
||||
new AetheriaRuntimeBehaviorField(2, PerformanceStat(35)),
|
||||
new AetheriaRuntimeBehaviorField(6, PerformanceStat(10)),
|
||||
new AetheriaRuntimeBehaviorField(17, PerformanceStat(1)),
|
||||
new AetheriaRuntimeBehaviorField(19, PerformanceStat(1)),
|
||||
new AetheriaRuntimeBehaviorField(26, Number(0.2)),
|
||||
new AetheriaRuntimeBehaviorField(27, Number(5)),
|
||||
new AetheriaRuntimeBehaviorField(28, PerformanceStat(30)),
|
||||
new AetheriaRuntimeBehaviorField(29, Number(0.2)),
|
||||
new AetheriaRuntimeBehaviorField(30, PerformanceStat(50))
|
||||
]);
|
||||
var catalog = new AetheriaRuntimeCatalogSnapshot(
|
||||
[CatalogItem("test-mine-layer", payload)], [], []);
|
||||
var fire = new AetheriaRuntimeDaemonIntentState();
|
||||
fire.WeaponGroups.Add(new AetheriaRuntimeDaemonWeaponGroupIntent
|
||||
{ ActorEntityKey = "zone.0.entity.0", WeaponGroup = 0, Fire = true, Active = true });
|
||||
|
||||
AetheriaRuntimeDaemonSimulation.Step(run, fire, 0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
new AetheriaYmirPhysicalPayloadPhysics(), new AetheriaYmirWorldPhysics(), catalog, 1, 0.1);
|
||||
RequireEqual(1, zone.PhysicalPayloads.Count, "deployable fire must create one persistent physical payload");
|
||||
Require(!run.ShotReceipts.Any(), "deployable fire must not masquerade as an ordinary shot receipt");
|
||||
var mine = zone.PhysicalPayloads.Single();
|
||||
Require(mine.PositionX > 2 && mine.TriggeredAtSeconds < 0,
|
||||
"Ymir must advance the unarmed mine without inventing a trigger");
|
||||
|
||||
AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
new AetheriaYmirPhysicalPayloadPhysics(), new AetheriaYmirWorldPhysics(), catalog, 2, 0.2);
|
||||
mine = zone.PhysicalPayloads.Single();
|
||||
Require(mine.Stationary && mine.TriggeredAtSeconds >= 0 &&
|
||||
run.GameEvents.Count(value => value.Kind == "deployable.triggered") == 1,
|
||||
"an armed Ymir contact must become one daemon-owned trigger transition");
|
||||
RequireNear(100, Stat(target, "hull"), 0.000001,
|
||||
"trigger contact must not bypass the authored detonation delay");
|
||||
|
||||
var surface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build(
|
||||
new AetheriaRuntimeDaemonFrameDocument { FrameId = 2, Run = run },
|
||||
new AetheriaRuntimeDaemonHealthDocument(),
|
||||
AetheriaRuntimeDaemonCommandBoundaryDocument.Create("daemon"));
|
||||
var mineNode = Flatten(surface.Surface.Root).Single(node =>
|
||||
node.Id == $"aetheria.daemon.game.world.projectile.{mine.PayloadId}");
|
||||
RequireEqual("physical-payload", mineNode.Props["entityKind"],
|
||||
"Eve must describe the semantic object rather than pretend every payload is a projectile");
|
||||
RequireEqual("mine", mineNode.Props["payloadKind"], "Eve must expose deployable kind");
|
||||
RequireEqual("true", mineNode.Props["armed"], "Eve must expose daemon-owned arming state");
|
||||
RequireEqual("true", mineNode.Props["triggered"], "Eve must expose daemon-owned trigger state");
|
||||
RequireEqual("true", mineNode.Props["stationary"], "Eve must expose Ymir-derived motion state");
|
||||
RequireNear(35, mine.PayloadMagnitude, 0.000001, "deployable must retain authored payload magnitude");
|
||||
RequireNear(50, mine.BlastRadius, 0.000001, "deployable must retain authored blast radius");
|
||||
Require(Math.Abs(target.PositionX - mine.PositionX) <= mine.BlastRadius,
|
||||
$"triggered target must remain inside authored blast radius (mine {mine.PositionX}, target {target.PositionX})");
|
||||
|
||||
AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.21,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
new AetheriaYmirPhysicalPayloadPhysics(), new AetheriaYmirWorldPhysics(), catalog, 3, 0.41);
|
||||
RequireEqual(0, zone.PhysicalPayloads.Count, "detonated mine must leave canonical payload state");
|
||||
RequireNear(65, Stat(target, "hull"), 0.000001,
|
||||
"Aetheria must apply authored blast damage after the delay");
|
||||
Require(run.GameEvents.Count(value => value.Kind == "deployable.detonated") == 1,
|
||||
"daemon must publish one authoritative detonation event");
|
||||
}
|
||||
|
||||
private static void ChargedWeaponHoldRiskMalfunctionsDeterministically()
|
||||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public sealed class AetheriaYmirPhysicalPayloadPhysics : IAetheriaRuntimePhysica
|
|||
new Vec2((float)projectile.VelocityX, (float)projectile.VelocityY),
|
||||
(float)Math.Max(0.001, projectile.Radius),
|
||||
1.0f,
|
||||
IsStatic: projectile.Stationary,
|
||||
Restitution: 0.0f)
|
||||
};
|
||||
foreach (var pair in entityByBodyId)
|
||||
|
|
@ -104,6 +105,13 @@ public sealed class AetheriaYmirPhysicalPayloadPhysics : IAetheriaRuntimePhysica
|
|||
NormalX = normal.X,
|
||||
NormalZ = normal.Y
|
||||
});
|
||||
if (string.Equals(projectile.PayloadKind, "mine", StringComparison.Ordinal))
|
||||
{
|
||||
projectile.Stationary = true;
|
||||
projectile.VelocityX = 0;
|
||||
projectile.VelocityY = 0;
|
||||
survivors.Add(projectile);
|
||||
}
|
||||
}
|
||||
|
||||
return new AetheriaRuntimePhysicalPayloadStep(survivors, hits);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public const string ConstantWeapon = "ConstantWeapon";
|
||||
public const string ChargedWeapon = "ChargedWeapon";
|
||||
public const string AutoWeapon = "AutoWeapon";
|
||||
public const string DeployableWeapon = "DeployableWeapon";
|
||||
|
||||
private static readonly ISet<string> WeaponKinds = new HashSet<string>(StringComparer.Ordinal)
|
||||
{
|
||||
|
|
@ -20,7 +21,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
InstantWeapon,
|
||||
ConstantWeapon,
|
||||
ChargedWeapon,
|
||||
AutoWeapon
|
||||
AutoWeapon,
|
||||
DeployableWeapon
|
||||
};
|
||||
|
||||
public static bool IsWeapon(string kind)
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Behavior("LockWeapon", AetheriaRuntimeBehaviorKinds.InstantWeapon, LockWeaponFields),
|
||||
Behavior(AetheriaRuntimeBehaviorKinds.InstantWeapon, "Weapon", InstantWeaponFields),
|
||||
Behavior(AetheriaRuntimeBehaviorKinds.AutoWeapon, AetheriaRuntimeBehaviorKinds.InstantWeapon, InstantWeaponFields),
|
||||
Behavior(AetheriaRuntimeBehaviorKinds.DeployableWeapon, AetheriaRuntimeBehaviorKinds.InstantWeapon,
|
||||
With(InstantWeaponFields, Number("ActivationDelay", 26), Number("Lifetime", 27),
|
||||
Stat("TriggerRadius", 28), Number("DetonationDelay", 29), Stat("BlastRadius", 30))),
|
||||
Behavior("Cooldown", "", Stat("Cooldown", 1)),
|
||||
Behavior("EnergyDraw", "", Stat("EnergyDraw", 1)),
|
||||
Behavior("Heat", "", Stat("Heat", 1)),
|
||||
|
|
|
|||
|
|
@ -779,7 +779,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var props = new Dictionary<string, string>(StringComparer.Ordinal)
|
||||
{
|
||||
["entityId"] = projectileId,
|
||||
["entityKind"] = "projectile",
|
||||
["entityKind"] = "physical-payload",
|
||||
["payloadKind"] = projectile.PayloadKind ?? "",
|
||||
["label"] = projectile.PayloadKind ?? "Projectile",
|
||||
["faction"] = "",
|
||||
["assetRef"] = "prefab.entity.projectile",
|
||||
|
|
@ -794,7 +795,17 @@ namespace GameCult.Aetheria.State.Verse
|
|||
["sourceEntityId"] = run.EntityRecordKey(zone.ZoneIndex, projectile.SourceEntityIndex),
|
||||
["targetEntityId"] = targetEntityId,
|
||||
["contactMagnitude"] = FormatNumber(projectile.ContactMagnitude),
|
||||
["remainingLifetime"] = FormatNumber(projectile.LifetimeSeconds),
|
||||
["age"] = FormatNumber(projectile.AgeSeconds),
|
||||
["remainingLifetime"] = FormatNumber(Math.Max(0, projectile.LifetimeSeconds - projectile.AgeSeconds)),
|
||||
["activationDelay"] = FormatNumber(projectile.ActivationDelaySeconds),
|
||||
["armed"] = projectile.AgeSeconds >= projectile.ActivationDelaySeconds ? "true" : "false",
|
||||
["triggerRadius"] = FormatNumber(projectile.TriggerRadius),
|
||||
["triggered"] = projectile.TriggeredAtSeconds >= 0 ? "true" : "false",
|
||||
["triggeredAt"] = FormatNumber(projectile.TriggeredAtSeconds),
|
||||
["detonationDelay"] = FormatNumber(projectile.DetonationDelaySeconds),
|
||||
["blastRadius"] = FormatNumber(projectile.BlastRadius),
|
||||
["payloadMagnitude"] = FormatNumber(projectile.PayloadMagnitude),
|
||||
["stationary"] = projectile.Stationary ? "true" : "false",
|
||||
["selectable"] = "false",
|
||||
["controllable"] = "false"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ 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, physicalPayloadPhysics, catalog, frameId);
|
||||
StepCombat(run, zone, entities, intents, deltaSeconds, settings, physicalPayloadPhysics, catalog,
|
||||
frameId, simulationTimeSeconds);
|
||||
AetheriaRuntimeMiningSimulation.Step(run, zone, entities, intents, catalog, frameId, simulationTimeSeconds, deltaSeconds);
|
||||
AetheriaRuntimeSurveySimulation.Step(run, zone, entities, intents, catalog, frameId, simulationTimeSeconds, deltaSeconds);
|
||||
RefreshContacts(entities, settings);
|
||||
|
|
@ -234,12 +235,14 @@ namespace GameCult.Aetheria.State.Verse
|
|||
AetheriaRuntimeDaemonSimulationSettings settings,
|
||||
IAetheriaRuntimePhysicalPayloadPhysics physicalPayloadPhysics,
|
||||
AetheriaRuntimeCatalogSnapshot? catalog,
|
||||
long frameId)
|
||||
long frameId,
|
||||
double simulationTimeSeconds)
|
||||
{
|
||||
var byIndex = entities.ToDictionary(entity => entity.EntityIndex);
|
||||
foreach (var attacker in entities)
|
||||
{
|
||||
var weaponGroup = ResolveFireGroup(run, zone, attacker, intents);
|
||||
StepDeployableWeapons(run, zone, attacker, weaponGroup, deltaSeconds, settings, catalog, frameId);
|
||||
StepChargedWeapons(run, zone, attacker, byIndex, weaponGroup, deltaSeconds,
|
||||
settings, catalog, frameId);
|
||||
StepConstantWeapons(run, zone, byIndex, attacker, weaponGroup, deltaSeconds,
|
||||
|
|
@ -344,8 +347,16 @@ namespace GameCult.Aetheria.State.Verse
|
|||
if (byIndex.TryGetValue(hit.TargetEntityIndex, out var target))
|
||||
{
|
||||
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"physical-payload:{hit.Payload.PayloadId}:contact", Kind = "physical-payload.contact", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = hit.Payload.SourceEntityIndex, TargetEntityIndex = target.EntityIndex, SubjectKey = hit.Payload.PayloadId, ItemKey = hit.Payload.PayloadKind, ScalarValue = hit.Payload.ContactMagnitude, PositionX = hit.PointX, PositionZ = hit.PointZ });
|
||||
if (string.Equals(hit.Payload.PayloadKind, "mine", StringComparison.Ordinal) &&
|
||||
hit.Payload.AgeSeconds >= hit.Payload.ActivationDelaySeconds &&
|
||||
hit.Payload.TriggeredAtSeconds < 0)
|
||||
{
|
||||
hit.Payload.TriggeredAtSeconds = simulationTimeSeconds;
|
||||
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"physical-payload:{hit.Payload.PayloadId}:triggered", Kind = "deployable.triggered", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = hit.Payload.SourceEntityIndex, TargetEntityIndex = target.EntityIndex, SubjectKey = hit.Payload.PayloadId, ItemKey = hit.Payload.PayloadKind, PositionX = hit.Payload.PositionX, PositionZ = hit.Payload.PositionZ });
|
||||
}
|
||||
}
|
||||
}
|
||||
ResolveDeployableDetonations(run, zone, entities, frameId, simulationTimeSeconds);
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
|
|
@ -360,6 +371,93 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
}
|
||||
|
||||
private static void StepDeployableWeapons(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
AetheriaRuntimeEntitySnapshotCommit attacker,
|
||||
int weaponGroup,
|
||||
double deltaSeconds,
|
||||
AetheriaRuntimeDaemonSimulationSettings settings,
|
||||
AetheriaRuntimeCatalogSnapshot? catalog,
|
||||
long frameId)
|
||||
{
|
||||
foreach (var deployable in ResolveDeployableWeapons(attacker, weaponGroup, catalog, settings))
|
||||
{
|
||||
var weapon = deployable.Weapon;
|
||||
weapon.State.Firing = false;
|
||||
weapon.State.CooldownProgress = Math.Max(0, weapon.State.CooldownProgress - deltaSeconds);
|
||||
weapon.State.CoolingDown = weapon.State.CooldownProgress > 0;
|
||||
if (!IsAlive(attacker) || weaponGroup < 0 || weapon.State.CooldownProgress > 0) continue;
|
||||
|
||||
var result = CommitWeaponRound(attacker, weapon);
|
||||
PublishWeaponRoundResult(run, zone, attacker, weapon, frameId, result);
|
||||
if (result != WeaponRoundResult.Fired) continue;
|
||||
|
||||
var direction = Normalize(attacker.DirectionX, attacker.DirectionY);
|
||||
if (Math.Abs(direction.X) + Math.Abs(direction.Y) < 0.0001) direction = (0, 1);
|
||||
var payloadId = NextShotId(zone, attacker, weapon);
|
||||
var payloads = (zone.PhysicalPayloads ?? Array.Empty<AetheriaRuntimePhysicalPayloadCommit>()).ToList();
|
||||
payloads.Add(new AetheriaRuntimePhysicalPayloadCommit
|
||||
{
|
||||
PayloadId = payloadId,
|
||||
SourceEntityIndex = attacker.EntityIndex,
|
||||
FactionKey = attacker.FactionKey ?? "",
|
||||
PositionX = attacker.PositionX + direction.X * 2,
|
||||
PositionY = attacker.PositionY,
|
||||
PositionZ = attacker.PositionZ + direction.Y * 2,
|
||||
DirectionX = direction.X,
|
||||
DirectionY = direction.Y,
|
||||
VelocityX = direction.X * weapon.ProjectileSpeed,
|
||||
VelocityY = direction.Y * weapon.ProjectileSpeed,
|
||||
Radius = 1,
|
||||
LifetimeSeconds = deployable.LifetimeSeconds,
|
||||
Active = true,
|
||||
PayloadKind = "mine",
|
||||
ActivationDelaySeconds = deployable.ActivationDelaySeconds,
|
||||
TriggerRadius = deployable.TriggerRadius,
|
||||
DetonationDelaySeconds = deployable.DetonationDelaySeconds,
|
||||
BlastRadius = deployable.BlastRadius,
|
||||
PayloadMagnitude = weapon.Damage
|
||||
});
|
||||
zone.PhysicalPayloads = payloads;
|
||||
weapon.State.Firing = true;
|
||||
weapon.State.CoolingDown = true;
|
||||
weapon.State.CooldownProgress = weapon.Cooldown;
|
||||
AetheriaRuntimeThermalSimulation.AddHeat(attacker, weapon.Heat);
|
||||
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"physical-payload:{payloadId}:deployed", Kind = "deployable.deployed", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = attacker.EntityIndex, SubjectKey = payloadId, ItemKey = weapon.ItemKey, PositionX = attacker.PositionX, PositionZ = attacker.PositionZ });
|
||||
}
|
||||
}
|
||||
|
||||
private static void ResolveDeployableDetonations(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities,
|
||||
long frameId,
|
||||
double simulationTimeSeconds)
|
||||
{
|
||||
var survivors = new List<AetheriaRuntimePhysicalPayloadCommit>();
|
||||
foreach (var payload in zone.PhysicalPayloads ?? Array.Empty<AetheriaRuntimePhysicalPayloadCommit>())
|
||||
{
|
||||
if (!string.Equals(payload.PayloadKind, "mine", StringComparison.Ordinal) ||
|
||||
payload.TriggeredAtSeconds < 0 ||
|
||||
simulationTimeSeconds < payload.TriggeredAtSeconds + payload.DetonationDelaySeconds)
|
||||
{
|
||||
survivors.Add(payload);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var target in entities.Where(value => value.IsActive && value.EntityIndex != payload.SourceEntityIndex))
|
||||
{
|
||||
var dx = target.PositionX - payload.PositionX;
|
||||
var dz = target.PositionZ - payload.PositionZ;
|
||||
if (dx * dx + dz * dz > payload.BlastRadius * payload.BlastRadius) continue;
|
||||
Damage(target, payload.PayloadMagnitude);
|
||||
}
|
||||
AetheriaRuntimeGameEvents.Append(run, new AetheriaRuntimeGameEventCommit { EventId = $"physical-payload:{payload.PayloadId}:detonated", Kind = "deployable.detonated", FrameId = frameId, ZoneIndex = zone.ZoneIndex, SourceEntityIndex = payload.SourceEntityIndex, SubjectKey = payload.PayloadId, ItemKey = payload.PayloadKind, ScalarValue = payload.PayloadMagnitude, PositionX = payload.PositionX, PositionZ = payload.PositionZ });
|
||||
}
|
||||
zone.PhysicalPayloads = survivors;
|
||||
}
|
||||
|
||||
private static void StepChargedWeapons(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
|
|
@ -782,6 +880,15 @@ namespace GameCult.Aetheria.State.Verse
|
|||
if (projectile.AgeSeconds >= projectile.LifetimeSeconds)
|
||||
continue;
|
||||
|
||||
if (string.Equals(projectile.PayloadKind, "mine", StringComparison.Ordinal) &&
|
||||
projectile.AgeSeconds >= projectile.ActivationDelaySeconds)
|
||||
{
|
||||
projectile.Radius = Math.Max(1, projectile.TriggerRadius);
|
||||
projectile.Stationary = true;
|
||||
projectile.VelocityX = 0;
|
||||
projectile.VelocityY = 0;
|
||||
}
|
||||
|
||||
if (projectile.Guided &&
|
||||
projectile.TargetEntityIndex >= 0 &&
|
||||
entities.TryGetValue(projectile.TargetEntityIndex, out var target) &&
|
||||
|
|
@ -869,6 +976,27 @@ namespace GameCult.Aetheria.State.Verse
|
|||
.ToArray();
|
||||
}
|
||||
|
||||
private static IReadOnlyList<ResolvedDeployableWeapon> ResolveDeployableWeapons(
|
||||
AetheriaRuntimeEntitySnapshotCommit entity,
|
||||
int weaponGroup,
|
||||
AetheriaRuntimeCatalogSnapshot? catalog,
|
||||
AetheriaRuntimeDaemonSimulationSettings settings)
|
||||
{
|
||||
var equipmentIndices = weaponGroup >= 0 && weaponGroup < (entity.WeaponGroups ?? Array.Empty<IReadOnlyList<int>>()).Count
|
||||
? entity.WeaponGroups[weaponGroup] ?? Array.Empty<int>()
|
||||
: Array.Empty<int>();
|
||||
return AetheriaRuntimeEquippedBehaviorQueries.Find(entity, catalog, AetheriaRuntimeBehaviorKinds.DeployableWeapon)
|
||||
.Where(behavior => equipmentIndices.Contains(behavior.EquipmentIndex))
|
||||
.Select(behavior => new ResolvedDeployableWeapon(
|
||||
ResolveAuthoredWeapon(entity, behavior, settings),
|
||||
Math.Max(0, ReadNumber(behavior.Payload, 26)),
|
||||
PositiveOr(ReadNumber(behavior.Payload, 27), 30),
|
||||
PositiveOr(behavior.EvaluateStat(28), 25),
|
||||
Math.Max(0, ReadNumber(behavior.Payload, 29)),
|
||||
PositiveOr(behavior.EvaluateStat(30), 25)))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static void CommitShotResolution(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
|
|
@ -1026,6 +1154,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
: Array.Empty<int>();
|
||||
var authored = AetheriaRuntimeEquippedBehaviorQueries.Find(entity, catalog, AetheriaRuntimeBehaviorKinds.InstantWeapon)
|
||||
.Where(behavior => !string.Equals(behavior.Payload.Kind, AetheriaRuntimeBehaviorKinds.ChargedWeapon, StringComparison.Ordinal))
|
||||
.Where(behavior => !string.Equals(behavior.Payload.Kind, AetheriaRuntimeBehaviorKinds.DeployableWeapon, StringComparison.Ordinal))
|
||||
.Where(behavior => equipmentIndices.Contains(behavior.EquipmentIndex))
|
||||
.Select(behavior => ResolveAuthoredWeapon(entity, behavior, settings))
|
||||
.ToArray();
|
||||
|
|
@ -1293,6 +1422,27 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public double Spread { get; }
|
||||
}
|
||||
|
||||
private sealed class ResolvedDeployableWeapon
|
||||
{
|
||||
public ResolvedDeployableWeapon(ResolvedWeapon weapon, double activationDelaySeconds,
|
||||
double lifetimeSeconds, double triggerRadius, double detonationDelaySeconds, double blastRadius)
|
||||
{
|
||||
Weapon = weapon;
|
||||
ActivationDelaySeconds = activationDelaySeconds;
|
||||
LifetimeSeconds = lifetimeSeconds;
|
||||
TriggerRadius = triggerRadius;
|
||||
DetonationDelaySeconds = detonationDelaySeconds;
|
||||
BlastRadius = blastRadius;
|
||||
}
|
||||
|
||||
public ResolvedWeapon Weapon { get; }
|
||||
public double ActivationDelaySeconds { get; }
|
||||
public double LifetimeSeconds { get; }
|
||||
public double TriggerRadius { get; }
|
||||
public double DetonationDelaySeconds { get; }
|
||||
public double BlastRadius { get; }
|
||||
}
|
||||
|
||||
private sealed class ResolvedChargedWeapon
|
||||
{
|
||||
public ResolvedChargedWeapon(ResolvedWeapon baseWeapon, AetheriaRuntimeLoadoutItemCommit item,
|
||||
|
|
|
|||
|
|
@ -623,6 +623,14 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
[Key(17)]
|
||||
public string PayloadKind { get; set; } = "";
|
||||
|
||||
[Key(18)] public double ActivationDelaySeconds { get; set; }
|
||||
[Key(19)] public double TriggerRadius { get; set; }
|
||||
[Key(20)] public double DetonationDelaySeconds { get; set; }
|
||||
[Key(21)] public double TriggeredAtSeconds { get; set; } = -1;
|
||||
[Key(22)] public double BlastRadius { get; set; }
|
||||
[Key(23)] public double PayloadMagnitude { get; set; }
|
||||
[Key(24)] public bool Stationary { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -145,6 +145,10 @@ Aetheria owns only the configured prefab and its asset-manifest advertisement.
|
|||
|
||||
Current Ymir control flow:
|
||||
|
||||
- Aetheria depends on injected physics ports, not on a Ymir daemon topology.
|
||||
The default daemon process constructs the Ymir implementations in-process;
|
||||
tests can supply another deterministic implementation without changing game
|
||||
authority.
|
||||
- The daemon projects ships, pickups, fields, and explicitly physical payloads
|
||||
into Ymir. Ymir owns integration, collision, and spatial contact facts.
|
||||
- Ordinary direct, constant, and charged weapon fire resolves through
|
||||
|
|
@ -153,6 +157,12 @@ Current Ymir control flow:
|
|||
- `AetheriaYmirPhysicalPayloadPhysics` advances only objects whose continued
|
||||
physical motion is gameplay state. Aetheria interprets returned contacts;
|
||||
Ymir does not own damage policy.
|
||||
- Authored `DeployableWeapon` behavior now creates retained mine payloads.
|
||||
Aetheria owns deployment admission, arming time, trigger transition,
|
||||
detonation delay, blast selection, damage, and lifecycle events. Ymir moves
|
||||
the unarmed payload and reports overlap/contact facts after it becomes a
|
||||
stationary trigger body. Eve projects the payload kind, age, armed,
|
||||
triggered, stationary, radius, delay, and magnitude state.
|
||||
- The fossil `Projectile`, `GuidedProjectile`, their managers, Unity-side Ymir
|
||||
stepping adapter, and dedicated proof tests are deleted. EveUnity lowers
|
||||
ordinary weapon travel from daemon `shot.receipt` facts.
|
||||
|
|
@ -171,6 +181,11 @@ Remaining debt:
|
|||
- Clickable raycasts still construct query bodies from Unity click bounds. That
|
||||
is presentation picking, not simulation authority, but it should stay clearly
|
||||
labeled as renderer/UI picking.
|
||||
- The fossil `Mine`, `MineManager`, and `InstantWeaponEffectManager` remain as
|
||||
one serialized bundle on `Mine Launcher.prefab`. Replace that prefab's
|
||||
runtime script component with a provider-owned presentation asset and migrate
|
||||
its real catalog behavior before deleting the bundle; deleting the scripts
|
||||
alone would merely manufacture a missing Unity component.
|
||||
|
||||
## Gravity Terrain
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,13 @@ craft, area fields, and recoverable or destructible payloads. Those objects are
|
|||
not exempt from deterministic fire-control receipts; Ymir owns their later
|
||||
motion and collision after launch.
|
||||
|
||||
For deployables, physics contact is evidence rather than consequence. Aetheria
|
||||
authors deployment, arming, trigger and detonation clocks, target eligibility,
|
||||
blast magnitude, damage, and event chronology. The injected Ymir implementation
|
||||
owns integration and overlap/contact facts. The production daemon currently
|
||||
embeds that implementation in-process; moving it across CultNet must not change
|
||||
either authority or the persisted state contract.
|
||||
|
||||
## Eve Presentation
|
||||
|
||||
Eve receives:
|
||||
|
|
|
|||
Loading…
Reference in a new issue