airlock.chat
airlock.chat copied to clipboard
An exercise in learning wasm and rust and game development by cloning the game among us
Getting started
- install the rust toolchain
- install npm
- install wasm-pack
- install some more deps
apt-get install gcc libssl-dev pkg-config lld
- clone this repo
- cd rust-us
- ./start.sh
- 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
-
wasm-bindgen
for communicating between WebAssembly and JavaScript. -
console_error_panic_hook
for logging panic messages to the developer console. -
wee_alloc
, an allocator optimized for small code size.