fix(physics): make collision activation starvation-free
This commit is contained in:
parent
d94145e6b8
commit
6b28ff999c
14 changed files with 4637 additions and 474 deletions
|
|
@ -494,13 +494,47 @@ What exists and is active:
|
|||
target prefix (including a withdrawn repair marker); target-root statics come
|
||||
from the authored replacement. Runtime mutation-gates their exact capture,
|
||||
refreshes each through the host work meter, and builds every cache/graph/
|
||||
shadow replacement list through one-work-unit seal cursors. The final update-
|
||||
thread activation performs one mutation-version check and installs the sealed
|
||||
records without heap allocation before emitting
|
||||
`CollisionGenerationCommitted`. Cancellation disposes only the named staging
|
||||
generation and never withdraws the previous active world. Thus readers see
|
||||
the complete old generation or complete new generation, never a mixed
|
||||
cell/cache/shadow world.
|
||||
shadow replacement through one-work-unit seal cursors. Stable per-prefix
|
||||
owner slots replace the former registry-global mutation gate. One Runtime-
|
||||
scoped versioned journal coalesces repeated live mutations by owner instead
|
||||
of copying the owner into every draft on every event. Each draft reconciles
|
||||
only the latest exact state for owners changed during its lifetime, one owner
|
||||
per seal step, so unrelated or continuously moving owners cannot restart the
|
||||
target cursors. Once discovered, a relevant owner receives exact subscribed
|
||||
updates without restoring global fanout. First entry to or departure from a
|
||||
target after the global slot cursor has passed is routed through the owner's
|
||||
changed prefix to that one matching draft. During topology construction a
|
||||
visited unrelated owner receives only a cheap coalesced dirty notification;
|
||||
its exact mirror is deferred to one metered seal unit. Once the topology seal
|
||||
exists, observed owners temporarily write through exactly until activation,
|
||||
so the finite pre-seal queue drains even when several unrelated owners move
|
||||
continuously. Production activates in that same update-thread call. Slots older than a
|
||||
newer draft's captured root are superseded at the tail rather than reused
|
||||
behind live cursors; new drafts start at their captured suffix, obsolete
|
||||
slots compact incrementally, and the journal clears with the last draft.
|
||||
Empty prefix containers are reclaimed under GUID churn; seal cursors retain
|
||||
their captured slot lists.
|
||||
Cache, CellGraph, engine, and shadow topology share one complete off-side
|
||||
`CollisionWorldState`. Admission captures the current root reference in O(1)
|
||||
and materializes the non-target leaves through the same one-work-unit frame
|
||||
meter; a dense resident world is never cloned synchronously. After an older
|
||||
preparation commits, its exact landblock delta queues into every later draft
|
||||
and drains one cache, graph, landblock, or owner leaf per seal step. A later
|
||||
demotion or withdrawal cancels matching queued/active rebases and tombstones
|
||||
that prefix in unfinished source scans, then retires one owner/cache/graph/
|
||||
outdoor leaf per seal step from growable retirement storage. Commit rechecks
|
||||
both retirement and rebase state after sealing, so retired topology cannot
|
||||
return or cause a drafts-times-world-size update spike.
|
||||
The host immediately performs the zero-work root transfer in the same update-
|
||||
thread call that completes final reconciliation, so continuous unrelated
|
||||
movement cannot manufacture a required quiet frame between seal and commit.
|
||||
Deterministic preparation order prevents a later draft from exposing early,
|
||||
inheriting cancelled topology, or overwriting a committed prefix. Final activation is one
|
||||
zero-allocation volatile root transfer that preserves public facade identity,
|
||||
revokes staging, and then emits `CollisionGenerationCommitted`. Cancellation disposes only the named
|
||||
staging generation and never withdraws the previous active world. Thus
|
||||
readers see the complete old generation or complete new generation, never a
|
||||
mixed cell/cache/shadow world.
|
||||
- `ShadowObjectRegistry` gives movement a per-cell broadphase over nearby
|
||||
objects and buildings. Streaming reflood is structurally part of the Runtime
|
||||
collision-generation commit; there is no independent post-publication
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue