Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
World::set_config validates the new config, refuses a change of brain shape (it fixes the genome length), rebuilds the spatial hashes when the grid resolution changes and otherwise takes effect from the next tick. This is what live sliders in a UI call. A rejected config leaves the world untouched.
A thin Sim over World. Config crosses as JSON text: serde_wasm_bindgen silently drops unknown keys, whereas serde_json honours deny_unknown_fields, so a typo in a shared link is an error that names the field rather than a silent default. Seeds cross as hex strings, ids and ticks as f64. Stats, inspections and config come back as plain objects. frame.rs packs render state into one flat f32 buffer (a four-float header, eight floats per bird, two per seed and per patch centre) so a worker can hand a frame to the page in one transfer. It is tested natively.
No framework. Strict TypeScript, vitest, and a Vite config that builds the simulation worker as an ES module so the wasm-bindgen glue can locate its binary, and injects the wasm size and build SHA for the status bar. wasm-pack output lands in src/wasm and is not committed.
The worker owns the wasm Sim. A fixed-timestep accumulator runs it at 1x, 4x or 16x real time, or flat out within a 12 ms budget per turn; stats are sampled every 25 ticks regardless of speed; frames are posted into one of two recycled transferable buffers, so nothing is allocated in steady state and a slow machine slows the world instead of freezing the page. protocol.ts is the message contract and mirrors the frame layout from frame.rs. The vitest suite loads the built wasm in Node and asserts the golden checksum for seed 1 at tick 2000, the value pinned in the Rust tests.
Five instanced draw calls per frame: seed patches, seeds, vision wedges, birds and the selection ring, all reading from the packed frame buffer. Birds are drawn once with Canvas 2D into a four-frame atlas per species; the shader picks a wing position from time and a per-bird phase. The camera is a centre and a zoom on the unit torus, with positions wrapped in the vertex shader so panning across an edge is seamless.
SVG line charts with a linked crosshair, end labels, an area fill and a table view; a history of sampled stats served as windowed, bucket-averaged series over the last 5k, 25k or 100k ticks; the "Meet a bird" panel with portrait, energy, body traits against their bounds, live retina activation and the hidden-layer weight heatmap; four plain-language sliders that write into the real config.
Layout: transport and speed in the header, the world on the left, KPI tiles, population and field-of-view charts, the inspector and settings on the right, a status bar with ups, fps and the world checksum. Drag to pan, wheel to zoom, click to select, click-to-aim meteor, snapshot and rewind, scatter seeds, keyboard shortcuts, help. State that matters lives in the URL: ?seed=<hex> plus a base64url JSON diff of any settings that differ from the defaults, so the same link replays the same world. A link whose settings are rejected falls back to the defaults and says which field was wrong.
The web job installs wasm-pack, builds the wasm, type-checks, runs vitest (which loads the built wasm and checks the golden checksum) and builds the site. The wasm-bindgen facade only compiles for wasm32, so clippy runs on that target too.
Vercel's image has Node but no Rust. The install script puts rustup (with the channel and wasm32 target from rust-toolchain.toml), wasm-pack and pnpm in place; the build script runs wasm-pack, tsc and vite. Output is web/dist. Nothing compiled is committed.
Rewrite the README for the app that is now deployed and give the web package a README of its own.
This was referenced Sep 6, 2026
Merged
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on the core PR (
core-sim). Merge that first; GitHub retargets this PR tomain.What is in
crates/rustywings-wasm: a thinSimoverWorld. Config crosses as JSON text (serde_wasm_bindgen silently drops unknown keys; serde_json honoursdeny_unknown_fields, so a typo in a shared link is an error that names the field). Seeds as hex strings, ids and ticks asf64.frame.rspacks render state into one flatf32buffer and is tested natively.web/: Vite + TypeScript, no framework.World::set_config; Reset; Copy config forrustywings run --config.?seed=<hex>[&cfg=<base64url diff>]share links. A link whose settings are rejected falls back to the defaults with a toast naming the bad field.World::set_config(validated, brain shape fixed, grids rebuilt). Defaults and the golden checksum are unchanged.webjob (wasm-pack, tsc, vitest, vite build); the wasm crate is linted natively and on wasm32.vercel.jsonwithweb/scripts/vercel-install.shandvercel-build.sh, which install rustup and wasm-pack on Vercel's image and build from source. Nothing compiled is committed. The scripts were run end to end in a Linux Node container.Verified
cargo fmt --check,cargo clippy -D warnings(native and wasm32),cargo test --workspace.pnpm check,pnpm test(24 tests),pnpm build. The vitest suite loads the built wasm in Node and asserts the golden checksum1065c218b08af910for seed 1 at tick 2000, the value the Rust tests pin andrustywings verifyprints.Action needed at merge time
In the Vercel project settings, change Root Directory from
wwwto the repository root. Until then Vercel keeps building the legacy app fromwww/and ignores the newvercel.json, which is why the Vercel check on this PR fails. The first build takes a few minutes longer while rustup and wasm-pack install.Later
Snapshot file import/export and replay, family tree, trails, performance work (sensing every other tick, SIMD), a
sweepsubcommand, README GIFs, removal oflibs/andwww/.