fix(runtime): give the no-window host a post-merge canonical cell commit (D1, AD-60/AD-64, AP-146/#320)
C5b (735f0a72) made the steady-state accepted-Position merge stop writing residency. That is retail-correct — HandleReceivedPosition @0x00453FD0 reads the wire objcell_id into a local and never assigns the object's cell — and it stays. What C5b did not account for is that its replacement writers both live in AcDream.App: the OnPosition prologue rebucket (AD-60's W2) and the post-routing wire-cell adopt (W3, AP-135). The two hosts run parallel, non-shared inbound routes. LiveEntitySessionController -> LiveEntityNetworkUpdateController.OnPosition is graphical-only; RuntimeLiveEntitySessionController.OnPositionUpdated is the no-window route and is constructed only at HeadlessSessionHost.cs:682. So AcDream.Headless had NO post-merge cell writer at all. Every remote's FullCellId was written at create/placement and then frozen for the session — and RuntimeEntityObjectViews .Snapshot projects exactly that field as RuntimeEntitySnapshot.CellId, i.e. every bot's entire world view. The local player lost one of AP-146's three refresh edges, which matters beyond cosmetics: RuntimeSetPositionState .IsAffectedCollisionResident reads FullCellId to pick which bodies a landblock retirement parks, so a bot running A->B without teleporting would have retired A while parking a body physically in B. The fix, in three parts: 1. RuntimeEntityObjectLifetime.CommitWireCellRebucket — a new Runtime owner for the committed VALUE, extracted verbatim from LiveEntityRuntime .RebucketLiveEntity. This is also the root-cause fix for the layering inversion the review found: AD-60 was documenting its own correctness by naming an App class the Runtime assembly cannot reference. Behaviour on the graphical side is unchanged — record.FullCellId is a proxy for record.Canonical.FullCellId, which is the record the callee reads, and the commit is still CommitRebucket. Verified load-bearing for BOTH hosts: sabotaging the preserve branch reddens the graphical LiveEntityRuntimeTests.CanonicalOnlyRebucket_DoesNotOverwriteAuthoritativeFullCell as well as the new headless assertion. 2. RuntimeLiveEntitySessionController.TryCommitAcceptedWireCell — the no-window W2, under the same reachability rules the graphical route applies: Rejected writes nothing (the shape the App authority gate produces by returning false); a bound-projectile packet writes nothing (routed by the graphical host through the canonical projectile placement owner, which returns before W2); an active initial-create residence writes nothing (RebucketLiveEntity's own early return — while the lease is live the SetPosition conductor is the sole cell authority); a local ForcePosition writes only when the accepted-Position drive declined it (NotApplicable), because a handled force is placement-receipt-authoritative. W2/W3 themselves are untouched. 3. On the committed value (the landblock-vs-cell trap). RebucketLiveEntity's preserve branch fires on a LANDBLOCK-shaped id — low 16 bits 0xFFFF — and exists for LocalPlayerProjectionController.Project, the per-frame local movement caller that emits exactly that shape. An inbound wire objcell_id is never landblock-shaped, so on the accepted-Position route the branch is not taken and the exact wire cell is committed. That is what W2 commits today and what this now commits; the no-window host has no per-frame caller at all. Ordering is matched, not improved on: the force drive submits its placement before the commit, so its first submit still reads the pre-commit FullCellId — AP-138's amended route-2 CurrentCellId measurement. Bookkeeping in this commit: - AD-60 corrected. Its surviving-channel enumeration presented "the local force path, the missile arm" as exhaustive; the entire no-window host belonged in it. 23aa62f2's W2/W3-redundancy measurement is preserved verbatim. - AP-146 and #320 amended the same way — their three-edge list was written from the graphical host and silently assumed both hosts shared it. The no-window host had two of three; it now has all three. - AD-64 filed: the reachability decision is now expressed once per host. The value is single-sourced; the gate set is not. - #324 filed: unifying the two session controllers is the genuinely correct fix and is campaign-sized (presentation recovery, hydration, the equipped-child renderer, and the remote/projectile routing arms only one host has). Not attempted here, per the fix brief. Gates. Release build 0 errors. Complete suite 11,141 passed / 4 skipped / 0 failed, against the 11,134 / 4 / 0 baseline at23aa62f2— net +7, exactly the 7 tests added. Eight sabotages verified, each red on at least one discriminating test and green when reverted: remote commit removed (2 Runtime + the end-to-end Headless test); local ordinary commit removed; local NotApplicable-force commit removed; force commit made unconditional; residence gate removed; missile gate removed; Rejected gate removed; preserve branch broken (red on both hosts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
23aa62f292
commit
ff100cf33f
8 changed files with 746 additions and 22 deletions
|
|
@ -932,17 +932,21 @@ public sealed class LiveEntityRuntime : ILiveEntityRadarSource
|
|||
bool visible = _spatial.IsLiveEntityProjectionResident(key);
|
||||
record.IsSpatiallyVisible = visible;
|
||||
RefreshPresentation(record);
|
||||
uint committedFullCell =
|
||||
(spatialCellOrLandblockId & 0xFFFFu) != 0xFFFFu
|
||||
? spatialCellOrLandblockId
|
||||
: record.FullCellId;
|
||||
uint committedLandblock = spatialCellOrLandblockId == 0
|
||||
? 0u
|
||||
: (spatialCellOrLandblockId & 0xFFFF0000u) | 0xFFFFu;
|
||||
if (!_entityObjects.CommitRebucket(
|
||||
// D1 (C5b architecture review): the committed-value derivation that
|
||||
// used to be inline here — the landblock-shaped-id preserve branch
|
||||
// and the canonical-landblock mask — moved VERBATIM into
|
||||
// RuntimeEntityObjectLifetime.CommitWireCellRebucket so the
|
||||
// no-window host can commit the same value from its own route
|
||||
// instead of having no post-merge cell writer at all. Behaviour is
|
||||
// unchanged: `record.FullCellId` is a proxy for
|
||||
// `record.Canonical.FullCellId` (see this class's own property),
|
||||
// which is the record the callee reads, and the commit itself is
|
||||
// still CommitRebucket. AP-146/#320's "LiveEntityRuntime.cs:935-938
|
||||
// preserves the prior canonical cell" citation now resolves to that
|
||||
// method.
|
||||
if (!_entityObjects.CommitWireCellRebucket(
|
||||
record.Canonical,
|
||||
committedFullCell,
|
||||
committedLandblock))
|
||||
spatialCellOrLandblockId))
|
||||
{
|
||||
ThrowAfterCommittedProjectionChange(
|
||||
serverGuid,
|
||||
|
|
|
|||
|
|
@ -1943,15 +1943,28 @@ public sealed class RuntimeEntityObjectLifetime : IDisposable
|
|||
// The snapshot's Position field itself IS still refreshed; only the
|
||||
// derived FullCellId write is withheld.
|
||||
//
|
||||
// Two wire-cell writers deliberately SURVIVE this change, downstream
|
||||
// of the merge and outside the classification window: the OnPosition
|
||||
// prologue rebucket (LiveEntityNetworkUpdateController ->
|
||||
// LiveEntityRuntime.RebucketLiveEntity -> CommitRebucket, which is
|
||||
// also the local player's own cell-freshness path, AP-146/#320) and
|
||||
// the post-routing wire-cell adopt for non-placing arms
|
||||
// (TryAdoptWireCellAfterRouting, filed at AP-135). Neither is gated
|
||||
// here: gating the prologue rebucket would freeze the local player's
|
||||
// Wire-cell writers deliberately SURVIVE this change, downstream of
|
||||
// the merge and outside the classification window. The canonical one
|
||||
// is CommitWireCellRebucket, in this class: BOTH inbound routes call
|
||||
// it after the merge, and it is also the local player's own
|
||||
// cell-freshness path (AP-146/#320). Neither route gates it here:
|
||||
// gating the prologue rebucket would freeze the local player's
|
||||
// canonical cell between teleports.
|
||||
//
|
||||
// CORRECTED 2026-08-05 at the C5b architecture review (D1). This
|
||||
// comment used to enumerate the survivors as two App classes —
|
||||
// LiveEntityNetworkUpdateController -> LiveEntityRuntime and
|
||||
// TryAdoptWireCellAfterRouting (AP-135) — which was both a layering
|
||||
// inversion (a Runtime file documenting its own correctness by
|
||||
// naming classes this assembly cannot reference) and, worse, WRONG:
|
||||
// it described the graphical host as though it were the only host.
|
||||
// The no-window route (RuntimeLiveEntitySessionController) had
|
||||
// neither writer, so it had no post-merge cell writer at all and
|
||||
// every entity's FullCellId froze at its placement value for the
|
||||
// session. The graphical route's post-routing adopt still exists and
|
||||
// is still filed at AP-135; the no-window route has no remote
|
||||
// contact routing and therefore no analogue of it. AD-60 and AD-64
|
||||
// carry the complete channel list.
|
||||
Entities.RefreshSnapshot(
|
||||
canonical,
|
||||
snapshot,
|
||||
|
|
@ -2028,6 +2041,72 @@ public sealed class RuntimeEntityObjectLifetime : IDisposable
|
|||
() => canonical.SpatialAuthorityVersion == spatialVersion);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D1 (C5b architecture review): the CANONICAL half of the wire-cell
|
||||
/// rebucket (AD-60's W2), expressed once, in Runtime, for every host.
|
||||
///
|
||||
/// <para>
|
||||
/// <b>Why this exists.</b> C5b made the steady-state merge stop writing
|
||||
/// residency (<c>RefreshSnapshot(..., refreshPosition: false)</c> in
|
||||
/// <see cref="TryApplyPosition"/>) and left the graphical
|
||||
/// <c>OnPosition</c> prologue rebucket
|
||||
/// (<c>LiveEntityNetworkUpdateController</c> →
|
||||
/// <c>LiveEntityRuntime.RebucketLiveEntity</c>) as the replacement
|
||||
/// writer. That writer lives in <c>AcDream.App</c>, so the no-window
|
||||
/// host had NO post-merge cell writer at all: a headless remote's
|
||||
/// <see cref="RuntimeEntityRecord.FullCellId"/> was written at
|
||||
/// create/placement and then frozen for the session, and the local
|
||||
/// player lost one of AP-146's three refresh edges. The derivation was
|
||||
/// also the reason AD-60 documented itself by naming an App class this
|
||||
/// assembly cannot reference — a layering inversion. Both are fixed by
|
||||
/// owning the rule here and letting each host's route call it.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// <b>The landblock-vs-cell rule (verbatim from the graphical site it
|
||||
/// was extracted from).</b> <paramref name="spatialCellOrLandblockId"/>
|
||||
/// is overloaded. A LANDBLOCK-shaped id — low 16 bits <c>0xFFFF</c>,
|
||||
/// which is what <c>LocalPlayerProjectionController.Project</c> emits
|
||||
/// for ordinary per-frame movement — deliberately PRESERVES the exact
|
||||
/// cell and updates only the canonical landblock; writing the coarser
|
||||
/// value would destroy a resolved EnvCell. Any other id is an exact
|
||||
/// cell and is committed as-is. An inbound wire <c>objcell_id</c> is
|
||||
/// always cell-shaped (ACE never sends <c>0xFFFF</c> in the low half),
|
||||
/// so on the accepted-Position route this always commits the exact wire
|
||||
/// cell — the preserve branch is there for the per-frame local caller,
|
||||
/// which no-window hosts do not have. <c>0</c> is passed through
|
||||
/// unchanged (cell 0 + landblock 0), the withdrawal shape.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// This method deliberately carries NO gates. Which packets may reach a
|
||||
/// wire-cell commit is the caller's decision and differs per host route
|
||||
/// (the graphical route returns ahead of it for the local force arm,
|
||||
/// the missile arm, and an active initial-create residence); duplicating
|
||||
/// those tests here would double-gate one host and silently widen the
|
||||
/// other.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool CommitWireCellRebucket(
|
||||
RuntimeEntityRecord canonical,
|
||||
uint spatialCellOrLandblockId,
|
||||
Action<RuntimeEntityRecord>? acknowledgeProjection = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(canonical);
|
||||
uint committedFullCell =
|
||||
(spatialCellOrLandblockId & 0xFFFFu) != 0xFFFFu
|
||||
? spatialCellOrLandblockId
|
||||
: canonical.FullCellId;
|
||||
uint committedLandblock = spatialCellOrLandblockId == 0
|
||||
? 0u
|
||||
: (spatialCellOrLandblockId & 0xFFFF0000u) | 0xFFFFu;
|
||||
return CommitRebucket(
|
||||
canonical,
|
||||
committedFullCell,
|
||||
committedLandblock,
|
||||
acknowledgeProjection);
|
||||
}
|
||||
|
||||
public bool CommitWithdrawal(
|
||||
RuntimeEntityRecord canonical,
|
||||
Action<RuntimeEntityRecord>? acknowledgeProjection = null)
|
||||
|
|
|
|||
|
|
@ -237,9 +237,26 @@ public sealed class RuntimeLiveEntitySessionController
|
|||
out _,
|
||||
out AcceptedPhysicsTimestamps timestamps);
|
||||
if (!known
|
||||
|| !isLocal
|
||||
|| disposition is PositionTimestampDisposition.Rejected)
|
||||
{
|
||||
// Rejected writes nothing anywhere — the same shape the
|
||||
// graphical authority gate produces by returning false from
|
||||
// LiveEntityInboundAuthorityGate.TryAcceptPosition, which is
|
||||
// ahead of every wire-cell writer.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isLocal)
|
||||
{
|
||||
// D1 (C5b architecture review): the no-window host's half of
|
||||
// AD-60's W2. The graphical route commits the accepted wire
|
||||
// cell for EVERY classification that reaches its generic tail,
|
||||
// remotes included; this route used to return here, so a
|
||||
// headless remote's FullCellId was written once at
|
||||
// create/placement and then frozen for the whole session —
|
||||
// and RuntimeEntityObjectViews.Snapshot feeds exactly that
|
||||
// field to every bot's RuntimeEntitySnapshot.CellId.
|
||||
TryCommitAcceptedWireCell(update);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -307,6 +324,20 @@ public sealed class RuntimeLiveEntitySessionController
|
|||
// fallback this disposition always had — it must still
|
||||
// run, exactly as every other disposition's fallback
|
||||
// does below.
|
||||
//
|
||||
// D1: ... and so does the wire-cell commit. A force the
|
||||
// drive HANDLED (Committed/DeferredCell) is
|
||||
// placement-receipt-authoritative for residency, and a
|
||||
// Rejected/Contention force leaves the last committed
|
||||
// cell alone (AD-62's shapes) — both are exactly why
|
||||
// the graphical route returns ahead of W2 on every
|
||||
// status except NotApplicable. Ordering matters as well
|
||||
// as reachability: the drive submits its placement
|
||||
// BEFORE this point, so its first submit reads the
|
||||
// pre-commit FullCellId, which is the source landblock
|
||||
// — AP-138's amended route-2 measurement, matched here
|
||||
// rather than accidentally improved on.
|
||||
TryCommitAcceptedWireCell(update);
|
||||
_worldProjection?.ProjectPosition(
|
||||
record,
|
||||
isLocalPlayer: true,
|
||||
|
|
@ -315,6 +346,7 @@ public sealed class RuntimeLiveEntitySessionController
|
|||
}
|
||||
else
|
||||
{
|
||||
TryCommitAcceptedWireCell(update);
|
||||
_worldProjection?.ProjectPosition(
|
||||
record,
|
||||
isLocalPlayer: true,
|
||||
|
|
@ -324,6 +356,63 @@ public sealed class RuntimeLiveEntitySessionController
|
|||
TryCompletePortal();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D1 (C5b architecture review): commits the accepted wire cell to
|
||||
/// canonical residency for a no-window host, under the same
|
||||
/// reachability rules the graphical <c>OnPosition</c> route applies to
|
||||
/// AD-60's W2. The committed VALUE is
|
||||
/// <see cref="RuntimeEntityObjectLifetime.CommitWireCellRebucket"/>'s —
|
||||
/// one rule, shared by both hosts, including its landblock-vs-cell
|
||||
/// branch.
|
||||
///
|
||||
/// <para>
|
||||
/// Two gates mirror callers the graphical route has and this one does
|
||||
/// not. <b>The initial-create residence</b> is
|
||||
/// <c>LiveEntityRuntime.RebucketLiveEntity</c>'s own early return
|
||||
/// (<c>MaterializationResidence is AwaitRuntimePlacement &&
|
||||
/// HasActiveInitialCreateResidence</c>): while the lease is live,
|
||||
/// Runtime's <c>SetPosition</c> conductor is the sole cell authority.
|
||||
/// Only the residence half is tested here, because it IS the whole
|
||||
/// test on this side — the App enum's <c>AwaitRuntimePlacement</c> value
|
||||
/// exists to mark records that took the residence route, which is every
|
||||
/// record a projection-backed direct host registers, and a content-less
|
||||
/// direct host opens no lease at all
|
||||
/// (<see cref="OnSpawned"/>). <b>A missile packet</b> is routed by the
|
||||
/// graphical host through the canonical projectile placement owner and
|
||||
/// returns before W2; the predicate below is the exact conjunction that
|
||||
/// route's own null-classification arm uses
|
||||
/// (<c>LiveEntityNetworkUpdateController.OnPosition</c>, the
|
||||
/// <c>isMissilePacket</c> ternary), which its D-P1 comment records as
|
||||
/// equivalent to the classifier's <c>ProjectileAuthoritative</c>
|
||||
/// operation kind. Committing a wire cell for a projectile here would
|
||||
/// invent residency a placement route owns.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private void TryCommitAcceptedWireCell(
|
||||
WorldSession.EntityPositionUpdate update)
|
||||
{
|
||||
if (!Entities.Entities.TryGetActive(
|
||||
update.Guid,
|
||||
out RuntimeEntityRecord canonical)
|
||||
|| Entities.TryGetInitialCreateResidence(canonical, out _)
|
||||
|| IsMissilePacket(canonical, update.Guid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_ = Entities.CommitWireCellRebucket(
|
||||
canonical,
|
||||
update.Position.LandblockId);
|
||||
}
|
||||
|
||||
private bool IsMissilePacket(
|
||||
RuntimeEntityRecord canonical,
|
||||
uint guid) =>
|
||||
guid != _runtime.PlayerIdentity.ServerGuid
|
||||
&& (canonical.FinalPhysicsState & PhysicsStateFlags.Missile) != 0
|
||||
&& canonical.Projectile is { } projectile
|
||||
&& ReferenceEquals(canonical.PhysicsBody, projectile.Body);
|
||||
|
||||
private void OnVectorUpdated(VectorUpdate.Parsed update) =>
|
||||
_ = Entities.TryApplyVector(
|
||||
update,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue