"Dear World, You are the best for Us!" - Artifexian
TypeScript world generator for 4X like games in 3D space
In heavy development mess xD
For CodeSandbox example, use git source with tag
prealpha_0.0.2-rc.1
, package.json example:"dependencies": { "xenocide-world-generator": "https://github.com/duchu-net/xenocide-world-generator@prealpha_0.0.2-rc.1", }
For now generator is developed as part of a private project (galaxy simulator with nx),
so currently without plans to release as a separate bundle (but can be used as git submodule).
npm i @xenocide/[email protected]
const { GalaxyGenerator, GalaxyClass } = require('@xenocide/world-generator');
// or
import { GalaxyGenerator, GalaxyClass } from '@xenocide/world-generator';
Supports ESM and CommonJS modules.
New examples coming soon...
Galaxy generator with React and SVG (live demo). | |
Planet generator with React and @react-three/fiber (live demo). | |
[*alpha JS version] Full featured generator demo with React, Redux and react-three-fiber (live demo, video). | |
[*alpha JS version] Name generation with Markov Chains. | live demo |
import { GalaxyGenerator, GalaxyClass, PlanetGenerator } from '@xenocide/world-generator';
// Spiral shape
const world = new GalaxyGenerator(
{ id: 'demo', classification: GalaxyClass.Spiral },
{ seed: 123, spiral: { size: 500 } }
);
// Grid shape
const world = new GalaxyGenerator(
{ id: 'demo', classification: GalaxyClass.Grid },
{ seed: 123, grid: { size: 15, spacing: 5 } }
);
const systems = [];
for (const system of world.generateSystems()) {
systems.push(system.path);
for (const star of system.generateStars()) {
// console.log('*** Star generated:', star.path, star.toModel());
}
/** don't generate too much for tests */
if (systems.length <= 3) {
for (const planet of system.generatePlanets()) {
// console.log('*** Planet/Belt/Etc. generated:', planet.path, planet.toModel());
if (planet instanceof PlanetGenerator) {
for (const region of planet.generateSurface()) {
// console.log('**** Regions generated:', region.path);
}
}
}
}
}
// Get Plain Object
const model = world.toModel();
- [mainly] Procedural Planet Generation by Andy Gainey
- Star-Citizen-WebGL-Map by Lianna Eeftinck
- Artifexian (YouTube) by Edgar Grunewald
- Procedural Generation For Dummies by Martin Evans
- X game series by Egosoft
- 4X games (Wikipedia)
- Stellar classification (Wikipedia)
- Holdridge life zones (Wikipedia)
- Planet IX
- Prosperous Universe
- Astro Empires
- own tsconfig build, not from nx