public GalaxyFactory(bool initToDefault = false, int rngSeed = -1) { if (initToDefault) { Settings = SystemGenSettingsSD.DefaultSettings; } if (rngSeed != -1) { SeedRNG = new Random(rngSeed); } else { SeedRNG = new Random(); } StarSystemFactory = new StarSystemFactory(this); }
internal void Store(SystemGenSettingsSD settings) { SystemGenSettings = settings; }
private static SystemGenSettingsSD GetDefaultSettings() { SystemGenSettingsSD settings = new SystemGenSettingsSD(); settings.RealStarSystems = false; settings.NPRGenerationChance = 0.3333; #region Advanced Star Generation Parameters // Note that the data is this section is largely based on scientific fact // See: http://en.wikipedia.org/wiki/Stellar_classification // These values SHOULD NOT be Modified if you want sane star generation. settings.StarTypeDistributionForRealStars = new WeightedList <SpectralType> { { 0.00003, SpectralType.O }, { 0.13, SpectralType.B }, { 0.6, SpectralType.A }, { 3, SpectralType.F }, { 7.6, SpectralType.G }, { 12.1, SpectralType.K }, { 76.45, SpectralType.M }, { 0.11997, SpectralType.M } // reserved for more exotic star types }; settings.StarTypeDistributionForFakeStars = new WeightedList <SpectralType> { { 0, SpectralType.O }, { 0, SpectralType.B }, { 5, SpectralType.A }, { 15, SpectralType.F }, { 50, SpectralType.G }, { 15, SpectralType.K }, { 10, SpectralType.M }, { 5, SpectralType.M } // reserved for more exotic star types }; // note Do Not Modify these values as they are based on SCIENCE!!! See: http://en.wikipedia.org/wiki/Stellar_classification settings.StarRadiusBySpectralType = new Dictionary <SpectralType, MinMaxStruct> { { SpectralType.O, new MinMaxStruct { Min = 6.6 * GameConstants.Units.SolarRadiusInAu, Max = 250 * GameConstants.Units.SolarRadiusInAu } }, { SpectralType.B, new MinMaxStruct { Min = 1.8 * GameConstants.Units.SolarRadiusInAu, Max = 6.6 * GameConstants.Units.SolarRadiusInAu } }, { SpectralType.A, new MinMaxStruct { Min = 1.4 * GameConstants.Units.SolarRadiusInAu, Max = 1.8 * GameConstants.Units.SolarRadiusInAu } }, { SpectralType.F, new MinMaxStruct { Min = 1.15 * GameConstants.Units.SolarRadiusInAu, Max = 1.4 * GameConstants.Units.SolarRadiusInAu } }, { SpectralType.G, new MinMaxStruct { Min = 0.96 * GameConstants.Units.SolarRadiusInAu, Max = 1.15 * GameConstants.Units.SolarRadiusInAu } }, { SpectralType.K, new MinMaxStruct { Min = 0.7 * GameConstants.Units.SolarRadiusInAu, Max = 0.96 * GameConstants.Units.SolarRadiusInAu } }, { SpectralType.M, new MinMaxStruct { Min = 0.12 * GameConstants.Units.SolarRadiusInAu, Max = 0.7 * GameConstants.Units.SolarRadiusInAu } }, }; // note Do Not Modify these values as they are based on SCIENCE!!! See: http://en.wikipedia.org/wiki/Stellar_classification settings.StarTemperatureBySpectralType = new Dictionary <SpectralType, MinMaxStruct> { { SpectralType.O, new MinMaxStruct { Min = 30000, Max = 60000 } }, { SpectralType.B, new MinMaxStruct { Min = 10000, Max = 30000 } }, { SpectralType.A, new MinMaxStruct { Min = 7500, Max = 10000 } }, { SpectralType.F, new MinMaxStruct { Min = 6000, Max = 7500 } }, { SpectralType.G, new MinMaxStruct { Min = 5200, Max = 6000 } }, { SpectralType.K, new MinMaxStruct { Min = 3700, Max = 5200 } }, { SpectralType.M, new MinMaxStruct { Min = 2400, Max = 3700 } }, }; // note Do Not Modify these values as they are based on SCIENCE!!! See: http://en.wikipedia.org/wiki/Stellar_classification settings.StarLuminosityBySpectralType = new Dictionary <SpectralType, MinMaxStruct> { { SpectralType.O, new MinMaxStruct { Min = 30000, Max = 1000000 } }, { SpectralType.B, new MinMaxStruct { Min = 25, Max = 30000 } }, { SpectralType.A, new MinMaxStruct { Min = 5, Max = 25 } }, { SpectralType.F, new MinMaxStruct { Min = 1.5, Max = 5 } }, { SpectralType.G, new MinMaxStruct { Min = 0.6, Max = 1.5 } }, { SpectralType.K, new MinMaxStruct { Min = 0.08, Max = 0.6 } }, { SpectralType.M, new MinMaxStruct { Min = 0.0001, Max = 0.08 } }, }; // note Do Not Modify these values as they are based on SCIENCE!!! See: http://en.wikipedia.org/wiki/Stellar_classification settings.StarMassBySpectralType = new Dictionary <SpectralType, MinMaxStruct>() { { SpectralType.O, new MinMaxStruct { Min = 16 * GameConstants.Units.SolarMassInKG, Max = 265 * GameConstants.Units.SolarMassInKG } }, { SpectralType.B, new MinMaxStruct { Min = 2.1 * GameConstants.Units.SolarMassInKG, Max = 16 * GameConstants.Units.SolarMassInKG } }, { SpectralType.A, new MinMaxStruct { Min = 1.4 * GameConstants.Units.SolarMassInKG, Max = 2.1 * GameConstants.Units.SolarMassInKG } }, { SpectralType.F, new MinMaxStruct { Min = 1.04 * GameConstants.Units.SolarMassInKG, Max = 1.4 * GameConstants.Units.SolarMassInKG } }, { SpectralType.G, new MinMaxStruct { Min = 0.8 * GameConstants.Units.SolarMassInKG, Max = 1.04 * GameConstants.Units.SolarMassInKG } }, { SpectralType.K, new MinMaxStruct { Min = 0.45 * GameConstants.Units.SolarMassInKG, Max = 0.8 * GameConstants.Units.SolarMassInKG } }, { SpectralType.M, new MinMaxStruct { Min = 0.08 * GameConstants.Units.SolarMassInKG, Max = 0.45 * GameConstants.Units.SolarMassInKG } }, }; settings.StarAgeBySpectralType = new Dictionary <SpectralType, MinMaxStruct>() { { SpectralType.O, new MinMaxStruct { Min = 0, Max = 6000000 } }, // after 6 million years O types either go nova or become B type stars. { SpectralType.B, new MinMaxStruct { Min = 0, Max = 100000000 } }, // could not find any info on B type ages, so i made it between O and A (100 million). { SpectralType.A, new MinMaxStruct { Min = 0, Max = 350000000 } }, // A type stars are always young, typical a few hundred million years.. { SpectralType.F, new MinMaxStruct { Min = 0, Max = 3000000000 } }, // Could not find any info again, chose a number between B and G stars (3 billion) { SpectralType.G, new MinMaxStruct { Min = 0, Max = 10000000000 } }, // The life of a G class star is about 10 billion years. { SpectralType.K, new MinMaxStruct { Min = 0, Max = 13200000000 } }, { SpectralType.M, new MinMaxStruct { Min = 0, Max = 13200000000 } }, }; #endregion #region Advanced SystemBody and other Body Generation Parameters settings.PlanetGenerationChance = 0.8; // Note that the actual maximum number of planets will be one less then this number. settings.MaxNoOfPlanets = 25; settings.MaxNoOfAsteroidsPerBelt = 150; settings.MaxNoOfAsteroidBelts = 3; settings.NumberOfAsteroidsPerDwarfPlanet = 20; settings.MiniumCometsPerSystem = 0; settings.MaxNoOfComets = 25; // The value is a percentage as a number between 0 and 1, tho typically it should be less than 10% (or 0.1). settings.MaxAsteroidOrbitDeviation = 0.03; settings.MaxBodyInclination = 0;//45; //degrees. used for orbits and axial tilt. ** 0, because I can't figure the math to draw a plan view of the system - se5a settings.MaxMoonMassRelativeToParentBody = 0.4; settings.OrbitGravityFactor = 20; settings.TerrestrialBodyTectonicActivityChance = 0.5; // Epoch used when generating orbits for sol. There should be no reason to change this. settings.J2000 = new DateTime(2000, 1, 1, 12, 0, 0); settings.MiniumPossibleDayLength = 6; settings.MinMoonOrbitMultiplier = 2.5; // note These numbers can be tweaked as desired for gameplay. They affect the number of planets generated for a given star type. // note Other factors such as the stars luminosity and mass are also taken into account. So these numbers may not make a whole lot of sense on the surface. settings.StarSpectralTypePlanetGenerationRatio = new Dictionary <SpectralType, double>() { { SpectralType.O, 0.6 }, { SpectralType.B, 0.7 }, { SpectralType.A, 0.9 }, { SpectralType.F, 0.9 }, { SpectralType.G, 2.1 }, { SpectralType.K, 2.4 }, { SpectralType.M, 1.8 }, }; // note That these values are based on bodies in our solar system and discovered Exoplanets. Some adjustment can be made for game play. settings.SystemBodyMassByType = new Dictionary <BodyType, MinMaxStruct>() { { BodyType.GasGiant, new MinMaxStruct { Min = 15 * GameConstants.Units.EarthMassInKG, Max = 500 * GameConstants.Units.EarthMassInKG } }, { BodyType.IceGiant, new MinMaxStruct { Min = 5 * GameConstants.Units.EarthMassInKG, Max = 30 * GameConstants.Units.EarthMassInKG } }, { BodyType.GasDwarf, new MinMaxStruct { Min = 1 * GameConstants.Units.EarthMassInKG, Max = 15 * GameConstants.Units.EarthMassInKG } }, { BodyType.Terrestrial, new MinMaxStruct { Min = 0.05 * GameConstants.Units.EarthMassInKG, Max = 5 * GameConstants.Units.EarthMassInKG } }, { BodyType.Moon, new MinMaxStruct { Min = 1E16, Max = 1 * GameConstants.Units.EarthMassInKG } }, // note 1E16 is 1 nano earth mass. { BodyType.DwarfPlanet, new MinMaxStruct { Min = 2E20, Max = 5E23 } }, { BodyType.Asteroid, new MinMaxStruct { Min = 1E15, Max = 9E19 } }, { BodyType.Comet, new MinMaxStruct { Min = 1E13, Max = 9E14 } }, }; // note That these values are based on bodies in our solar system and discovered Exoplanets. Some adjustment can be made for game play. settings.SystemBodyDensityByType = new Dictionary <BodyType, MinMaxStruct>() { { BodyType.GasGiant, new MinMaxStruct { Min = 0.5, Max = 10 } }, { BodyType.IceGiant, new MinMaxStruct { Min = 1, Max = 5 } }, { BodyType.GasDwarf, new MinMaxStruct { Min = 1, Max = 8 } }, { BodyType.Terrestrial, new MinMaxStruct { Min = 3, Max = 8 } }, { BodyType.Moon, new MinMaxStruct { Min = 1.4, Max = 5 } }, { BodyType.DwarfPlanet, new MinMaxStruct { Min = 1, Max = 6 } }, { BodyType.Asteroid, new MinMaxStruct { Min = 1, Max = 6 } }, { BodyType.Comet, new MinMaxStruct { Min = 0.25, Max = 0.7 } }, }; // note These numbers, with the exception of G class stars, are based on habitable zone calculations. They could be tweaked for gameplay. settings.OrbitalDistanceByStarSpectralType = new Dictionary <SpectralType, MinMaxStruct>() { { SpectralType.O, new MinMaxStruct { Min = 1, Max = 200 } }, { SpectralType.B, new MinMaxStruct { Min = 0.5, Max = 100 } }, { SpectralType.A, new MinMaxStruct { Min = 0.3, Max = 90 } }, { SpectralType.F, new MinMaxStruct { Min = 0.2, Max = 60 } }, { SpectralType.G, new MinMaxStruct { Min = 0.1, Max = 40 } }, { SpectralType.K, new MinMaxStruct { Min = 0.01, Max = 18 } }, { SpectralType.M, new MinMaxStruct { Min = 0.005, Max = 9 } }, }; settings.BodyEccentricityByType = new Dictionary <BodyType, MinMaxStruct> { { BodyType.Asteroid, new MinMaxStruct { Min = 0, Max = 0.5 } }, { BodyType.Comet, new MinMaxStruct { Min = 0.6, Max = 0.8 } }, { BodyType.DwarfPlanet, new MinMaxStruct { Min = 0, Max = 0.5 } }, { BodyType.GasDwarf, new MinMaxStruct { Min = 0, Max = 0.5 } }, { BodyType.GasGiant, new MinMaxStruct { Min = 0, Max = 0.5 } }, { BodyType.IceGiant, new MinMaxStruct { Min = 0, Max = 0.5 } }, { BodyType.Moon, new MinMaxStruct { Min = 0, Max = 0.5 } }, { BodyType.Terrestrial, new MinMaxStruct { Min = 0, Max = 0.5 } } }; // note These are WAGs roughly based on the albedo of bodies in our solar system. They could be tweak for gameplay. settings.PlanetAlbedoByType = new Dictionary <BodyType, MinMaxStruct> { { BodyType.GasGiant, new MinMaxStruct { Min = 0.5, Max = 0.7 } }, { BodyType.IceGiant, new MinMaxStruct { Min = 0.5, Max = 0.7 } }, { BodyType.GasDwarf, new MinMaxStruct { Min = 0.3, Max = 0.7 } }, { BodyType.Terrestrial, new MinMaxStruct { Min = 0.05, Max = 0.5 } }, { BodyType.Moon, new MinMaxStruct { Min = 0.05, Max = 0.5 } }, { BodyType.DwarfPlanet, new MinMaxStruct { Min = 0.05, Max = 0.95 } }, { BodyType.Asteroid, new MinMaxStruct { Min = 0.05, Max = 0.15 } }, { BodyType.Comet, new MinMaxStruct { Min = 0.95, Max = 0.99 } }, }; // note These are WAGs roughly based on the Magnetosphere of bodies in our solar system. They could be tweak for gameplay. settings.PlanetMagneticFieldByType = new Dictionary <BodyType, MinMaxStruct> { { BodyType.GasGiant, new MinMaxStruct { Min = 10, Max = 2000 } }, { BodyType.IceGiant, new MinMaxStruct { Min = 5, Max = 50 } }, { BodyType.GasDwarf, new MinMaxStruct { Min = 0.1, Max = 20 } }, { BodyType.Terrestrial, new MinMaxStruct { Min = 0.0001, Max = 45 } }, { BodyType.Moon, new MinMaxStruct { Min = 0.0001, Max = 1 } }, { BodyType.DwarfPlanet, new MinMaxStruct { Min = 0.00001, Max = 0.0001 } }, { BodyType.Asteroid, new MinMaxStruct { Min = 0.000001, Max = 0.00001 } }, { BodyType.Comet, new MinMaxStruct { Min = 0.0000001, Max = 0.000001 } }, }; // note These numbers can be tweaked as desired for gameplay. They effect the chances of atmosphere generation. settings.AtmosphereGenerationModifier = new Dictionary <BodyType, double> { { BodyType.GasGiant, 100000000 }, { BodyType.IceGiant, 100000000 }, { BodyType.GasDwarf, 100000000 }, { BodyType.Terrestrial, 1 }, { BodyType.Moon, 0.5 }, { BodyType.DwarfPlanet, 0 }, { BodyType.Asteroid, 0 }, { BodyType.Comet, 0 }, }; // note that this number can be tweaked for gameplay. it affects the chance of venus like planets. settings.RunawayGreenhouseEffectChance = 0.25; settings.MinMaxAtmosphericPressure = new MinMaxStruct(0.000000001, 200); // note that this number can be tweaked for gameplay. It affects the chance of venus like planets. settings.RunawayGreenhouseEffectMultiplyer = 10; // note These numbers can be tweaked as desired for gameplay. They effect the chances of a planet having moons. settings.MoonGenerationChanceByPlanetType = new Dictionary <BodyType, double> { { BodyType.GasGiant, 0.99999999 }, { BodyType.IceGiant, 0.99999999 }, { BodyType.GasDwarf, 0.99 }, { BodyType.Terrestrial, 0.5 }, { BodyType.DwarfPlanet, 0.0001 }, { BodyType.Moon, -1 }, }; settings.MaxMoonOrbitDistanceByPlanetType = new Dictionary <BodyType, double> { { BodyType.GasGiant, 60581692 / GameConstants.Units.KmPerAu }, // twice highest jupiter moon orbit { BodyType.IceGiant, 49285000 / GameConstants.Units.KmPerAu }, // twice Neptune's highest moon orbit { BodyType.GasDwarf, 6058169 / GameConstants.Units.KmPerAu }, // WAG { BodyType.Terrestrial, 1923740 / GameConstants.Units.KmPerAu }, // 5 * luna orbit. { BodyType.DwarfPlanet, 25000 / GameConstants.Units.KmPerAu }, // WAG }; // note Given the way the calculation for max moons is done it is unlikely that any planet will ever have the maximum number of moon, so pad as desired. settings.MaxNoOfMoonsByPlanetType = new Dictionary <BodyType, double> { { BodyType.GasGiant, 20 }, { BodyType.IceGiant, 15 }, { BodyType.GasDwarf, 8 }, { BodyType.Terrestrial, 4 }, { BodyType.DwarfPlanet, 1 }, }; settings.BodyTectonicsThresholds = new Dictionary <TectonicActivity, double> { { TectonicActivity.Dead, 0.01 }, { TectonicActivity.Minor, 0.2 }, { TectonicActivity.EarthLike, 0.4 }, { TectonicActivity.Major, 1 } // Not used, just here for completeness. }; settings.BandBodyWeight = new WeightedList <SystemBand> { { 0.3, SystemBand.InnerBand }, { 0.1, SystemBand.HabitableBand }, { 0.6, SystemBand.OuterBand }, }; settings.InnerBandTypeWeights = new WeightedList <BodyType>() { { 35, BodyType.Asteroid }, { 10, BodyType.GasDwarf }, { 5, BodyType.GasGiant }, { 0, BodyType.IceGiant }, { 50, BodyType.Terrestrial }, }; settings.HabitableBandTypeWeights = new WeightedList <BodyType> { { 25, BodyType.Asteroid }, { 10, BodyType.GasDwarf }, { 5, BodyType.GasGiant }, { 0, BodyType.IceGiant }, { 60, BodyType.Terrestrial }, }; settings.OuterBandTypeWeights = new WeightedList <BodyType> { { 15, BodyType.Asteroid }, { 20, BodyType.GasDwarf }, { 25, BodyType.GasGiant }, { 20, BodyType.IceGiant }, { 10, BodyType.Terrestrial }, }; #endregion #region Ruins Generation // note A suitable planet/moon includes an atmosphere between 2.5 and 0.01 atm. settings.RuinsGenerationChance = 0.5; // note These values can be tweaked as desired for game play. settings.RuinsSizeDistribution = new WeightedList <RuinsDB.RSize>() { { 40, RuinsDB.RSize.Outpost }, { 30, RuinsDB.RSize.Settlement }, { 20, RuinsDB.RSize.Colony }, { 10, RuinsDB.RSize.City } }; // note There is some special additional logic for RuinsDB.RQuality.MultipleIntact. // note These values can be tweaked as desired for game play. settings.RuinsQualityDistribution = new WeightedList <RuinsDB.RQuality>() { { 40, RuinsDB.RQuality.Destroyed }, { 30, RuinsDB.RQuality.Ruined }, { 15, RuinsDB.RQuality.PartiallyIntact }, { 15, RuinsDB.RQuality.Intact } }; // note These values can be tweaked as desired for game play. settings.RuinsCountRangeBySize = new Dictionary <RuinsDB.RSize, MinMaxStruct>() { { RuinsDB.RSize.Outpost, new MinMaxStruct { Min = 15, Max = 50 } }, { RuinsDB.RSize.Settlement, new MinMaxStruct { Min = 50, Max = 100 } }, { RuinsDB.RSize.Colony, new MinMaxStruct { Min = 100, Max = 200 } }, { RuinsDB.RSize.City, new MinMaxStruct { Min = 500, Max = 1000 } }, }; // note These values can be tweaked as desired for game play. settings.RuinsQualityAdjustment = new Dictionary <RuinsDB.RQuality, double>() { { RuinsDB.RQuality.Destroyed, 1.25 }, { RuinsDB.RQuality.Ruined, 1.5 }, { RuinsDB.RQuality.PartiallyIntact, 1.75 }, { RuinsDB.RQuality.Intact, 2.0 }, { RuinsDB.RQuality.MultipleIntact, 3.0 } }; settings.MinMineralAccessibility = 0.1; settings.MinHomeworldMineralAccessibility = 0.5; settings.MinHomeworldMineralAmmount = 50000; settings.HomeworldMineralAmmount = 100000; settings.MineralGenerationChanceByBodyType = new Dictionary <BodyType, double>() { { BodyType.GasGiant, 0.4 }, { BodyType.IceGiant, 0.33 }, { BodyType.GasDwarf, 0.3 }, { BodyType.Terrestrial, 0.5 }, { BodyType.Moon, 0.15 }, { BodyType.DwarfPlanet, 0.15 }, { BodyType.Comet, 1 }, { BodyType.Asteroid, 0.1 }, }; settings.MaxMineralAmmountByBodyType = new Dictionary <BodyType, int>() { { BodyType.GasGiant, 100000000 }, { BodyType.IceGiant, 50000000 }, { BodyType.GasDwarf, 10000000 }, { BodyType.Terrestrial, 5000000 }, { BodyType.Moon, 1000000 }, { BodyType.DwarfPlanet, 500000 }, { BodyType.Comet, 100000 }, { BodyType.Asteroid, 50000 }, }; #endregion return(settings); }