fix(physics): TS-23 - plumb real PK/PKLite/Impenetrable mover flags
Campaign P Slice P3 item 3. The wire parse (CreateObject's PublicWeenieDesc._bitfield), the decode (EntityCollisionFlagsExt. FromPwdBitfield), the per-GUID storage (ClientObjectTable. PublicWeenieBitfield), and the exemption logic (CollisionExemption. ShouldSkip) all already existed and were already correct -- every mover-flags call site just fed a GUID-prefix IsPlayer heuristic instead of the real per-entity PK/PKLite/Impenetrable state (retail OBJECTINFO::init 0x0050cf30 state |= 0x80/0x800/0x1000). Port: - EntityCollisionFlagsExt.ToMoverState translates the decoded PWD bit-space into the ObjectInfoState bit-space FindObjCollisions actually reads -- two different numberings that must not be confused. Deliberately does not translate IsPlayer (every call site already derives that correctly from its own GUID heuristic per #184 Slice 2b). - EntityCollisionFlagsExt.ResolveMoverPvpState is the one shared ClientObjectTable-backed lookup (guid -> ObjectInfoState), replacing what would otherwise have been three separate inline copies across GameWindow/LivePresentationComposition/RemoteTeleportController. - Threaded as a new optional moverPvpState parameter through RuntimeRemotePhysicsUpdater.Tick/TickHidden and RuntimeOrdinaryPhysicsUpdater.TryBegin (default None preserves every pre-P3 caller unchanged), and as PlayerMovementController.OwnPvpFlags for the local player's own two resolve call sites. - TS-23 section 12b: PlayerWeenie.JumpStaminaCost's pk parameter now reads the real PlayerKillerStatus(0x86)/LastPkAttackTimestamp(0x91) pair against retail's 20-second recency window (pkStatus in {4, 0x40} && (timestamp + 20.0) >= now), replacing the P1 hardcoded false. RuntimeMovementSkillState/Snapshot and LiveSessionEventRouter.RecomputePvpStatus push both the PWD bitfield and the PlayerKillerStatus pair reactively, riding the SAME ClientObject event triggers RecomputeBurden already uses. - A conformance test caught a genuine precision bug in the first PK-timer clock choice: DateTimeOffset.UtcNow's Unix-epoch seconds (~1.7 billion) loses ~128 seconds of precision in a 32-bit float, silently swallowing the entire 20-second window. Switched to Environment.TickCount64 (small, monotonic magnitude) -- also the more retail-plausible basis, since LastPkAttackTimestamp is itself a wire PropertyFloat and retail's Timer::cur_time is almost certainly a process/session-relative counter for the same precision reason, not an absolute epoch. Non-PK invariant (the acceptance criterion): an entity with no ClientObjectTable row, or a row whose PublicWeenieBitfield is null or 0, resolves to ObjectInfoState.None -- a no-op OR into moverFlags, bit-identical to every pre-P3 caller's hardcoded value. A dedicated test drives two real ClientObjectTable rows through CollisionExemption.ShouldSkip and confirms PK-vs-PK collides while PK-vs-non-PK and non-PK-vs-non-PK both stay exempt (walk through). Register: TS-23 retired (both the collision-flags and PK-timer halves); the stale "M2 combat must land TS-23" phase-gate note removed. dotnet build + dotnet test (Core.Tests 4008/2 skip, Runtime.Tests 425/0, App.Tests 3968/3 skip, complete solution build) all green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8b5425498c
commit
bb7b899bfe
17 changed files with 702 additions and 53 deletions
|
|
@ -482,7 +482,14 @@ internal sealed class LivePresentationCompositionPhase
|
|||
var ordinaryPhysicsUpdater = new LiveEntityOrdinaryPhysicsUpdater(
|
||||
d.EntityObjects.Physics,
|
||||
d.MotionBindings.GetSetupCylinder,
|
||||
d.MotionBindings.GetSetupMoverShape);
|
||||
d.MotionBindings.GetSetupMoverShape,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): the ordinary
|
||||
// mover's own PK/PKLite/Impenetrable bits — same
|
||||
// ClientObjectTable-backed lookup GameWindow's remote
|
||||
// updater uses.
|
||||
guid => AcDream.Core.Physics.EntityCollisionFlagsExt.ResolveMoverPvpState(
|
||||
d.EntityObjects.Objects,
|
||||
guid));
|
||||
var animationScheduler = new LiveEntityAnimationScheduler(
|
||||
liveEntities,
|
||||
d.PlayerIdentity,
|
||||
|
|
@ -572,7 +579,11 @@ internal sealed class LivePresentationCompositionPhase
|
|||
d.WorldOrigin.CellLocalForSeed,
|
||||
remoteShadowPlacement.Sync,
|
||||
remoteTeleportPresentation.Complete,
|
||||
remoteTeleportPresentation.Begin),
|
||||
remoteTeleportPresentation.Begin,
|
||||
getMoverPvpState: guid =>
|
||||
EntityCollisionFlagsExt.ResolveMoverPvpState(
|
||||
d.EntityObjects.Objects,
|
||||
guid)),
|
||||
static value => value.Dispose());
|
||||
bindings.BindProjectionPoseReady(
|
||||
equippedLease.Resource,
|
||||
|
|
|
|||
|
|
@ -21,13 +21,17 @@ internal sealed class LiveEntityOrdinaryPhysicsUpdater
|
|||
private readonly Func<uint, WorldEntity,
|
||||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
_getSetupMoverShape;
|
||||
private readonly Func<uint, ObjectInfoState> _getMoverPvpState;
|
||||
|
||||
public LiveEntityOrdinaryPhysicsUpdater(
|
||||
RuntimePhysicsState physics,
|
||||
Func<uint, WorldEntity, (float Radius, float Height)> getSetupCylinder,
|
||||
Func<uint, WorldEntity,
|
||||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
getSetupMoverShape)
|
||||
getSetupMoverShape,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): see RemotePhysicsUpdater's
|
||||
// identical parameter.
|
||||
Func<uint, ObjectInfoState>? getMoverPvpState = null)
|
||||
{
|
||||
_runtime = new RuntimeOrdinaryPhysicsUpdater(
|
||||
physics ?? throw new ArgumentNullException(nameof(physics)));
|
||||
|
|
@ -35,6 +39,7 @@ internal sealed class LiveEntityOrdinaryPhysicsUpdater
|
|||
?? throw new ArgumentNullException(nameof(getSetupCylinder));
|
||||
_getSetupMoverShape = getSetupMoverShape
|
||||
?? throw new ArgumentNullException(nameof(getSetupMoverShape));
|
||||
_getMoverPvpState = getMoverPvpState ?? (static _ => ObjectInfoState.None);
|
||||
}
|
||||
|
||||
public bool Tick(
|
||||
|
|
@ -82,7 +87,8 @@ internal sealed class LiveEntityOrdinaryPhysicsUpdater
|
|||
sphereList: shape.Spheres,
|
||||
sphereScale: shape.Scale,
|
||||
stepUpHeight: shape.StepUpHeight,
|
||||
stepDownHeight: shape.StepDownHeight))
|
||||
stepDownHeight: shape.StepDownHeight,
|
||||
moverPvpState: _getMoverPvpState(record.ServerGuid)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ internal sealed class RemotePhysicsUpdater
|
|||
private readonly Func<uint, WorldEntity,
|
||||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
_getSetupMoverShape;
|
||||
private readonly Func<uint, ObjectInfoState> _getMoverPvpState;
|
||||
private readonly Action<uint, LiveEntityAnimationState, RemoteMotion, Vector3>
|
||||
_applyServerControlledVelocityCycle;
|
||||
private readonly List<LiveEntityRecord> _spatialRemoteSnapshot = new();
|
||||
|
|
@ -33,7 +34,14 @@ internal sealed class RemotePhysicsUpdater
|
|||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
getSetupMoverShape,
|
||||
Action<uint, LiveEntityAnimationState, RemoteMotion, Vector3>
|
||||
applyServerControlledVelocityCycle)
|
||||
applyServerControlledVelocityCycle,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): resolves a remote's own
|
||||
// PK/PKLite/Impenetrable ObjectInfoState bits by server guid
|
||||
// (ClientObjectTable.PublicWeenieBitfield → EntityCollisionFlagsExt.
|
||||
// FromPwdBitfield → ToMoverState). Default (null) always returns
|
||||
// None — bit-identical to the pre-P3 behavior for every caller that
|
||||
// doesn't supply one.
|
||||
Func<uint, ObjectInfoState>? getMoverPvpState = null)
|
||||
{
|
||||
_runtime = new RuntimeRemotePhysicsUpdater(
|
||||
physics ?? throw new ArgumentNullException(nameof(physics)));
|
||||
|
|
@ -41,6 +49,7 @@ internal sealed class RemotePhysicsUpdater
|
|||
?? throw new ArgumentNullException(nameof(getSetupCylinder));
|
||||
_getSetupMoverShape = getSetupMoverShape
|
||||
?? throw new ArgumentNullException(nameof(getSetupMoverShape));
|
||||
_getMoverPvpState = getMoverPvpState ?? (static _ => ObjectInfoState.None);
|
||||
_applyServerControlledVelocityCycle =
|
||||
applyServerControlledVelocityCycle
|
||||
?? throw new ArgumentNullException(
|
||||
|
|
@ -235,7 +244,8 @@ internal sealed class RemotePhysicsUpdater
|
|||
sphereList: shape.Spheres,
|
||||
sphereScale: shape.Scale,
|
||||
stepUpHeight: shape.StepUpHeight,
|
||||
stepDownHeight: shape.StepDownHeight);
|
||||
stepDownHeight: shape.StepDownHeight,
|
||||
moverPvpState: _getMoverPvpState(ownerRecord.ServerGuid));
|
||||
}
|
||||
|
||||
public bool TickHidden(
|
||||
|
|
@ -289,7 +299,8 @@ internal sealed class RemotePhysicsUpdater
|
|||
sphereList: shape.Spheres,
|
||||
sphereScale: shape.Scale,
|
||||
stepUpHeight: shape.StepUpHeight,
|
||||
stepDownHeight: shape.StepDownHeight);
|
||||
stepDownHeight: shape.StepDownHeight,
|
||||
moverPvpState: _getMoverPvpState(ownerRecord.ServerGuid));
|
||||
}
|
||||
|
||||
public void SyncRemoteShadowToBody(
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
private readonly Action<uint, ushort, bool> _completeAuthoritativePlacement;
|
||||
private readonly Action<uint, ushort> _beginAuthoritativePlacement;
|
||||
private readonly PlacementResolver _resolvePlacement;
|
||||
private readonly Func<uint, ObjectInfoState> _getMoverPvpState;
|
||||
private readonly Dictionary<RuntimeEntityKey, PendingPlacement> _pending = new();
|
||||
|
||||
internal RemoteTeleportController(
|
||||
|
|
@ -43,7 +44,10 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
Action<WorldEntity, PhysicsBody, uint> syncResolvedShadow,
|
||||
Action<uint, ushort, bool> completeAuthoritativePlacement,
|
||||
Action<uint, ushort> beginAuthoritativePlacement,
|
||||
PlacementResolver? resolvePlacement = null)
|
||||
PlacementResolver? resolvePlacement = null,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): see
|
||||
// RemotePhysicsUpdater's identical parameter.
|
||||
Func<uint, ObjectInfoState>? getMoverPvpState = null)
|
||||
{
|
||||
_physics = physics ?? throw new ArgumentNullException(nameof(physics));
|
||||
_liveEntities = liveEntities ?? throw new ArgumentNullException(nameof(liveEntities));
|
||||
|
|
@ -58,6 +62,7 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
_beginAuthoritativePlacement = beginAuthoritativePlacement
|
||||
?? throw new ArgumentNullException(nameof(beginAuthoritativePlacement));
|
||||
_resolvePlacement = resolvePlacement ?? ResolvePlacement;
|
||||
_getMoverPvpState = getMoverPvpState ?? (static _ => ObjectInfoState.None);
|
||||
_liveEntities.ProjectionVisibilityChanged += OnProjectionVisibilityChanged;
|
||||
}
|
||||
|
||||
|
|
@ -286,9 +291,12 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
request.RequestedCellId,
|
||||
radius,
|
||||
height,
|
||||
IsPlayerGuid(request.Entity.ServerGuid)
|
||||
// TS-23: moverPvpState is a no-op OR (None) for every non-PK
|
||||
// remote.
|
||||
(IsPlayerGuid(request.Entity.ServerGuid)
|
||||
? ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide
|
||||
: ObjectInfoState.EdgeSlide,
|
||||
: ObjectInfoState.EdgeSlide)
|
||||
| _getMoverPvpState(request.Entity.ServerGuid),
|
||||
request.Entity.Id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,18 @@ public sealed class GameWindow :
|
|||
private AcDream.Core.Physics.PhysicsDataCache _physicsDataCache =>
|
||||
_runtimeEntityObjects.Physics.DataCache;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): resolves a mover's own
|
||||
/// PK/PKLite/Impenetrable <see cref="AcDream.Core.Physics.ObjectInfoState"/>
|
||||
/// bits from its <c>ClientObjectTable</c> row — the same table CreateObject
|
||||
/// already populates <c>PublicWeenieBitfield</c> on (per-GUID, including
|
||||
/// every remote's own row, not just collision targets).
|
||||
/// </summary>
|
||||
private AcDream.Core.Physics.ObjectInfoState GetMoverPvpState(uint serverGuid) =>
|
||||
AcDream.Core.Physics.EntityCollisionFlagsExt.ResolveMoverPvpState(
|
||||
_runtimeEntityObjects.Objects,
|
||||
serverGuid);
|
||||
|
||||
// #184 Slice 2a: the per-remote dead-reckoning tick, extracted out of the
|
||||
// >10k-line TickAnimations (Code Structure Rule 1). Reusable setup/motion
|
||||
// policy is supplied through the once-bound live motion runtime, while the
|
||||
|
|
@ -653,7 +665,8 @@ public sealed class GameWindow :
|
|||
_runtimeEntityObjects.Physics,
|
||||
_liveEntityMotionBindings.GetSetupCylinder,
|
||||
_liveEntityMotionBindings.GetSetupMoverShape,
|
||||
AcDream.App.Physics.RemoteServerControlledVelocityCycle.Apply);
|
||||
AcDream.App.Physics.RemoteServerControlledVelocityCycle.Apply,
|
||||
GetMoverPvpState);
|
||||
_remoteInboundMotion = new AcDream.App.Physics.RemoteInboundMotionDispatcher(
|
||||
(movement, cellId, update) =>
|
||||
_liveEntityMotionBindings.RouteServerMoveTo(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue