mugon.net docs
SDKs

Trunk (coming soon)

Rust wasm games built with Trunk or wasm-bindgen. Coming soon.

Coming soon: Trunk support is not available yet. This page keeps the intended integration for reference.

Warning: Trunk's generated page starts your wasm on its own, before Mugon.start has published the context, so it is not supported yet.

Use wasm-bindgen directly, exactly as the Bevy template does:

  1. Build with cargo build --target wasm32-unknown-unknown and run wasm-bindgen --target web --out-dir pkg --out-name game <your.wasm>.
  2. Bundle a small entry with Vite, as the template does: import Mugon from @mugon/sdk first, then import init from pkg/game.js and call it from inside Mugon.start. Without a bundler, write your own index.html that loads mugon.iife.js first instead.
  3. Read the context from Rust (window.mugon), for example with the mugon-sdk-bevy bridge or your own wasm-bindgen externs.

The wasm-bindgen loader fetches the .wasm with fetch and instantiates it with WebAssembly.instantiateStreaming, which works through the file proxy.