T-002: Viewer pipeline check: native, offscreen, web, Cloudflare
Goal
Prove the whole display path end to end before anything depends on it: a Bevy app that renders natively with no window on this monitor-less machine, builds to WebAssembly, and deploys to Cloudflare Pages.
Scope
crates/viewer: a Bevy app (latest stable release) drawing a few thousand moving coloured spheres from placeholder data. Keep the data source behind a small boundary so T-014 can swap in the real sim. Orbit and zoom camera for mouse and touch.viewer --screenshot out.png: render offscreen with no window and write a PNG.- Web build: WebGPU where available, WebGL2 otherwise. A loading indicator. Should work in phone browsers.
- Scripts:
scripts/build-web.sh,scripts/deploy-web.sh,scripts/screenshot.sh. - One site, several parts: the deploy script assembles
dist/from the viewer build plus the static folderconcepts/(served at/concepts/), leaving room for/dashboard/and/log/later. Deploy to a Cloudflare Pages project namedalife, creating it if needed. Wrangler is already signed in. - Measure and record in
docs/VIEWER.md: wasm size, build times, frames per second for 5,000 spheres native and in headless Chrome, plus how to build, run, screenshot and deploy.
Done when
- ☐ A PNG produced by
viewer --screenshoton this machine, which you have looked at. - ☐ The deployed URL loads and renders, shown by a
scripts/webshot.shscreenshot. - ☐
docs/VIEWER.mdwritten. The Pages URL is in it and in your report.
Notes
- Already verified on this machine: wgpu renders offscreen through Metal with no display, and headless Chrome has WebGL2 and WebGPU.
- Do not design the look. That is T-015. Plain spheres are right for this ticket.
- Trim Bevy features to keep the wasm small.
Result
Live at alife-kz9.pages.dev (Pages project alife; Cloudflare added -kz9
because alife.pages.dev was taken). Details, commands and measurements: docs/VIEWER.md.
- ☑
viewer --screenshotPNG made on the Mac mini and looked at:docs/media/T-002/native-5000.png. - ☑ The deployed URL loads and renders, shown by
docs/media/T-002/deployed-webgpu.png,deployed-webgl2.pnganddeployed-phone.png(390×844 at 3×, after a touch orbit and a pinch). Deviation: these were taken with the newscripts/webfps.mjs, notscripts/webshot.sh. webshot.sh's virtual-time budget runs out while the 16 MB wasm is still downloading, so it only ever captures the loading screen (webshot-sh-stuck-loading.png). - ☑
docs/VIEWER.mdwritten, with the URL.
Measured: 5,000 spheres run at 561 fps natively at 1600×1000, and at 60 fps (vsync) in headless Chrome with WebGPU and with WebGL2. The wasm served to a phone is 4.0 MB (WebGPU) or 4.8 MB (WebGL2) after brotli. Not tested on a real phone.