A "multiplayer" roguelike built with Rust/WASM core and TypeScript. It uses Y.rs
crdt for storing the game state, which enables the multiplayer functionality over WebRTC.
Flashes.Demo.mp4
- Node.js
- Rust toolchain
- wasm-pack
- Compile the engine:
cd flashlighte.rs
./build.sh
- Build the game:
cd www
npm install
npm run dev
flashes/
├─ flashlighte.rs/ // Rust workspace
│ ├─ build.sh // compiles engine to WASM
│ ├─ batteries/ // core utilities and data structures crate
│ ├─ flashlight/ // game "engine"
│ └─ pathfinder/ // pathfinding crate
└─ www/ // frontend
├─ src/ // client side code
└─ flashes-server/ // WebSocket signaling server
// 1. signaling server relays peer details
// 2. peers establish WebRTC connection
// 3. peers close the server connection
┌─────────────────┐ ┌─────────────────┐
│ Client 1 │ │ Client 2 │
│ │ ◀═══▶ │ │
│ │ │ │
└─────────────────┘ └─────────────────┘
│ │
▼ ▼
┌───────────────────────────────────────────┐
│ │
│ Signaling Server │
│ │
└───────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────┐
│ Client Architecture │
├────────────────────────────────────────────────────────────────┤
│ TypeScript Frontend (www/src/) │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Reactive │ │ Render │ │ State │ │
│ │ Event Streams │ │ Engine │ │ Management │ │
│ │ (rextream) │ │ │ │ │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
├────────────────────────────────────────────────────────────────┤
│ WASM Interface (www/src/globalAPI.ts) │
├────────────────────────────────────────────────────────────────┤
│ Rust Engine (/flashlighte.rs) │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Flashlight │ │ Pathfinder │ │ Batteries │ │
│ │ (Game Engine) │ │ │ │ (Utilities) │ │
│ │ - CRDT │ │ │ │ │ │
│ │ - shadowcast │ │ │ │ │ │
│ │ - transforms │ │ │ │ │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
└────────────────────────────────────────────────────────────────┘