airlock.chat icon indicating copy to clipboard operation
airlock.chat copied to clipboard

An exercise in learning wasm and rust and game development by cloning the game among us

Tests

Getting started

  1. install the rust toolchain
  2. install npm
  3. install wasm-pack
  4. install some more deps apt-get install gcc libssl-dev pkg-config lld
  5. clone this repo
  6. cd rust-us
  7. ./start.sh
  8. Once you see ℹ 「wdm」: Compiled successfully., open your browser to http://localhost:8080/

This will also automatically watch the rust code in ./src/ and incrementally rebuild on changes. If you're lucky, your web browser will also automatically reload after a successful build.

Improve Build Performance

This guide has a few pointers. I got ~20% faster compiles by following it: https://bevyengine.org/learn/book/getting-started/setup/#enable-fast-compiles-optional

Based off of wasm-pack-template

A template for kick starting a Rust and WebAssembly project using wasm-pack.

Tutorial – wasm-pack-template discord

About

📚 Read this template tutorial! 📚

This template is designed for compiling Rust libraries into WebAssembly and publishing the resulting package to NPM.

Be sure to check out other wasm-pack tutorials online for other templates and usages of wasm-pack.

🛠️ Build with wasm-pack build

wasm-pack build

🔬 Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --firefox

🎁 Publish to NPM with wasm-pack publish

wasm-pack publish

🔋 Batteries Included