Repository navigation
viewer: skip redundant chunk scans while stationary - #7164
ibrahimmaq14 wants to merge 1 commit into
Conversation
Review: viewer: skip redundant chunk scans while stationary (#7164)Environment: Windows 11 Pro, CPython 3.13, Node v24.19.0. No GPU or game files needed, since this only touches the viewer's streaming logic and its Node test harness. What changed
The PR stores the result of the last scan as a small key,
Three places clear the key:
The backoff check moved below the range check. Why the key is sufficientI checked what the scan result depends on in
Eviction and LOD-tier visibility still run every frame, before the early return. Only the candidate search is skipped, so this PR doesn't change unload behaviour or tier hand-off. Nits (non-blocking)
TestsThe two new tests cover the two skip conditions:
Verification (no game files)
The one failure, "Shift speeds the camera up and Ctrl slows it down…" ( Adherence
Verdict: approve. The invalidation points cover every change that can make a chunk eligible, the retry-deadline handling is correct, and the tests check both skip conditions. The nits are optional. AI-assisted. |
|
Thanks for this, the caching logic looks correct overall: The camera position is copied by value (x/y/z), so it's safe even if the camera reuses the same Vector3. The cache is only cleared in drop() and on load completion. Any other state change that affects range() or the chunk list will leave a stale cache, and loading will stall for as long as the camera stays still. For example: loading or replacing world / world.chunks Suggestions Put the invalidation in a small helper instead of writing lastCandidateScan = undefined in several places, so future code paths are less likely to miss it: |
lucastayaralvarenga-ui
left a comment
There was a problem hiding this comment.
Reviewed 729126f on Windows 11 Pro build 26300, Node.js 24.14.0, CPU only.
Both new stationary-camera regressions passed. I checked invalidation after drop and load completion, inclusion of vertical movement in the camera key, and the earliest in-range retry deadline.
The full viewer suite reports 58 passed and one failure. The failure is the existing keyboard-speed fixture with ReferenceError: AbortController is not defined. I ran the parent too, which reports the same error with 56 passed and one failure. Thus I verified the two added tests, with the full-suite limitation recorded here.
No blocking issue found in the changed scheduling logic. AI-assisted (Codex), synthetic loader and clock, no browser or GPU run.
|
Independent browser verification, AI-assisted, on exact head 729126f and direct parent c25b9f2. In the same eight-chunk synthetic world, both revisions issued the four nearest GLB requests first, then filled the freed slot with request five while the camera stayed still. A 3,000 m move evicted the original five chunks and requested both destination chunks. All seven requests per revision returned HTTP 200, parsed with GLTFLoader, and attached to the scene. Across four matched 12-tick windows with pending and settled loads at both camera positions, the parent ran 48 candidate scans and the head ran zero. Neither issued new requests during those windows. Load completion and camera movement still triggered scans on the head. T3 Preview Chromium, local Three.js r160, WebGL 2 through ANGLE/D3D11 on RTX 3080 (Windows driver 32.0.16.1664), Windows 11 build 26200. The preview tabs throttled animation while hidden, so scratch instrumentation invoked the stock callback once per controlled tick. Fetch, GLB parse and rendering ran normally. This measures scan counts per tick. Synthetic CPU-side fixtures, no game data. Node.js 24.16.0 viewer suites: 67/68 head and 65/66 parent. Both fail the existing keyboard fixture with AbortController is not defined. |
|
Tested
|
|
AI-assisted integration check on Windows with Node 24.16.0. Upstream Replayed a local saved map manifest (175 chunks, seven LOD tiers) through the Node viewer harness with synthetic loader completions. At eight camera positions, all load requests matched in order (215 requests summed across the eight independent starts). After each position settled, 120 stationary ticks issued no new loads on either tree. The index-only tree called the indexed candidate lookup 960 times during those windows. The combined tree called it zero times. This counts lookup calls, not elapsed time or GPU frames. No local asset data is included. |
Claimed in the coordination issue as stationary chunk-manifest scans. Implements the map viewer finding.
What and why
With the camera still and download slots available, the viewer checked every unloaded chunk every frame. Skip the candidate scan at the same camera position until a load settles, a chunk is dropped, or an in-range retry becomes due. The existing per-frame pass still handles eviction and LOD visibility, and eligible requests use the same nearest-first order.
Tested
mainwithAbortController is not definedand is addressed by Fix/viewer horizontal wheel #6265. Applying Fix/viewer horizontal wheel #6265 to a temporary copy made all 61 streaming tests pass.git diff --checkpassed. The CPU translator suite ran 5,889 tests across 443 files. Three modules failed in unchanged translator code or tests (test_float_nan_fract,test_image_atomics_guard,test_image_store_d16).AI-assisted: yes (OpenAI Codex).
Checklist