OverviewThis WebsiteHome LabTrading BotEcosimProcedural Generation
Projects

Ecosim

A planet-scale ecosystem simulator. The goal: model populations of plants, animals, and microorganisms from global climate patterns down to individual organism behaviour — and let players intervene at any level.


Concept

What It Is

Ecosim is the umbrella application that ties together a set of purpose-built libraries — procedural planet generation, orbital camera, GPU shaders, and input binding — into a single runnable game. The simulation is designed around several gameplay modes:

  1. Plague Inc-style — control an invasive species and spread it across the globe
  2. From Scratch — seed a barren planet and guide an ecosystem to stability
  3. Competitive — race another player to accumulate the most biomass

Architecture

Bevy ECS

The application is built on Bevy 0.18, a data-driven game engine based on an Entity Component System. Game state is managed through a type-safe state machine: a top-level AppState (Startup → MainMenu → InGame → Shutdown) with a nested GameState (Playing ↔ Paused). Invalid transitions are unrepresentable by design — you cannot call pause() unless the game is already in the Playing sub-state.


Design Principle

Determinism First

Every subsystem is designed to be a pure function of its inputs, with all randomness fed through seeded RNGs. This makes multiplayer possible without a dedicated authoritative server — both clients run the same simulation, and a single binary serves as either a peer or a headless dedicated server depending on startup flags.

A DETERMINISM_ANALYSIS.md file lives at the root of the simulation crate, tracking every known source of nondeterminism (Bevy query order, floating-point variance, HashMap iteration) and the mitigation applied to each.


Build

Targets & Profiles

The dev profile uses the Cranelift codegen backend for near-instant recompilation, with dependencies compiled by LLVM so hot-reload stays fast without sacrificing dependency performance. The release profile enables full LTO and codegen-unit merging for maximum runtime speed. A dedicated WASM release profile strips debug info and optimises for binary size, targeting deployment in the browser via wasm-bindgen.


Status

Foundation Complete

The underlying libraries — procedural planet generation, camera, input binding, and GPU shaders — are all functional. The game application has a working state machine, plugin architecture, and build pipeline. The next phase is writing the gameplay systems that connect them, building on a solid, tested foundation rather than prototyping and rewriting later.