gasm-sdk 0.4.0

Write games for gasm, a portable game runtime on WebAssembly: bindings for the gasm ABI (video, audio, input, WebGPU, network, storage) plus a Game trait
Documentation

gasm-sdk

Rust SDK for writing games for gasm, a portable game runtime on WebAssembly. A game compiles to one .wasm file that runs in the native runner (wasmtime + wgpu), in the browser (WebGPU), and headless in CI, bit-identically.

[lib]
crate-type = ["cdylib"]

[dependencies]
gasm-sdk = "0.1"
use gasm::Buttons;

struct Hello { t: u32 }

impl gasm::Game for Hello {
    fn init() -> Result<Self, String> {
        gasm::set_frame_rate(60.0);
        Ok(Hello { t: 0 })
    }
    fn frame(&mut self) {
        if gasm::pad(0).held(Buttons::A) { gasm::log!("A at frame {}", self.t); }
        self.t += 1;
    }
}

gasm::game!(Hello);
cargo build --release --target wasm32-unknown-unknown
gasm-run target/wasm32-unknown-unknown/release/hello.wasm

What's in it:

  • Core: logging, time, frame rate, launch params, RGBA video, audio, four virtual gamepads, assets.
  • gfx: a WebGPU subset with WGSL shaders and JSON descriptors.
  • net: WebSocket-style messages.
  • storage: per-game saves.
  • Native builds: on non-wasm targets the crate links an in-process stub host (gasm::native), so the same game builds natively for debugging and parity tests.

The crate is gasm-sdk; the library is named gasm, so code says use gasm::…. Guide: Writing games · ABI: spec. The raw bindings (gasm::sys) are generated from spec/abi.json.

MIT licensed.