JDSoft Games
DE / EN

coding-game

Alpha
Frühe spielbare Fassung — aktiv in Entwicklung, Änderungen wahrscheinlich.
coding-game
Rust / TypeScript

Über dieses Spiel

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.


How it works

  1. Write code in the browser (Monaco editor) using AssemblyScript, or compile locally with Rust, C, Zig, Go — anything that targets wasm32-unknown-unknown.
  2. Deploy — the browser compiles your code to a .wasm binary and uploads it to the server.
  3. Run — every game tick (20 ms / 50 ticks per second), the server executes your module in a sandboxed Wasmtime instance with a fixed fuel budget. Your code receives the world state, returns a list of move actions, and the server applies them.
  4. Watch — a 2D canvas shows the world updating in real time. Your own units are drawn as diamonds; enemy units as circles. A legend in the top-right corner shows each player's colour and unit count. The header bar displays the fuel your bot consumed on the last tick.
┌─────────────────────────────────────────┐
│  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

Quick start

Prerequisites

Tool Version Install
Rust + Cargo stable rustup.rs
Node.js ≥ 20 nodejs.org

Run the server

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

Run the client dev 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)

Player API

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


Repository layout

coding-game/
├── crates/
│   ├── server/      

Ähnliche Spiele

mμX
Alpha
Web

mμX (muX) – 2,5D-Weltraum-Handelssandbox im Geist von X3/X4, Godot 4, Browser (Desktop und Smartphone), persistenter Mehrspieler.

26. Nov. 2026