simuspace
Three.js
Beta
A multiplayer programming game where players write code — not controllers. Instead of clicking buttons, you program the logic that drives your units across a 2D grid world.
Inspired by Screeps, but built around WebAssembly: any language that compiles to Wasm can participate. A browser-integrated AssemblyScript compiler lets you start immediately, no local toolchain required.
wasm32-unknown-unknown..wasm binary and
uploads it to the server.┌─────────────────────────────────────────┐
│ Browser │
│ ┌─────────────┐ ┌───────────────┐ │
│ │ Monaco │──▶│ AssemblyScript│ │
│ │ Editor │ │ Compiler │ │
│ └─────────────┘ └──────┬────────┘ │
│ │ .wasm │
│ ┌─────────────────────── │──────────┐ │
│ │ Game Canvas │ │ │
│ │ (2D render) ◀─ WS │ │ │
│ └────────────────────────│──────────┘ │
└───────────────────────────│────────────┘
│ HTTP upload
┌───────────────────────────▼────────────┐
│ Server (Rust) │
│ ┌──────────┐ ┌──────────┐ │
│ │ Wasm │ │Tick Loop │ │
│ │ Validator│ │(Rayon │ │
│ │ + Cache │ │ parallel)│ │
│ └──────────┘ └────┬─────┘ │
│ │ WS broadcast │
└─────────────────────│──────────────────┘
▼ all clients
| Tool | Version | Install |
|---|---|---|
| Rust + Cargo | stable | rustup.rs |
| Node.js | ≥ 20 | nodejs.org |
cargo run -p server
# Listens on http://0.0.0.0:3000 by default.
# Override with PORT=<n>, e.g.: PORT=3002 cargo run -p server
cd client
npm install
npm run dev
# Open http://localhost:5173
# Proxies /api and /ws to localhost:3002 (adjust in vite.config.ts if needed)
Your Wasm module must export two functions:
// AssemblyScript — using the provided SDK
import { World, Actions, Direction } from "../assembly/index";
export { alloc } from "../assembly/index";
/**
* Called once per game tick.
*
* @param worldPtr Pointer to the WorldView binary blob written by the host.
* @param worldLen Byte length of the WorldView blob.
* @param memPtr Pointer to your persistent memory from the last tick.
* @param memLen Byte length of that memory (0 on the first tick).
* @returns Pointer to a length-prefixed TickResponse, or 0 for no actions.
*/
export function tick(
worldPtr: usize, worldLen: u32,
memPtr: usize, memLen: u32,
): usize {
const world = World.parse(worldPtr, worldLen);
const actions = new Actions();
for (let i = 0; i < world.myUnits.length; i++) {
actions.move(world.myUnits[i].id, Direction.East);
}
return actions.serialize(null); // null = no persistent memory this tick
}
Full API reference: docs/wasm-interface.md
coding-game/
├── crates/
│ ├── server/
Collapsing Worlds: real-time multiplayer battle royale in a collapsing star system (Godot 4)