Repository navigation
Getting Started
dotnet add package UniverseGenerator --version 1.0.0Or in a project file:
<PackageReference Include="UniverseGenerator" Version="1.0.0" />The package has two builds, lib/net10.0 and lib/netstandard2.0, and no dependencies. A .NET 10 project loads the net10.0 build; .NET Framework 4.8 loads the netstandard2.0 build. Both were run for this wiki (the .NET Framework run reported .NET Framework 4.8.9345.0 and lib .NETStandard,Version=v2.0) and printed the same output for every example. The README calls the package trimmable and AOT-compatible; this wiki did not test a trimmed or native AOT build. Other .NET versions that read netstandard2.0, Mono and Unity: not tested here. Unity has its own package, described in the README.
Everything is in one namespace:
using UniverseGeneration;using UniverseGeneration;
var galaxy = Galaxy.Generate("my-seed");
Console.WriteLine(galaxy.Name);
Console.WriteLine(galaxy.Descriptor);
Console.WriteLine($"{galaxy.Shape}, {galaxy.Map.Count} systems, {galaxy.Lanes.Count} lanes, {galaxy.Regions.Count} regions");
var system = galaxy.System(0);
Console.WriteLine(system.Descriptor);
Console.WriteLine(system.Star.Description);
foreach (var planet in system.Planets)
Console.WriteLine($" {planet.Name}: {planet.Descriptor}");prints:
Wyvern Galaxy
a ring galaxy
Ring, 60 systems, 71 lanes, 7 regions
an orange dwarf and red dwarf pair with 6 planets and an asteroid belt
orange dwarf
HD 147927 e: a warm desert world under an orange dwarf
HD 147927 c: a warm rocky world under an orange dwarf
HD 147927 d: a warm mini-Neptune under an orange dwarf
HD 147927 f: an ice giant far from an orange dwarf
HD 147927 g: a gas giant far from an orange dwarf
HD 147927 b: an ice giant far from an orange dwarf
galaxy.Map is the cheap view: one MapEntry per system with its name, position, star class, region, danger and faction. galaxy.System(i) and galaxy.Systems give the full star system, built the first time you read it. A 2,000-system galaxy therefore costs little until you open its systems. The planets are listed by orbit, innermost first, but their letters are not in orbit order: here e is the innermost (the orbits are on Plausibility rules).
Each level has its own Generate, and a seed gives a different but stable object at each level:
using UniverseGeneration;
Console.WriteLine(Universe.Generate("my-seed").Name);
Console.WriteLine(GalaxyCluster.Generate("my-seed").Name);
Console.WriteLine(Galaxy.Generate("my-seed").Name);
Console.WriteLine(StarSystem.Generate("my-seed").Descriptor);
Console.WriteLine(Planet.Generate("my-seed").Summary);
Console.WriteLine(StarName.Generate("my-seed").Name);prints:
the Pale Reach
Halcyon Group
Wyvern Galaxy
a red dwarf with 3 planets and an asteroid belt
1.3 g, nitrogen air at 0.6 bar, -37 °C; hazard 2
HD 45528
A system made by StarSystem.Generate("my-seed") is not system 0 of Galaxy.Generate("my-seed"): its address is v1-my-seed/system, a different place from v1-my-seed/galaxy/system/0. See Same seed, same galaxy.
A seed is any text of up to 200 characters, or a 64-bit number. A number is the same seed as its digits:
using UniverseGeneration;
var a = Galaxy.Generate(42);
var b = Galaxy.Generate("42");
Console.WriteLine(a.Address);
Console.WriteLine(a.ToJson() == b.ToJson());prints:
v1-42/galaxy
True
Seeds are compared exactly: case and spaces count. The details are on Same seed, same galaxy.
- Recipes for presets, options, saving, drawing and exporting.
- API reference for every field of every record.
- Errors and edge cases before you pass user input as options.
This wiki describes UniverseGenerator 1.0.0 and was last updated on 2026-10-03. The library is MIT licensed. Report problems in the issues. On NuGet: UniverseGenerator. On OpenUPM: com.m4bwav.universe-generator.
Using it
- Getting started
- API reference
- Same seed, same galaxy
- Plausibility rules
- Errors and edge cases
- Recipes
- Feature matrix
- FAQ
The releases
Contributing
Elsewhere