Jump to content

Galaxy Generation

From Starship Simulator
Revision as of 12:21, 28 April 2025 by Cagi (talk | contribs)

NOTICE: This page is a Work in Progress as much of the lore/Development for the game is yet to be established.


The Galaxy Generation system in Starship Simulator is responsible for creating the vast, explorable universe of the game. It employs a hybrid approach, combining procedural generation techniques with real-world astronomical data and player-contributed content to simulate the Milky Way galaxy.

Core Principles

The generation process is founded on several key principles:

  • Seed-Based Universe: The entire galaxy is generated based on a unique seed. Initially using simpler methods, the system was upgraded (with help from @Tristian) to utilize a system providing 2256 unique seeds, ensuring a distinct universe for different playthroughs or server instances if desired. (Dev Build 0.225.0.21)
  • Procedural Algorithms: Sophisticated algorithms simulate astrophysical processes to generate stars, planets, moons, asteroid belts, and other celestial phenomena where real-world data is unavailable or intentionally supplemented.
  • Coordinate System: The galactic coordinate system was rebased during development to place the true galactic centre, Sagittarius A*, at coordinates 0, 0, 0. (Dev Build 0.225.0.14, 0.225.0.16)

Data Sources

The galaxy is populated using multiple data sources:

  • Real Star Catalogues: Incorporates data from real-world astronomical surveys, such as the Gaia catalogue. At points during development, this included millions of stars within a 2000 light-year radius of Sol. (Dev Build 0.225.0.19, 0.225.0.21, 0.225.0.27) Specific nearby stars and Sol System objects (including planets and dwarf planets like Eris and Sedna) are accurately placed and named. (Dev Build 0.225.0.16, 0.225.0.21, 0.225.0.67)
  • Backer Contributions: Systems and alien races/empires backed via Kickstarter or other means are integrated into the galaxy. This data was moved from local SQLite files to external MySQL databases for easier updates. (Dev Build 0.225.0.39, 0.225.0.44, 0.225.0.79)
  • Modding Support: The system allows players to add their own custom star systems locally using a dedicated SQLite file (`stars_modded.db`). (Dev Build 0.225.0.79)

Stellar Generation

The system generates a wide variety of stellar objects:

  • Star Classes: Includes main sequence stars (O through M), L, T, Y classes, T-Tauri, Wolf-Rayet, Neutron Stars, White Dwarfs, and Black Holes (including Sagittarius A*). Support for 80 specific sub-classes (e.g., O0V to Y9) allows for detailed temperature and luminosity variations. (Dev Build 0.225.0.16, 0.225.0.24, 0.225.0.27, 0.225.0.30)
  • Stellar Characteristics: Calculates properties like temperature, mass, luminosity, radius, mass fractions (Hydrogen/Helium/Metals), metallicity, gravity, escape velocity, Roche Limit, Hill Sphere, Tidal Truncation Radius (affecting Oort Clouds and potentially FTL travel), and generates unique spectral analysis graphics visible on Sensors. (Dev Build 0.225.0.30, 0.225.0.32, 0.225.0.64, 0.225.0.67, 0.225.0.69)

Planetary System Generation

Planet formation follows simulated astrophysical rules:

  • Proto-Planetary Disk Simulation: Considers initial disk mass fractions (H/He/Metals), size, lifetime, and evaporation. This constrains the total mass available for rocky cores and gas giant envelopes. (Dev Build 0.225.0.32)
  • Formation Zones & Limits: Utilizes concepts like the Dust Sublimation Line (~2000K) and Carbon Monoxide Snow Line (~30K) to determine where planets can form. The system also generates Kuiper Belt / Scattered Disk analogues and calculates Oort Cloud extents. (Dev Build 0.225.0.32, 0.225.0.66, 0.225.0.67)
  • Object Types: Generates terrestrial planets (sub-types like Earth Analogue, Water World, Lava World), Gas Giants, Ice Giants, Icy Bodies, Moons (Planned/Added in 0.226 cycle), Asteroids, and Comets (Planned for 0.227 cycle). Planetary rings are generated based on probability. (Dev Build 0.225.0.30, 0.225.0.32, Roadmap, Dev Build 0.225.0.74)

Planet Characteristics

Generated planets have detailed properties:

  • Orbital Mechanics: Calculates orbital distance, period, and velocity. (Dev Build 0.225.0.69)
  • Physical Properties: Determines mass, core/mantle/crust densities, core mass fraction, radius, volume, gravity, Roche Limit, and Hill Radius. (Dev Build 0.225.0.30, 0.225.0.69)
  • Atmosphere & Temperature: Calculates equilibrium and surface temperatures (considering Bond Albedo, greenhouse effects). Determines atmospheric presence (e.g., ability to hold Nitrogen) and composition (including chemicals for gas giants, "tenuous exospheres" for airless bodies). (Dev Build 0.225.0.30, 0.225.0.69, 0.225.0.70)
  • Surface Features: Generates basic surface maps (visible on Sensors) and incorporates Nanite tessellation for 3D terrain details on planets viewed from space or on the Holoprojector. (Dev Build 0.225.0.48, 0.225.0.70, 0.225.0.72)

Life and Civilization

The galaxy is seeded with potential life and civilizations:

  • Life Generation: A "Has Life?" flag is generated for planets, with logic refined over time (e.g., chance on Gas Giants for testing, focus on Habitable Zone worlds for FTL species). Requires a Level 3 (Short Range) scan to confirm via a "Life Sig" indicator. (Dev Build 0.225.0.30, 0.225.0.69)
  • FTL Civilizations: Procedurally generated alien empires with home systems and occupied territories are placed throughout the galaxy. Their size and spread can be influenced by factors like tech level. Randomly generated names (with a blacklist filter) are assigned. Requires Level 1 (Long Range) scan to detect via "Tech Sig" indicator, and Level 3 scan to identify the civilization name. (Dev Build 0.225.0.14, 0.225.0.63, 0.225.0.64, 0.225.0.69)

Performance and Implementation

Significant effort has gone into optimizing the galaxy generation:

  • Optimization: Techniques include using asynchronous functions, isolated data containers for high-level sector data, optimized sorting, and code refinements reducing sector generation time significantly (e.g., ~50ms mentioned). (Dev Build 0.225.0.16, 0.225.0.17, 0.225.0.30, 0.225.0.21)
  • Multiplayer Handling: To improve performance, the galaxy generation system runs locally on client machines rather than being purely server-side. (Dev Build 0.225.0.60)
  • In-Game Hardware: A physical representation of the Galaxy Generation computer exists within the Data Centre on C Deck. (Dev Build 0.225.0.60)

Interaction

Players primarily interact with the generated galaxy via the Sensors suite, which reveals progressively more detail about systems and celestial bodies based on scan type (Long, Medium, Short Range) and achieved knowledge levels. The Holoprojector provides visual representations like Orrery maps. Navigation data is used by the Helm.