Probability of each star type and planet size

For topics that do not fit in another sub-forum.

Moderators: Oberlus, Oberlus

Post Reply
Message
Author
User avatar
Oberlus
Cosmic Dragon
Posts: 2137
Joined: Mon Apr 10, 2017 4:25 pm

Probability of each star type and planet size

#1 Post by Oberlus » Thu Mar 19, 2020 5:03 pm

I need to calculate the expected probability of each star type at universe generation, to estimate number of each star type depending on number of systems in the galaxy.

We have in default/python/universe_generation/universe_tables.py the tables BASE_STAR_TYPE_DIST and UNIVERSE_AGE_MOD_TO_STAR_TYPE_DIST:

Code: Select all

BASE_STAR_TYPE_DIST = {
    fo.starType.blue: 15,
    fo.starType.white: 20,
    fo.starType.yellow: 25,
    fo.starType.orange: 20,
    fo.starType.red: 15,
    fo.starType.neutron: 0,
    fo.starType.blackHole: -5,
    fo.starType.noStar: 10,
}

UNIVERSE_AGE_MOD_TO_STAR_TYPE_DIST = {
#                                blue  white  yellow  orange  red  neutron  blackHole  noStar
    fo.galaxySetupOption.low:   ( 10,    20,      0,      0,   0,       0,         0,     60), // Young galaxy
    fo.galaxySetupOption.medium:( -5,     0,     10,     20,   0,      10,        10,     40), // Mature
    fo.galaxySetupOption.high:  (-20,   -10,      0,     10,  20,      20,        20,     20), // Ancient
}
To get the star type of a system at universe generation you do:

Code: Select all

    max_roll = 0
    for candidate in star_types:
        roll = random.randint(1, 100) \
            + universe_tables.UNIVERSE_AGE_MOD_TO_STAR_TYPE_DIST[galaxy_age][candidate] \
            + universe_tables.BASE_STAR_TYPE_DIST[candidate]
        if max_roll < roll:
            max_roll = roll
            star_type = candidate
So you roll one 100 dice for each star type, add to each roll the bonus from the two tables depending on star type and galaxy age, and pick the one with the greatest value (in case of tie I think it picks the brighter star, but that's irrelevant for me now).

Looking at the values in the mentioned tables you don't know the probabilities.
I've run (in a spreadsheet) those calculations for 1000 systems and I get for young galaxies 601 empty stars, 172 white starts... 1 neutron and 1 black. But when I did the same for 100 sytems I got 2 neutrons and 1 black, so 1000 systems isn't enough to get the real probabilities.

I know that using geometric probability I could calculate what I need directly from the star type bonus tables, but I don't know how to do it.

Any statistician in the room with knowledge on how to solve this?

User avatar
Oberlus
Cosmic Dragon
Posts: 2137
Joined: Mon Apr 10, 2017 4:25 pm

Re: Probability of each star type?

#2 Post by Oberlus » Fri Mar 20, 2020 10:49 am

So brute force it is (200M repetitions):
BlueWhiteYellowOrangeRedNeutronBlackNone
Young0.07390.18280.07210.04750.02970.00530.00250.5860
Mature0.02980.07280.19000.24390.04600.02790.01590.3738
Ancient0.00840.04240.14460.19730.25730.09650.06300.1904
Error +/- 0.0002


Wouldn't it be better to have tables of probabilities (easily interpretable) instead of these bonus thingy?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12569
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Probability of each star type?

#3 Post by Geoff the Medio » Fri Mar 20, 2020 11:39 am

Oberlus wrote:
Fri Mar 20, 2020 10:49 am
Wouldn't it be better to have tables of probabilities (easily interpretable) instead of these bonus thingy?
If the chance of each star type is always the same and independent of anything other than galaxy age, then that would make sense. But the current system is more flexible, in that one can add other factors, like distance from the centre of the galaxy, that affect the select of star colour, without invalidating the meaning of the numbers in the table.

User avatar
Oberlus
Cosmic Dragon
Posts: 2137
Joined: Mon Apr 10, 2017 4:25 pm

Re: Probability of each star type?

#4 Post by Oberlus » Fri Mar 20, 2020 12:06 pm

Geoff the Medio wrote:
Fri Mar 20, 2020 11:39 am
If the chance of each star type is always the same and independent of anything other than galaxy age, then that would make sense. But the current system is more flexible, in that one can add other factors, like distance from the centre of the galaxy, that affect the select of star colour, without invalidating the meaning of the numbers in the table.
Fair enough!

User avatar
Oberlus
Cosmic Dragon
Posts: 2137
Joined: Mon Apr 10, 2017 4:25 pm

Re: Probability of each star type and planet size

#5 Post by Oberlus » Sat Mar 21, 2020 5:02 pm

Expected habitable size per system at start depending on galaxy age and planet density:
Low Medium High
Young 0.83 1.25 1.56
Mature 1.87 2.80 3.49
Ancient 3.57 5.35 6.73
So for a 100 system, mature, medium density galaxy you can expect a total 280 habitable size (to be the base for population calculations based on species traits, environments, growth techs, etc.).

The point of this is to estimate maximum production of a galaxy to play with influence colony/population upkeep for controlling snowballing. Still a long way to go.

Post Reply