3 min read

Rust sim models a self-running space economy

Kalcode’s open-source Rust and Bevy project simulates hundreds of ships, stations, markets, and factions in one native binary.

Image: Hacker News

The Space Project is an open-source space-economy simulator built in Rust with Bevy 0.18, and it is designed to run largely on its own. Created by Kalcode (David Clausen) and released under the MIT license, the project simulates a living economy with hundreds of autonomous ships that trade, mine, haul cargo, accept contracts, run out of fuel, and sometimes go bankrupt.

There is no scripted story and no explicit player objective. Instead, the user acts as an observer — or an admin with god-mode controls — while ships, facilities, factions, and populations react to market conditions and one another. Clausen says prices are not fixed anywhere; stations use an order-book market and a coverage model with shortage-urgency multipliers to price 13 commodities.

At the simulation level, each ship is an autonomous agent with its own credits, crew, fuel, cargo hold, and a GOAP planner that can choose between trading, refueling, resting, retrofitting, or taking contracts. Facilities can run production chains, degrade, self-repair, level up from 1–10, and be abandoned if they stay broke. Populations consume food and fuel, produce labor, and migrate when sentiment collapses, while factions collect taxes, post subsidies, and fund new construction where shortages persist.

Right now, Clausen says the sim runs at about ~485 live agents: 282 ships, 93 facilities, 27 populations, 8 factions, and 60 celestial bodies. Tick times sit at p50 ≈ 10–20 ms within a 125 ms budget, and the architecture is intended to scale toward 100k+ entities.

The codebase started as an Elixir/Phoenix prototype, but Clausen rewrote it in Rust after the BEAM scheduler struggled on Windows gaming PCs. The resulting architecture centers on sim_core, a pure, synchronous, IO-free Rust engine. The client_bevy front end embeds that simulation directly, letting the renderer and simulation share the same ECS world with zero marshalling.

Recommended reading

Meta adds Xbox Game Pass to Horizon+

The project is split into five crates:

  • sim_core for simulation logic, GOAP, economy, and contracts
  • sim_db for SQLite persistence via sqlx
  • sim_server for HTTP and WebSocket handlers in headless mode
  • sim_protocol for WebSocket wire types
  • client_bevy as the main binary with Bevy 0.18 and egui

Clausen describes the release as more of a strong foundation than a finished game. He writes that he is not pushing it toward something “shippable,” but published it because the underlying systems are solid and could be reused, extended, or turned into something bigger by others. The license makes that explicit: “Do whatever you like with it.”

The project supports macOS, Windows, and Linux, stores saves in SQLite, resumes from the exact tick it left off, and includes a headless mode for CI and scripted use. Before submitting changes, contributors are asked to run make verify, which checks builds, ~250 tests, and clippy under strict settings.

The current release is marked experimental, but even now it packs a surprisingly ambitious claim into a single native binary with no runtime dependencies.

Maya Lindqvist

Culture Editor

Maya explores gaming, streaming, and the internet as a place where people actually live. From deep-dives into creator economies to the anthropology of digital communities, she tracks platform drama and cultural shifts so you don't have to. She believes the best tech stories are fundamentally about human behavior.

via Hacker News

// Keep reading