Robert Garrett 738032ead9 Tiny index.html for a webserver to host the WASM
The webserver needs to serve an HTML document, which needs to load the
loader JS (from WASM bindgen), which loads the WASM file. This page is
about as small as it can be while still functioning. I'm not interested
in doing web page stuff right now, so this will have to do.
2025-09-08 15:04:55 -05:00
2025-09-07 16:50:19 -05:00
2025-09-07 16:50:19 -05:00

Chaos Game

The Chaos Game (wikipedia) is a fractal generator. This program works by iteratively walking half way between the current location (initially the center of the sprite but could be random) and a randomly selected vertex. Each time a step is made, a pixel is filled in at the destination. The color is based on the vertex's color.

Right now, this program uses a hard-coded triangle and so generates a Sierpinsky triangle. Other shapes can be used -- see the Chaos Game Wikipedia link for examples. I have not provided a UI for altering these shapes at run time.

Building

For desktop

Run cargo run --release, just like any other binary crate.

Use cargo run --features=dynamic_linking for faster cycle times when modifying the code. This feature is a pass-through to Bevy's dynamic linking feature.

For WASM

Run cargo run --release --target=wasm32-unknown-unknown. This will start a dummy webserver, wasm-server-runner, which in turn hosts a dummy webpage that loads the WASM file. Run the program by visiting the dummy site in your browser: [http://localhost:1334]

This requires the wasm-server-runner crate to be installed: cargo install wasm-server-runner.

TODO: A "real deployment" section.

Description
Rust implementation of the Chaos Game
Readme MIT 72 KiB
Languages
Rust 78.9%
Dockerfile 17.6%
HTML 3.5%