opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

ECS Galaxy Sample: large-scale spaceship simulation with tweakable realtime sett...
GitHub RepoImpressions4

Project Description

View on GitHub

Simulating Thousands of Spaceships in Unity: A Look at the ECS Galaxy Sample

You've probably hit the wall that every Unity developer eventually runs into: you want to simulate a massive, living world—hundreds of entities, complex behaviors, real-time interactions—but the moment you scale past a few hundred GameObjects, your frame rate starts to cry. The standard workflow just doesn't cut it when you're thinking big. That's exactly where Unity's ECS Galaxy Sample comes in, a project that shows you what's possible when you build with Unity's Entity Component System (ECS) and Data-Oriented Technology Stack (DOTS) at the core.

This isn't a toy demo or a tech art piece. It's a full-scale simulation of spaceship fleets fighting over planets, with worker ships capturing territory, traders moving resources, and buildings producing upgraded units—all running in real time, with settings you can tweak while it's live. If you've been curious about ECS but haven't seen a compelling, large-scale example, this is the one to study.

What It Does

The ECS Galaxy Sample is a Unity project that demonstrates a large-scale simulation of teams of spaceships battling for control of planets. The core loop is a classic real-time strategy setup: fighter ships defend and attack planets, worker ships capture planets and construct buildings on moons, and trader ships distribute resources across the system. Buildings consume a planet's resources to build ships, provide defensive capabilities, or upgrade the ships they produce.

The tech stack is the headline here. This is built on Unity ECS, which means the simulation is data-oriented and job-based rather than relying on traditional GameObjects and MonoBehaviours. The project targets Unity 6000.3.6 (you can check ProjectVersion.txt for the minimum supported version), so it's current with Unity's modern data-oriented stack.

What makes it more than a static demo is the configuration layer. A lot of simulation parameters—teams count, planet count, game area size, simulation speed, ship properties, and more—can be configured in an in-game Settings menu. And here's the kicker: some of those parameters can be tweaked in real time while the simulation is running, so you can watch your changes take effect instantly.

Why It's Cool

There's a lot to appreciate here, but let me break down what genuinely stands out.

  • It's a real, complex simulation, not a benchmark. Plenty of ECS examples show you how to spawn a million spinning cubes. This one gives you an actual game-like system with multiple agent types, resource management, and emergent behavior. That's a much more honest test of what ECS can handle.

  • Realtime tweaking is a killer feature. Being able to adjust simulation speed or ship properties while the sim is live isn't just a neat trick—it's a debugging and tuning superpower. You can see how changes ripple through the system without stopping and restarting, which is invaluable when you're trying to understand how ECS systems interact.

  • The documentation structure is thoughtful. Beyond the README, there are dedicated docs for a game overview, code overview, debug views, and determinism. That last one is important—determinism in ECS is a tricky subject, and having a dedicated document on it shows the project is serious about production concerns, not just visuals.

  • It's a learning resource disguised as a demo. If you're trying to wrap your head around ECS architecture, reading through a project like this—with its multiple systems, entity types, and data flows—is far more instructive than any tutorial. You can see how the pieces fit together in a real, non-trivial codebase.

  • The debug views are mentioned as a separate doc, which suggests the project ships with tooling to inspect what's happening under the hood. That's the kind of thing that separates a demo from a teaching tool.

How to Try It

Getting this running is straightforward, though you'll need a compatible Unity version. The project currently targets Unity 6000.3.6, so make sure your editor is up to date.

  1. Clone the repository: git clone https://github.com/Unity-Technologies/ECSGalaxySample
  2. Open the project in Unity 6000.3.6 or later.
  3. Open the Main scene.
  4. Press Play. A UI menu will appear where you can configure simulation settings.
  5. When you're ready, hit the "Simulate" button and watch the fleets go.

Once it's running, you've got a full set of controls:

  • WASD + Mouse — control the camera (only when the menu is hidden)
  • Escape — toggle the in-game menu
  • Z — cycle through three camera modes: free camera, orbit planet, orbit ship
  • X — switch the camera target in orbit modes
  • Mouse Wheel — zoom in/out for orbit cameras
  • Left Shift — boost free camera speed

If you want to dig deeper, the repo includes documentation on the game overview, code structure, debug views, and determinism—all linked from the README. That's where you'll get the real payoff if you're studying how it's built.

Final Thoughts

This sample is best for Unity developers who are past the "what is ECS?" stage and want to see a serious implementation. It's not a beginner tutorial, and it's not trying to be—it's a reference project that shows you how a complex, multi-agent simulation fits together in Unity's data-oriented world. If you're building anything that needs to scale—large simulations, city builders, massive RTS battles—studying this codebase will save you a lot of trial and error. It's honest about its scope, well-documented, and gives you real-time tools to poke at the simulation and learn by doing. Go clone it and see what your machine can handle.

Follow @githubprojects for more developer tools and open source projects.

Back to Projects
Project ID: 8fb7f770-f38d-47e4-9186-f1d72282eeb0Last updated: August 12, 2026 at 02:44 AM