Design: servers and hosting

Status: agreed direction, for the shared galaxy under Modern rules (roadmap phases 3 and 4). Classic and single-player stay offline in your browser and need no server at all. Costs are estimates to be replaced by load-test measurements before launch.

The idea

The shared galaxy runs on one small, cheap, open-source server that the project controls. It's the single source of truth for everything that matters. Players' own machines do everything that's safe to share. Later, trusted community volunteers can run parts of the galaxy on their own servers, while the central server keeps the books.

  1. The server decides what matters: credits, cargo, ratings, the law and the outcome of fights. A player's machine never decides any of these.
  2. Players' machines do the heavy lifting: drawing the game, flight physics, and generating the galaxy from its seeds.
  3. Cheap enough to fund by donation. Hundreds of players should cost tens of pounds a month, not hundreds.
  4. No peer-to-peer connections between players. Nobody's IP address is shown to strangers.
  5. The server is open source, like the game, so anyone can check how it works or run their own copy for testing.

Related designs: economy and exchanges (the server-held ledger), combat rating (the server decides fights), player-run stations (contributor records, funding and no pay-to-win).


1. What runs where

Runs on What Why
Your browser Drawing the game, sound, flight physics with prediction (so your ship responds instantly), the galaxy and planets generated from seeds, your HUD and the station screens Fast, free and fine to trust: if you change how it looks, nobody else is affected
System servers Live simulation of busy systems: where every ship is, NPC traffic and police, laser hits, missiles, docking clearance Everyone in a system must see the same fight, and nobody can be trusted to referee their own
The central server Accounts, commanders, credits and the ledger, cargo, equipment, ratings, legal records and warrants, shared markets, missions One set of books that can't be edited or forked
Cloudflare R2 (witchspace-clips) Shared clips' videos, beside each clip page (Mark, 29 October 2026): a few MB each, served only while the clip is up Files are what it's for: 10 GB free, no fees to download, and a video never passes through a Durable Object

To begin with, the system servers and the central server are one program on one machine. They're kept separate in the code so they can be split later.

2. How a session works

What the server checks

3. What it costs

Rough estimates (to measure):

Scale Hardware Rough cost
Hundreds signed up, dozens online at once 1 small server (2 CPUs, 4 GB) + a small database About £5–15 a month
300–500 online at once 1 bigger server (4–8 CPUs) About £20–50 a month
Thousands online Several system servers + the central server Hundreds a month, which is a long way off

Why it's cheap:

Hot spots: the expensive case isn't how many players there are, it's how many are in one place, such as Lave on launch day or a big fight. The server can cope by:

A load test with simulated players will measure all this before launch.

How many commanders a system holds (Mark, 28 October 2026)

A load test of a system's server (28 October 2026, on a local copy) found it forwards about 12,000 position updates a second. Each commander flying in a system sends ten a second, and each goes to everyone else there, so about 35 commanders flying at once keep up smoothly and more fall behind. Docked commanders aren't in shared space at all, so this is only about ships in flight. Mark's call, before Show HN: a system holds 32 flying commanders. The next one is told "Shared space in Lave is full · flying solo for now" and the game tries again every 30 seconds. A commander the server hasn't heard from for 15 seconds (a phone that lost its signal) gives up their place. Mark doesn't expect anything like that many in one place; when shared space gets busy, the server can gather everyone's positions into one update per commander ten times a second, about sixty times fewer messages.

4. Community-run system servers (later)

Once the shared galaxy is established, trusted volunteers can host system servers, for example for a region of the galaxy or for players nearer them.

5. Why not run everything on players' computers?

Fully peer-to-peer "nodes" on players' own machines were considered and rejected for the shared galaxy:

  1. Cheating. If a player's machine decides fights or credits, a modified machine can lie: "I destroyed that Deadly pilot", "I have 10 million credits". Cross-checking between nodes helps, but is complex and still breakable.
  2. Reliability. Players come and go. If the machine running Lave shuts its laptop mid-fight, everyone there has to move without losing anything.
  3. Browsers can't easily act as servers. It would mean a separate download, and many home networks block incoming connections.
  4. Privacy and fairness. Players would connect directly to each other, revealing their IP addresses. Whoever hosts also gets a delay advantage in their own fights.

What players' machines do contribute is everything in the first row of the table in section 1. That's most of the work, and it's free.

6. Single-player and Classic

Single-player stays exactly as it is: the whole game runs in your browser and saves there, with no account and no server. Classic is single-player only, so it never needs a server. Single-player Modern commanders stay local too. Whether one can later move into the shared galaxy is an open question.

7. Data and privacy

8. Paying for it

Costs are covered by transparent donations (GitHub Sponsors or Open Collective), with all income and spending public, as set out in the player-stations proposal. Supporters get thanks, never power. The design aims to keep costs low enough that this is realistic.

9. Fair play

The rule: in the shared galaxy, the browser is never trusted with anything that matters. The code is open source, so we assume some players run modified clients, and design so that it gets them nothing.

Single-player: let it be

A single-player commander lives in your own browser, and you can edit it if you want; it's your game and nobody else is affected. Classic stays fully offline. Fighting this would only get in honest players' way.

The server keeps the books

The server referees flying and fighting

Markets nobody can see ahead

Markets and world events come from each system's seed and the clock, and the code is public, so anyone could run it forward and know next week's famine or prices. Harmless in single-player; an exploit in a shared economy. So in the shared galaxy the server mixes a secret seed into future events and NPC trading. To stay provably fair, it publishes a fingerprint (a hash) of each period's secret in advance and reveals the secret afterwards, so anyone can check that nothing was rigged.

Bots and multiple accounts

People

A report button, and server logs to check reports against. Moderation by people, with clear rules, not automatic bans.

10. Building it in stages

Stage Server work
Shared space (roadmap 3) One system server: see and fly with other commanders, server-checked movement and shots. No accounts yet, nothing saved
Persistence (roadmap 4) The central server: accounts, commanders, the ledger, shared markets, ratings and the law. Load test before opening up
Growth Split system servers from the central server; more regions if players are spread worldwide
Community hosting Volunteer system servers, as in section 4

Stage 1, as built

Open questions

Think something here should change? Say so on the ideas board, where others can vote it up, or email hello@witchspace.org.uk. If you code: this page is docs/design/servers-and-hosting.md on GitHub, open to pull requests.