UniverseGenerator in TypeScript: the same galaxy in a browser
A port of the C# galaxy generator to npm and JSR, and a month of plugins since the last post
UniverseGenerator came out for .NET and Unity in October. Version 1.0.0 of the TypeScript port is now on npm as universe-generator and on JSR as @m4bwav/universe-generator. A seed gives the same galaxy in a browser as it does in C#, down to the names.
The map below is made by the npm package in your browser while the page loads. Type a seed, pick a preset and click a star.
import {generateGalaxy} from 'universe-generator';
const galaxy = generateGalaxy('my-seed');
console.log(galaxy.shape, galaxy.regions[0].name); // Ring Musca Drift
Same seed, same galaxy
The C# library promised that a seed produces the same output on every platform. The port had to keep that promise across languages, so the C# repository's golden files are the test suite. Each one records what a seed made in C#, and the TypeScript output has to match it exactly. No golden was edited to make a test pass.