fix(vfx): resolve an entity's cell through one owner so effects follow it

Fixes #282 (plan S2). Adds register row AP-133.

Retail gives a CPhysicsObj exactly ONE cell: ShouldDrawParticles @0x0050fe60
reads this->cell and calls IsInView on it, and set_cell_id @0x0050f4f0 /
change_cell @0x00513390 are the only things that move it. acdream splits that
into ParentCellId (render parent, deliberately null for outdoor dat stabs) and
EffectCellId (the authored landcell those parentless stabs still need) - an
adaptation, now recorded as AP-133.

WorldEntity.EffectCellId documents itself as the stab field, with live and
interior entities using ParentCellId. f24532ad began writing it for live
entities too. Because EntityEffectPoseRegistry resolved EffectCellId FIRST,
that write won - and the audit shows only 3 of 14 cell writers maintain it.
The other 11 do not, including the hottest paths: RemotePhysicsUpdater:239,294
and LiveEntityOrdinaryPhysicsUpdater:107 write ParentCellId every physics tick
from the snapshot, and LocalPlayerProjectionController:79 writes the local
player's cell every frame.

So a moving entity updated its cell constantly while EffectCellId stayed
frozen at whatever cell it materialized in. Its particles and lights kept
being tested against that stale cell and failed IsInView the moment it crossed
a boundary - effects vanishing on a monster that is plainly visible, or
drawing through a wall from a room the viewer cannot see.

The consumers had also drifted into disagreeing: EntityEffectPoseRegistry
preferred EffectCellId while WbDrawDispatcher.TryGetEntityCell and the remote
spawn seed preferred ParentCellId - two answers to "which cell is this in".

- WorldEntity.VisibilityCellId (ParentCellId ?? EffectCellId) is the single
  accessor; all five consumer sites resolve through it, so the precedence
  cannot drift apart again.
- LiveEntityRuntime's three live-entity EffectCellId writes are removed,
  restoring the field to its documented purpose. Its real writers -
  LandblockLoader:80,97 and LandblockBuildFactory:408 - are untouched, and the
  parentless-stab path is pinned by a new test.
- f24532ad's actual fix is preserved: RebucketLiveEntity still installs the
  committed cell, just on the one field live entities use.

LiveEntityLightControllerTests.Refresh_FollowsCurrentTopLevelRootAndCell is
back to moving the entity by ParentCellId alone - its original pre-f24532ad
form - and passes. CanonicalOnlyRebucket_DoesNotOverwriteAuthoritativeFullCell
had its two EffectCellId assertions (added by f24532ad, encoding the defect)
replaced with the corrected contract: ParentCellId set, EffectCellId null,
VisibilityCellId resolving - a stronger assertion, not a relaxed one.

Complete Release solution: 10,836 passed / 4 skipped / 0 failed.

User visual check still outstanding: a monster with an active spell effect
crossing a cell boundary, and a lit static object, indoors and outdoors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-03 14:02:03 +02:00
parent 97d11e6c7f
commit 3c36b4cc21
10 changed files with 134 additions and 29 deletions

View file

@ -30,7 +30,7 @@ Plan: [`2026-08-03-recent-regression-cleanup.md`](plans/2026-08-03-recent-regres
All three were introduced by the 2026-08-02/03 stabilization batch, found while
reconciling #281's 43 test failures.
- **#282OPEN — live entities now write `EffectCellId`, contradicting its
- **#282DONE (2026-08-03) — live entities now write `EffectCellId`, contradicting its
documented contract, and 12 `ParentCellId` writers cannot keep it in sync.**
`WorldEntity.EffectCellId` (src/AcDream.Core/World/WorldEntity.cs:95-102)
documents itself as existing ONLY for outdoor dat stabs, which keep a null
@ -50,6 +50,25 @@ reconciling #281's 43 test failures.
the null-render-parent stab case. Fix shape: one owner writes the entity's
visibility cell and the effects path reads that owner. Caught in miniature by
`LiveEntityLightControllerTests.Refresh_FollowsCurrentTopLevelRootAndCell`.
**Landed 2026-08-03 (S2).** The audit found 14 cell writers: only 3 rebucket
(and so repaired `EffectCellId` by accident), while 11 do not — including the
hottest paths, `RemotePhysicsUpdater:239,294` and
`LiveEntityOrdinaryPhysicsUpdater:107` (every physics tick from the snapshot)
and `LocalPlayerProjectionController:79` (the local player every frame). So a
moving entity updated its cell constantly while `EffectCellId` stayed frozen.
The consumers also disagreed: `EntityEffectPoseRegistry` preferred
`EffectCellId`, while `WbDrawDispatcher.TryGetEntityCell` and the remote
spawn seed preferred `ParentCellId`. Fix: `WorldEntity.VisibilityCellId`
(`ParentCellId ?? EffectCellId`) is the single accessor every consumer
resolves through; `LiveEntityRuntime`'s three live-entity `EffectCellId`
writes are removed, restoring the field to its documented stab/building-shell
purpose (`LandblockLoader:80,97`, `LandblockBuildFactory:408`). Register row
AP-133 records the adaptation and the exact way it can regress.
`Refresh_FollowsCurrentTopLevelRootAndCell` is back to moving the entity by
`ParentCellId` alone — its original pre-`f24532ad` form — and passes.
Complete Release solution: 10,836 passed / 4 skipped / 0 failed.
**User visual check still outstanding:** a monster with an active spell
effect crossing a cell boundary, and a lit static object, indoors and out.
- **#283 — OPEN — Runtime's world frame and App's render origin rebase at
different moments during a teleport.** `670f307c` gave Runtime its own world
frame (`RuntimePhysicsState.ObserveLocalWorldFrame`), which rebases the