gasm-host
Native host for gasm games. A game is one .wasm
file, and this crate runs it: wasmtime for the module, wgpu (Metal, Vulkan,
D3D12) for gasm:gfx, cpal audio, gilrs gamepads, WebSocket networking
(ws:///wss://, rustls) and per-game storage.
Assets are never preloaded: files (--asset) and whole folders
(--asset-dir, e.g. a mounted CD) are read on demand into guest memory, with
case-insensitive names. Keyboard layouts are configurable
(--keymap, --print-keymap); the default gives two players one keyboard.
It ships the gasm-run binary:
A guest call (init, a frame) that runs longer than --call-timeout (default
30 s, 0 = never) traps. The room relay for online play, gasm-relay, is a
separate crate in relay/
(release bundles and ghcr.io/emdzej/gasm-relay; not on crates.io).
And a library, for embedding games in your own app or building a runner for
another platform. It contains complete runners, headless::run (reproducible
runs with hashes) and window::run (winit window, cpal audio, gilrs gamepads,
keyboard layouts), and the parts they're made of:
use HashMap;
use ;
LoadOptions sets allow_precompiled and call_timeout; audio output is the
audio::AudioOut trait. The windowed runner is the default feature window;
default-features = false gives a headless-only library without winit, cpal
and gilrs.
Guests are sandboxed: they see only their own memory and the ABI. Every pointer and handle is checked. There's no filesystem (the runner implements its own WASI subset: no preopened directories, env or args), network is opt-in, and the storage namespace is chosen by the host.
- ABI: spec (machine-readable:
spec/abi.json) - Guide: Writing runners
- Writing games: the
gasm-sdkcrate
On Linux, building needs libasound2-dev libudev-dev pkg-config. MIT licensed.