Skip to content

Speed up loading, harden the site and enrich the landscape - #58

Merged
loeck merged 13 commits into
mainfrom
t3/revue-complete-site
Nov 9, 2026
Merged

loeck merged 13 commits into
mainfrom
t3/revue-complete-site

Conversation

@loeck

@loeck loeck commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

A full review of the site turned up slow loading (1.65 MB gzip of base64 Rapier, uncached textures), no security headers, Firefox sound failing outright, and reduced-motion visitors stuck on the loader. This PR fixes those, adds fog, snow, a rainbow, seasons and wildlife to the landscape, and restructures the scene code. The browser suite shrinks to a short smoke run, and the rest of the coverage moves to unit tests.

Changes

Loading

  • Rapier's WebAssembly ships as a hashed .wasm file that compiles while it downloads, instead of base64 inside JavaScript: 40 kB of script plus 1.19 MB of wasm, against 1.67 MB of script before. The download starts next to world preparation, and physics is ready 3–4× sooner.
  • Weather and terrain textures now start loading early. The textures have hashed names, so they get immutable caching; the desktop set is 26% smaller, and low-power devices get a half-resolution set (83% smaller).
  • The world cache is compressed (96.7 MB → 30.1 MB). It skips Save-Data, low-power devices, hidden tabs and tight storage quotas, and it no longer copies data twice when decoding.
  • The profile stays invisible while the loader runs and fades in with the scene; it is in the accessibility tree from the start and shows on keyboard focus. There is now a single 45 s load deadline.

Rendering

  • Dynamic resolution with a pixel budget (2.2 MP desktop, 1.2 MP low-power). It recognises 30 Hz battery-saver throttling instead of downgrading quality.
  • Cheaper depth of field. The contrast overlay is limited to the profile area. The sky reflection updates two faces per frame. The fish now refresh at an even 30 Hz. Per-frame allocations are removed and the water geometry leak is fixed.
  • Fix: under reduced motion, the first scene frame was drawn into the lake reflection's render target, so the loader stayed on screen. This bug already existed on main.

Ambience

  • Fog (low-lying banks, haloed lanterns) and snow, with ground and crown cover that builds up and melts.
  • A staged rainbow after showers.
  • Live weather refreshes every 15 minutes and blends in over 60 s.
  • Seasons from the date and latitude (?season= to force one): autumn colours, bare winter crowns.
  • Bats at dusk, dragonflies and midges on warm days.
  • Audio: Firefox fallback for cancelAndHoldAtTime; iOS interruption recovery and music unlock; mute is remembered; crickets follow the temperature; rain, fog and snow shape the mix; a synthesized reverb; wind panning; thunder pre-rendered so it no longer stalls frames.

Site and tooling

  • CSP and security headers in vercel.json. Their hashes are checked against the build (pnpm csp), and vite preview serves the same headers.
  • Open Graph image, JSON-LD, robots.txt, sitemap, icons and manifest. The custom cursor now stays on the canvas.
  • CI e2e job, Renovate, knip, lint warnings now fail the build, and a ready-path bundle budget.
  • The engine is split from 2,992 to 1,345 lines, with shared math, hash and shader-noise helpers. Their outputs are pinned by tests.
  • The e2e suite is down to 7 desktop Chromium tests, about 40 s. The extended, GPU and Firefox suites were dropped.

Follow-up feedback

  • The profile stays hidden until the scene is ready. Text and icons stay sharp: the pixel budget now scales only the scene, not the canvas. Text can't be selected.
  • Physical falling leaves (land on terrain, float on water). The held ball keeps buoyancy, drag, wake and splashes in water.
  • Four bird species with hinged wings, lit plumage and flocking.
  • The drifting white foam flecks are removed. Sound is +6 dB behind a limiter. Fixed environment-probe stalls that made tree crowns pop in brightness.
  • The waterfall is fed by a stream in a carved channel. Crown lighting uses per-crown normals, so there are no card patches or sway flicker. The held ball lays a continuous wake, and floating leaves sit visibly on the water.

Validation

  • pnpm check passes: typecheck, lint with --deny-warnings, formatting, 641 unit tests, build, bundle budgets, CSP hashes and knip.
  • pnpm e2e with GPU Chromium: 7/7 passed in 40 s.
  • Before trimming, the extended suite passed 25/25. The GPU suite passed 9/9 once the reduced-motion fix and a corrected fallback capture were in; that spec has since been removed.
  • Benchmarks on desktop WebGPU at 1280×720: scene ready 0.2–0.4 s sooner from a cached world; environment GPU time 0.46 → 0.16 ms; lakebed 0.57 → 0.39 ms. A suspected night CPU regression did not reproduce; it was host load.
  • Screenshots of fog, snow, rainbow, the four seasons and before/after day/night/rain matched the previous build, apart from the intended changes.
  • Three independent reviews of the full diff found 22 issues. All were fixed except one that was dismissed, with reason:
    • fixed issues include a world-cache decode bug with empty arrays, the CSP blocking the iOS music unlock, the rainbow switching sides mid-afternoon, the WebGL depth clear on the fish pass, and stuck sound controls while interrupted;
    • dismissed: wildlife meshes were already detached on dispose.
  • Not run: real phones, real WebKit, and hardware WebGPU outside this host. CI's software-WebGPU e2e job runs for the first time on this PR.

