bug: tile loading wastes requests and never recovers 404s #86
Notifications
Due Date
No due date set.
Blocks
#77 M4: real-phone playtest gate (Note 10, 60 fps)
SirStone/FFF_vtt_frozen
Reference: SirStone/FFF_vtt_frozen#86
Reference in New Issue
Block a user
Part of #63
Symptom (owner, GM playtest)
GM at zoom 0.115 on a 16384 px scene with 64 px tiles: ~29k tiles in view, ~55k tile requests, minutes to fill. The client sits at
TILE_CONCURRENCY = 8(client/src/tiles.ts) while the server gate + nginx sustain ~2.5k/s, so the browser queue, not the server, is the bottleneck.Diagnosis
client/src/render/modules/tiles.tsrebuilds the whole wanted array + Set on every settle: O(window) per tile, O(window^2) per fill.<img>error carries no status, then afetchre-asks for 403 vs 404/5xx.tiles.ts,deniedfor both 403 and 404) and never retried; the tile stays black until a page reload. A tile imported after the page loaded is never picked up.viewport.setScenesilently replaces a same-id scene without emitting. A newart_version(re-import) changes every URL but the tile layer is never told and keeps the old textures.v<art_version>) are immutable but only sentCache-Control: private, so every reload revalidates all of them.Scope
Client + minimal server/nginx cache header; no LOD and no zoom-clamp change (owner decision pending). Design-neutral: same tile grid, same gate, same disclosure rules.
Fix (this issue)
TILE_CONCURRENCYto a measured knee (measure on Full HD at GM fit and player 0.5; the concurrent cap stays bounded).fetch->createImageBitmap(status known, decode off the main thread), so a failure costs one request and gets its status directly.fog.fresh); 404/5xx/network become transient: up to 3 loads with exponential backoff, andretryFailed()onhello/reconnect and on scene/art_version change.viewport.setSceneemits for a same-id scene so anart_versionchange drops the texture cache and refetches.Cache-Control: private, max-age=31536000, immutable(still gated); DESIGN 3.3/11.1 updated.Acceptance
setSceneemits.readywith one request per tile; a 404 tile is retried a bounded number of times and recovers after the file appears + reconnect.devbox run test,client-test,e2e); issue closed with the numbers.Note: map images are being capped at Full HD by a separate ticket; the 16384 measurement is therefore not repeated here. The warning about huge survey fills is that ticket's docs change, not this one.
#77 is blocked by this.
SirStone referenced this issue2026-11-21 21:39:06 +01:00
Fixed in
52ab50d(pushed to main).What landed
orderTilesCentreOut); queued tiles that leave the window are dropped.TILE_CONCURRENCY8 -> 32 (measured knee, see below).fetch+createImageBitmap, so 403 vs 404/5xx comes from the same response (was<img>+ a secondfetchon every failure).fog.fresh). 404/5xx/network now transient: up to 3 loads with 250/500 ms backoff;hello/reconnect and a scene/art_versionchange reset the budget. A failure settling after a reconnect is a fresh first attempt; a load that left the window does not spend the budget.viewport.setSceneemits for a same-id scene, and a newart_versiondrops the texture cache and refetches.Cache-Control: private, max-age=31536000, immutable(still gated); DESIGN 3.3/11.1 and client/README updated.Numbers (owner scope change: map capped at Full HD, so measured 1920x1080 at tile 32 and 64; no 16384 run). Same repro method (headless Chromium, SwiftShader, page load -> wheel to fit / 0.5 ->
data-tiles=ready, min-of-3, interleaved A/B on a saturated host):At Full HD the wall-clock win is small; the load-bearing wins are correctness: a 404 no longer leaves a permanent black tile, a failure costs one request instead of two, an
art_versionchange refetches, and the reload revalidates no tile URLs.Tests: vitest for centre-out order, incremental invariants, retry budget/backoff, reconnect epoch,
art_versioninvalidation, same-scenesetSceneemit; e2e for GM survey fill (one request per succeeded tile, 2040 distinct) and 404 recovery after the file appears + a real reconnect (server restart, freshhello). Full gate green before push:devbox run test,client-test,e2e.#77 now has one fewer blocker (and remains blocked by the others).