← Back to projects

Personal game · Browser RPG · In development

Swing or Cast

A browser RPG where each expedition risks permanent death, built with Rust, WebAssembly, and Web Components.

My role: Creator

Use See live activity to explore the public frontier without signing in. Watch live is available when an adventure is active; playing your own adventurer requires an account.

The problem

A game with permanent character death needs consistent combat and progression rules. Browser refreshes and reconnects should restore the current adventure without changing its outcome.

My contributions

  • Separated combat and progression rules into a shared Rust core used by the WebAssembly adapter and server.
  • Connected Rust to JavaScript through wasm-bindgen, exposing game actions and serialized state to the browser.
  • Built a custom-element game interface that displays server-owned adventure state and restores it after reconnecting.

Behind the project

An ongoing personal game exploring combat, progression, and a persistent world. The Rust game core connects to a WebAssembly adapter and an Axum/MongoDB server; the browser interface uses native JavaScript modules and custom elements.

Engineering decisions

Game rules need to stay consistent across the browser and server. The Rust workspace separates the shared core from the server and WebAssembly adapter, with the server responsible for resolving online game state.

Testing

The repository includes Rust core and server tests, plus Node-based tests for the game interface and audio modules. MongoDB integration tests are opt-in and require a test database.

Repository
mnichols08/rust-swing-or-cast
Repository updated