Back to Experiments
EXP.04 Svelte Coming Soon

Keep The Ship Running

Multiplayer crisis management sim — keep systems online as failures cascade.

Interactive

Live Demo

Demo Coming Soon

The live demo for this experiment is not yet available.

Context

The Problem

Crisis management is a skill you can't practice safely in real life. When the engine room floods or the data center loses cooling, you need to make decisions fast with incomplete information. Bad decisions cascade.

I wanted to build a game that captures that pressure — systems failing, priorities competing, decisions that matter.

Background

The Connection

This experiment draws directly from my experience:

  • Engine room emergencies — Fire, flooding, loss of propulsion. Each requires immediate action and coordination.
  • Data center outages — Cascading failures when one system takes down others. The UPS fails, generators kick in, you have seconds.
  • Shipboard damage control — The Navy taught me systematic response to emergencies. Isolate, contain, repair.

Architecture

The Approach

Svelte was chosen for its simplicity and performance. The game state updates frequently, and Svelte's compile-time reactivity keeps things smooth.

The game features: - Real-time system simulation (power, cooling, network, life support) - Interconnected failures (losing power cascades to everything) - AI crew members that follow orders but make mistakes under pressure - Multiplayer drop-in where other players can take crew roles

Code

Technical Deep Dive

The simulation runs on Cloudflare Durable Objects. Each game room is a Durable Object that maintains state, processes player actions, and broadcasts updates via WebSocket.

The tick-based simulation runs server-side at 10Hz. Clients receive state updates and render interpolated animations. This keeps the authoritative state on the server while maintaining smooth visuals.

typescript
// Durable Object game loop
export class GameRoom {
  state: DurableObjectState;
  sessions: WebSocket[] = [];

  async alarm() {
    // Run simulation tick
    this.gameState = simulateTick(this.gameState);

    // Broadcast to all players
    const update = serializeState(this.gameState);
    this.sessions.forEach(ws => ws.send(update));

    // Schedule next tick (100ms = 10Hz)
    this.state.storage.setAlarm(Date.now() + 100);
  }
}

Durable Object game loop with 10Hz tick rate

Retrospective

What I Learned

What worked well:

  • Durable Objects are perfect for game rooms — persistent, WebSocket-capable, globally distributed
  • Svelte's stores made complex UI state manageable
  • The pressure of time limits creates genuine tension
  • What I'd change:

  • Would add voice chat for multiplayer coordination
  • Mobile touch controls need work
  • Trade-offs accepted:

  • 10Hz tick rate is a compromise — fast enough for strategy, not enough for twitch gameplay
  • AI crew behavior is scripted, not ML-based
  • Technologies

    The Stack

    Svelte UI framework
    Durable Objects Game state
    WebSockets Real-time sync
    TypeScript Type safety