Skip to content

Browser app: wasm facade, Web Worker simulation, WebGL2 renderer - #2

Closed
mahim37 wants to merge 1 commit into
core-simfrom
revamp/m2-web
Closed

mahim37 wants to merge 1 commit into
core-simfrom
revamp/m2-web

Conversation

@mahim37

@mahim37 mahim37 commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner

Superseded by #4.

Adds crates/rustywings-wasm and web/, the browser half of the rebuild.

Core: World::set_config swaps parameters on a running world (validated,
brain shape fixed, grids rebuilt on resolution change) so the UI's sliders
apply live. Defaults are untouched; the golden checksum is unchanged.

wasm crate: a thin Sim over World. Config crosses as JSON text, because
serde_wasm_bindgen silently drops unknown keys and a typo in a shared link
must be an error, not a default. Seeds cross as hex strings, ids and ticks
as f64. frame.rs packs render state into one flat f32 buffer (header, eight
floats per bird, two per seed and patch) and is tested natively.

Frontend (no framework): the sim runs on a Web Worker with a fixed-timestep
accumulator (1x/4x/16x/max), samples stats every 25 ticks, and posts frames
into two recycled transferable buffers. WebGL2 draws patches, seeds, vision
wedges, illustrated bird sprites from a Canvas-drawn atlas, and the
selection ring in five instanced calls, with a wrapping camera on the torus.
SVG charts with a linked crosshair, windowed over 5k/25k/100k ticks; KPI
tiles with trends; an inspector showing energy, traits, live retina
activation and the hidden-layer weight heatmap; four plain-language sliders
that write into the real config; snapshot/rewind; click-to-aim meteor;
?seed=&cfg= share links; keyboard shortcuts; help with credits.

Verification: vitest loads the built wasm in Node and asserts the golden
checksum 1065c218b08af910 for seed 1 at tick 2000, the same value the Rust
suite pins and `rustywings verify` prints. CI gains a web job (wasm-pack,
tsc, vitest, vite build) and lints the wasm crate on both targets.

Deploy: vercel.json at the root with install/build scripts that put rustup
and wasm-pack on Vercel's image; output is web/dist. The Vercel project's
root directory must be switched from www/ to the repository root.

Docs: ARCHITECTURE.md gains the worker/frame design and a frontend section;
decision 0006 records why frames are packed buffers rather than
SharedArrayBuffer views and withdraws the zero-copy claim; README rewritten
for the new app; CLAUDE.md gains web commands and boundary conventions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTmV279xygsXfALmMmQeeL
@vercel

vercel Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
rusty-wings Error Error Sep 6, 2026 10:07am UTC

@mahim37 mahim37 closed this Sep 6, 2026
@mahim37
mahim37 deleted the revamp/m2-web branch September 6, 2026 10:23
@mahim37 mahim37 changed the title Milestone 2: wasm facade and Vite/TypeScript frontend Browser app: wasm facade, Web Worker simulation, WebGL2 renderer Sep 6, 2026
@mahim37

mahim37 commented Sep 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #4: the branch was renamed to web-app and the history rewritten into self-contained commits.

This branch had an error being deployed

1 failed deployment
Preview — b04396ed Deployed Sep 6, 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