/wasm-game-of-life

The "Hello world!" of rust-wasm

Primary LanguageRustApache License 2.0Apache-2.0

wasm-game-of-life

My implementation of Conway's Game of Life in Rust + WASM, following the rust wasm book.

Built with 🦀🕸

About

Conway's Game of Life is essentially the "Hello world!" of Rust + WASM

TODO:

  • Double buffered cells vec to reduce render time
  • Speed slider to adjust max framerate
  • Remove modulo operators from tick() to reduce render time
  • Use webGL instead of canvas
  • Rust-only fork (use a no js framework)
  • Improve UI

🚴 Usage

🛠️ Build with wasm-pack build

You'll need to install wasm-pack

curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

or if you're on macOS (the way I did it)

brew install wasm-pack

Then make sure you're in the root directory and run:

wasm-pack build

🏃‍ Run with npm run start

Make sure npm is installed. cd to the www directory.

Ensure all modules are installed:

npm install

Then execute this command:

npm run start

Open http://localhost:8080 in your browser.