🤖 Generated with Claude Code

Loading: ship Rapier's WebAssembly as a streamed file instead of base64 JS,
prefetch physics, weather and hashed terrain textures alongside world
preparation, compress the OPFS world cache (96.7 MB to 30.1 MB) with guards,
and show the profile immediately with a fade.

Rendering: dynamic resolution with a pixel budget, cheaper depth of field,
contrast overlay and sky probe, an even fish/lakebed schedule, fewer per-frame
allocations, and a fix for reduced-motion visitors who never left the loader.

Ambience: fog, snow with ground cover, a staged rainbow, smooth live weather
refresh, seasons with autumn and winter foliage, dusk bats and daytime insects;
audio follows temperature, fog, snow and wind and works in Firefox.

Site and tooling: CSP and security headers verified against the build, SEO and
social metadata, a CI e2e job, Renovate, knip, warnings as errors, a split
landscape engine with shared math and noise helpers, and a short smoke e2e suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dotme Ready Ready Preview Nov 9, 2026 5:24pm UTC

The three-second reveal showed the text over the loader. The profile now
stays transparent (still in the accessibility tree, and shown on keyboard
focus) until the scene is ready or fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pixel budget lowered the canvas pixel ratio itself, so the profile text
and icons drawn on it by the contrast overlay were upscaled and soft. The
canvas now keeps the display ratio (capped at 1.75, or 1.25 on low-power
devices) and the budget only scales the scene's own render targets, like
the dynamic resolution. The body is unselectable again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ouder sound

- Shed leaves are light aerodynamic plates that flutter, tumble, land on the
  terrain and float on the live lake surface before fading.
- The held ball keeps physics in water: buoyancy, drag, wake, splashes and
  collisions while grabbed.
- Birds: four species (crow, black-headed gull, mallard, swift) with hinged
  wings, lit plumage, boids flocking and context-aware schedules.
- Remove the drifting white foam flecks on the lake.
- Sound: master +6 dB behind a gentle limiter.
- Environment probe no longer stalls at the 200 ms interval (crown lighting pops).
- Water impulses reject non-finite input and the solver heals NaN cells.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A stream runs down a carved channel from a spring to the waterfall's pool
  and spills over the lip; reaches the camera can't see cleanly are hidden
  rather than shown in slivers. World cache format bumped to 3.
- Foliage cards are lit with per-vertex crown normals and less per-card
  colour jitter, so crowns no longer show pale/dark card patches that pop
  as the wind sways them.
- The held ball lays a continuous wake along its path instead of a series
  of separate troughs.
- Floating leaves sit visibly above the drawn water surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Crowns: per-card flutter cut to a quarter and the screen-space leaf
  relief removed. Thousands of alpha-tested card edges moving a pixel every
  frame crawled without multisampling; crowns still lean and toss as a
  whole. Strong per-pixel flicker on crowns drops from 8.9% to 0.9%.
- Leaves: ground below the lake level counts as water, shallows included,
  so leaves landing near the shore float instead of sinking to the bed.
- CI e2e runs the page journeys only; its software WebGPU adapter cannot
  load the full scene.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Held ball: no periodic spray while dragged, and bobbing on a wave no
  longer counts as tearing out and plunging back in (it must clear the
  surface by 8 cm), which threw a splash and a ring at every bob.
- Floating leaves are drawn tilted toward the camera (up to about 26°,
  raised so their near edge stays dry): flat on the water they were seen
  edge-on from the bank and vanished as they landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Averaged atlas mips left distant crowns full of sub-pixel holes that
switched between leaf and bright sky as cards moved. Coverage now grows
by 0.3 per mip level (alpha test with mip scaling), so only the crown's
rim is cut out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A leaf falling from a crown is handed, as it touches open water, to a
pool of Rapier leaf floaters (16 on desktop, 6 on phones) with its
position, velocity, colour and drawn width. From there it floats on the
same buoyancy as the ball, rides the waves and ripples, drifts with the
wind and collides with the shore and the buoy. Floating leaves are drawn
turned toward the camera so they stay visible from the bank.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tilt toward the camera reduced from about 26° to 12°, its compensating
lift halved, and caught leaves drawn at most 3× their collider: steeper
and larger, they looked perched above the water.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Six 40 cm bats a few pixels across, flapping high over the lake after
sunset, read as stray leaves floating in the sky.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flow streaks seen end-on from the bank turned into vertical stripes. The
stream now rises at a gentle 10° (only the main fall is vertical), its
head is closed by rising ground, and it shows soft drifting foam lit
toward the viewer instead of mirroring dark trees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…blend

Desktop renders the view at 4x MSAA with alpha-to-coverage on foliage,
then blends 60% of the previous frame clamped to the current 3x3
neighbourhood before the lens, so swaying cutout edges no longer flip
between leaf and sky every frame. Pixels blinking on crowns drop by about
60-65% (75-90% for back-and-forth blinks) at about +1.4 ms GPU. The
mip-scaled coverage that filled small-leaf cards into squares is removed.
Low-power devices keep the plain alpha test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@loeck
loeck merged commit 37c0d53 into main Nov 9, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 4703945d Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant