docs(#145): Slice 3 design — carried-anchor (body.Position - CellPosition.Origin) replaces TryGetTerrainOrigin
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7cae03951e
commit
9e184eb861
1 changed files with 10 additions and 0 deletions
|
|
@ -312,6 +312,16 @@ Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>"
|
||||||
|
|
||||||
**Goal:** The outdoor membership pick stops deriving the landblock from `TryGetTerrainOrigin` (which falls back to `(0,0)` for unstreamed neighbours). It runs `AdjustToOutside` directly on the carried `(cell, local)` pair. This is the fix — the far-town cascade becomes impossible.
|
**Goal:** The outdoor membership pick stops deriving the landblock from `TryGetTerrainOrigin` (which falls back to `(0,0)` for unstreamed neighbours). It runs `AdjustToOutside` directly on the carried `(cell, local)` pair. This is the fix — the far-town cascade becomes impossible.
|
||||||
|
|
||||||
|
**THE MECHANISM (designed + verified 2026-06-21 — the carried-anchor):** the landblock world origin acdream needs is exactly `blockOrigin = body.Position − body.CellPosition.Frame.Origin` (world pos minus the carried cell-local). This is the *true* landblock origin derived from the carried frame — correct even for an UNSTREAMED neighbour, where `TryGetTerrainOrigin` returns `(0,0)`. Verified against the runaway: at the first far-town tick `body.Position≈(14.8,−0.088,12)` (streaming-rel) and `CellPosition.Frame.Origin≈(14.8,191.9,12)` (local in `0xC95A`), so `blockOrigin ≈ (0,−192)` — exactly the value the handoff confirmed correct for `0xC95A`. Feeding this `blockOrigin` into the EXISTING pick (`pickPos = worldSphereCenter − blockOrigin` at `CellTransit.cs:845`) and `AddAllOutsideCells` makes the whole downstream membership cascade-proof with no rewrite of the pick logic.
|
||||||
|
|
||||||
|
**Implementation steps:**
|
||||||
|
1. **Seed** `_body.SnapToCell(cellId, worldPos, wireLocal)` at the 3 player-placement sites — login spawn (`GameWindow.cs:~2930`, wire local `(p.PositionX,Y,Z)`, cell `p.LandblockId`), teleport arrival (`~:5474/:5537` — seed the RESOLVED cell + its local), inbound player update. Without a seed, `CellPosition.ObjCellId==0` and the fix no-ops (legacy fallback). Behavior-neutral.
|
||||||
|
2. **Thread** `Vector3? carriedBlockOrigin` into `CellTransit.FindCellSet`/`FindCellList`/`BuildCellSetAndPickContaining` (default `null` → legacy `TryGetTerrainOrigin`). When supplied, it REPLACES the `:736` derivation. Compute it in `PhysicsEngine.ResolveWithTransition` from the passed `body` (`body.CellPosition.ObjCellId` outdoor & seeded → `body.Position − body.CellPosition.Frame.Origin`, else `null`), thread through the sweep (`RunCheckOtherCellsAndAdvance` → `FindCellSet`) in `TransitionTypes.cs`. ⚠ The sweep threading is the delicate part — `RunCheckOtherCellsAndAdvance` is in the ~2,300-line `TransitionTypes`; the resolve `body` must reach the `FindCellSet` call (add a field on the transition/sphere-path state set at resolve entry). Read that path fully before editing.
|
||||||
|
3. **Make membership authoritative**: the controller commits `_body.CellPosition.ObjCellId` (or the now-correct `resolveResult.CellId`) — they agree once `blockOrigin` is the carried anchor. Delete the legacy-anchor comment at `:732-735`.
|
||||||
|
4. **Test** `TeleportFarTownRunawayTests` from `desync-capture.jsonl` (south + east edge, unregistered neighbour, assert no march). Hold every existing membership/replay test green.
|
||||||
|
|
||||||
|
Note: the OTHER `TryGetTerrainOrigin` site (`CellTransit.cs:484`, `BuildShadowCellSet`) is registration-side collision (Slice 4 concern), NOT the player pick — leave it for Slice 4.
|
||||||
|
|
||||||
**Files:**
|
**Files:**
|
||||||
- Modify: `src/AcDream.Core/Physics/CellTransit.cs:732-736` (the discarded-bool fallback), `:242` (`AddAllOutsideCells` block-origin subtraction), `:845-849` (containing pick), `:484` (the other seed)
|
- Modify: `src/AcDream.Core/Physics/CellTransit.cs:732-736` (the discarded-bool fallback), `:242` (`AddAllOutsideCells` block-origin subtraction), `:845-849` (containing pick), `:484` (the other seed)
|
||||||
- Modify: `src/AcDream.Core/Physics/PhysicsEngine.cs:603-625` (the resolve loop feeds the pick)
|
- Modify: `src/AcDream.Core/Physics/PhysicsEngine.cs:603-625` (the resolve loop feeds the pick)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue