Skip to content

duchu-net/xenocide-world-generator

Repository files navigation

xenocide-world-generator

"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 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).

Image

Example

Code

const { Galaxy } = require('xenocide-world-generator');

// Random shape
// const galaxy = new Galaxy()
// Grid shape with [size, spacing]
const galaxy = new Galaxy({ classification: 'grid', buildData: { gridOptions: [100, 30] } });
// Spiral shape
// const galaxy = new Galaxy({ classification: 'spiral' })

console.log('*** Galaxy generated:', galaxy.name, galaxy.id);
for (let system of galaxy.generateSystems()) {
  // await system.build()
  console.log('** System generated:', system.name, system.id);
  for (let star of system.generateStars()) {
    console.log('* Star generated:', star.designation, star.id);
  }
  for (let planet of system.generatePlanets()) {
    console.log('* Planet generated:', planet.designation, planet.id);
  }
}
console.log(galaxy.statistics);

Inspired by

Other links

// todo // own tsconfig not from nx