# UniverseGenerator 1.0: one seed, the same galaxy everywhere

> A galaxy generator pulled out of SpaceDeckBuilder2 and released for .NET and Unity

Published 2026-10-04 (America/New_York). Tags: C#, Unity, NuGet, procedural generation, game development. Canonical: https://www.markdavidrogers.com/universe-generator-1-0/. AI: generated.

![A generated barred spiral galaxy of 300 star systems joined by lanes, from the seed my-seed](https://raw.githubusercontent.com/m4bwav/UniverseGenerator/6e87ad4586ce6e32986bb3619d2cc25e3e8656db/docs/images/openupm-cover.png)

[UniverseGenerator](https://github.com/m4bwav/UniverseGenerator) 1.0.0 is out on [NuGet](https://www.nuget.org/packages/UniverseGenerator) and OpenUPM. Give it a seed and it builds a universe, galaxy clusters, galaxies, star systems, planets and moons as plain C# records. The same seed gives the same output on Windows, Linux and macOS, on .NET 10 and .NET Framework 4.8, and in Unity under both Mono and IL2CPP.

```csharp
using UniverseGeneration;

var galaxy = Galaxy.Generate("my-seed");
foreach (var system in galaxy.Systems)
    Console.WriteLine($"{system.Name}: {system.Star.Class} star, {system.Planets.Count} planets, danger {system.Danger}");
```

```text
HD 147927: K star, 6 planets, danger 9
HD 165595: M star, 1 planets, danger 6
HD 28101: K star, 6 planets, danger 6
...
```

## Where it came from

My game SpaceDeckBuilder2 has a galaxy generator of about 1,400 lines. On October 2 I asked how many other projects generate game worlds like it, and whether it should be a library. The answer became an extraction plan, and the library shipped two days later.

The first step was reading the game's generator in full and recording what it produced, in Unity and in .NET, before changing anything. That survey turned up surprises. The game never regenerates a galaxy from a seed, so a new generator couldn't break any save. Every planet archetype had moons, atmosphere and life switched off, so none of those ever appeared. Unity's Mono runtime does float maths in double precision, and `System.Random` gives a seed and its negative the same sequence. Those last two findings are why the library has its own random number generator and keeps its decisions in integers.

## What it makes

| Level | In 1.0 |
|---|---|
| Universe | 4 to 7 groups and clusters joined by filaments, named voids, a merging pair of galaxies with a lawless frontier and a story hook |
| Galaxy cluster | a small group or a rich cluster, with Hubble types, ages and active cores |
| Galaxy | eight shapes, hyperlanes that always connect, chokepoints, named regions, danger from 1 to 10, factions, points of interest and hazards |
| Star system | real spectral classes with matching mass, luminosity, radius and temperature; habitable zone and frost line; catalogue names such as HD, HIP and Kepler |
| Planet | orbits from exoplanet statistics, 13 kinds, gravity, temperature, air, water, climate bands, biomes and life from none to sentient |
| Moons, rings, belts | moons with their own physics, tidal heat and hidden oceans; rings; belts with composition and resources |

Presets cover the common cases: `Pocket` makes 20 systems for a short game, `Roguelike` 30 with more danger and chokepoints, `Cozy` 40 safer systems, and `Epic` 300. Systems are generated when you first open them, so a 2,000-system map costs little until you look at it.

## Addresses instead of save data

Every object has an address such as `v1-my-seed/galaxy/system/31/planet/1`, and `Universe.At` regenerates that one object on its own, with the same result as building the whole galaxy and walking down to it. A save file can hold the address instead of the planet. A server and its clients can share a world by its seed and never send the world itself.

The `v1` in the address is the generator version. Golden files in the repository's tests pin the output of version 1, and any change that would alter a seed's output adds a new version and keeps the old one.

## Proving it in Unity

Promising the same output everywhere is easy to write and hard to keep. Before release, 1.0.0 was built from its git tag in Unity 6000.6.4f1 and 6000.5.8f1 with no warnings. The repository's 266 tests passed in Unity Mono on both editors, and all 18 golden checks passed in an IL2CPP WebGL build running in Chrome. The package adds 116 KB to a WebGL build. Two checks are still open: a Windows IL2CPP player and an ARM64 device.

The NuGet package holds only the engine-free core, so it runs on servers and in tools as well. The Unity package adds a small assembly for vectors, lane endpoints and orbit positions, plus a sample that prints a seed's galaxy to the console.

## Install

```text
dotnet add package UniverseGenerator
```

In Unity 6, add `com.m4bwav.universe-generator` from OpenUPM, or use "Install package from git URL" with `https://github.com/m4bwav/UniverseGenerator.git?path=Packages/com.m4bwav.universe-generator#v1.0.0`.

It's MIT licensed. Travel routes, generated descriptions, trade and map rendering are planned for later 1.x releases, without changing what any seed already makes.

---

*Claude wrote this post with the [everwrite](https://github.com/m4bwav/everwrite) plugin, running Opus 5.5 at medium effort.*
