Planet Generation


So I’m starting on a prototype to generate a planet for the microbe stage. This prototype is going to be super stripped down (and even then it’s pretty crazy). One of the first steps is to compute the habitable zone for a planet.

This is a non-trivial task because we know the amount of incoming energy (from the properties of the star and the size of the planet and it’s orbit) however the amount that is absorbed and reflected is proportional to how much ozone there is (from 02 in the atmosphere). Moreover the greenhouse effect becomes important and because water vapour is a greenhouse gas the hotter the planet gets the more heat gets trapped.

So I wrote this prototype to run the climate simulation with a load of different values of CO2 and compute whether they were habitable or not. You can see the results are quite nice. A red dot indicates the planet is not habitable (temperature between 0 and 100 degrees C) and a green one means it is. I suppose in our situation on this planet we are really hoping our whole column is green (however much CO2 you put into the atmosphere the planet will still be in that temperature range) however we could live on a column where the top is green and the bottom is red (runaway warming causes the oceans to boil) which would be real bad.

Oh yeah the minimum distance is an orbit the size of Mercury’s (far left) and the maximum is an orbit the size of Jupiter’s (far right). Anyway I’m going to plug in all the rest of the info and use that to position the planet inside the solar system.

Ok so this is pretty much done. I’ve made the full calculator (code here) and it’s pretty good. By adjusting the parameters you can adjust how sharp the zone is. With them all 0 the zone is like a step function, with them all at a small value (0.3 seems good) then zone is a smooth bump. With them high the climate effects are so strong it’s very hard to stay in the habitable zone.

Scores are between 0 (uninhabitable with any amount of CO2 and O3) and 100 (always habitable whatever happens in the atmosphere).


Ok so I’ve made some good progress with this. Code’s in the repo. No pictures I’m afraid. I’ve put some of the text dump outputs below.

Questions which we need to discuss before implementing this / moving forward with it.

  1. Size of star. Stars which are very big burn out very fast. Faster than the game would take to complete (microbe stage a couple of billion years alone (which is probably 95% of the game) whereas a star of 3 stellar masses burns out in 370 million years and bigger ones much faster like the cube of the mass). How much ability should the player have to choose to live by a star that will kill them? If the play can choose this then what happens when the star burns out? Dialogue box or some sequence of events (it would be kind of fun to tell the player “you have only 200 million years left to make it to the space stage or die”). The gdd talks about planets in orbit of white dwarfs, do we want this? Right now I’ve only included main sequence stars.

  2. The gdd talks a lot about stellar metallicity (what %age of the star is not made of hydrogen and helium). Currently I have taken no account of this. Does anyone know what difference it should make?

  3. How much of the solar system should be generated now? I was thinking about this and basically just generating the star and the planet is enough until the space stage. Everything else (meteoroid impacts for example) could just be random.

  4. Binary stars. Should they be allowed and if so what difference does it make? (I feel like it’s none, maybe it changes the stellar spectrum as two smaller stars will be much dimmer than a big one of twice the mass (because of how fusion occurs faster under higher gravity (which is why there are supernovas))). Maybe it’s a nice cosmetic thing to have.

  5. Moons. Does it matter if the planet has moons? Does this affect anything other than cosmetically? I like the idea of the player evolving on a moon rather than a planet but again does this make any meaningful difference before the space stage?

  6. What should we do about habitable zones? Basically (if we have temperature dependent climate effects, which are currently in) the habitable zone changes depends on which gasses are present in the atmosphere. So if you put more CO2 in the planet heats up. This means not all orbital radii are habitable all the time. So how much power should the player have to put themselves in a dangerous place with this? If the planet gets too cold that’s survivable (the oceans freeze over and all photosynthesizers die but you can retreat to the deep ocean vents and live there off Hydrogen Sulfide until volcanic activity puts more CO2 in the atmosphere to heat it up again). However if it gets too hot and all the oceans boil then it’s game over.

NB: Interestingly the size of the planet drops out of the temperature calculations. Basically the amount of light the planet absorbs is proportional to it’s surface area but so is the amount of energy it radiates away as a black body. Therefore that constant can be dropped. So if the earth were twice the size it would be the same temperature (not really as the atmospheric effects would be different but in a purely radiative model yeah). What matters is how far it is from the sun. (One way of intuiting this is to think how, for 1 sq m of land it really doesn’t matter whether it’s alone or surrounded by other land, what matters is how much energy in and how much out). I guess it’s a bit like how your own mass drops out of Newtonian gravity.

  1. What about the size of the planet? Right now every planet is the size of the earth. Is there any meaningful difference to having a planet which is bigger and smaller? What about in later stages?

  2. Atmosphere, how much, by mass, should there be? The same as earth? Again are there meaningful differences to having more or less gas? Also I just started the atmosphere with Nitorgen and Carbon Dixoide, should there be other starts? Ocean is Water, Nitrogen, Carbon Dioxide and Phosphates and the lithosphere is Hydrogen Sulfide and Carbon Dioxide. It’s interesting that these are enough for everything else to be produced / bootstrapped. Should there be some randomness to this or should it always be the same?

  3. I’ve still got a little work to do with the stellar spectrum at the surface (after it passes through the atmosphere). It’s important we fix how much atmosphere there is and how big the planets are because the spectrum really depends on a tube of atmosphere of 1 sq m area (so a big planet with a lot of atmosphere has the same atmospheric absorption as a small planet with a little atmospheric gas). If the planets size and amount of gas will be the same as earth then I’ll just fix everything to that but if they are going to be variables I’ll build in a atmospheric depth calculator. (Once this is done the spectrum under the sea can be computed by the electromagnetic opacity of water (the amount of light exponentially decays as it goes through the water)).

  4. List of events / fix the carbon cycle. We need to work out a list of reasons why things move from one bin to another (like atmosphere <-> ocean gas exchange or hydrogen sulphide vents putting stuff into patches). Anyway then I can write an update loop and then it’s pretty much done!

  5. How does the player select all this? Is there a “Just give me a planet” button? Can you say “Just give me a hard planet”? Can you adjust everything with sliders etc? It’s nice to be able to design the whole planet yourself but it takes the mystery out of whether you will survive. Somehow hard mode might need to have all threats on but you not know what they are (but how hard is hard? is outside the habitable zone allowed etc)?

Hope you like it! All feedback welcome as always.

Notice how, below, the 2nd planet is 2.4x the size of the sun and so the planet has to be so far out to be habitable that it takes 5.9 earth years to orbit! I’d have just turned 5! (Unfortunately the sun is only in main sequence for 719 milllion years so I wouldn’t have evolved but that’s a technicality :smile: )

----- Output Dumps -------

Created new main sequence star
Mass = 0.676184137393 solar masses.
Life Span = 3.23e+10 of our years.
Luminosity = 9.78e+25 watts.
Radius = 4.89e+08 meters.
Temperature = 4892.45776559 Kelvin.
Stellar spectrum = [redacted stellar specturm output (watts / warvelegth)]
Habitable zone = [redacted habitable zone calcs]

Created new planet.
Orbital radius = 7.40e+10 meters.
Radius = Radius of the earth = 6.37e+06 meters.
Orbital period = 1.34e+07 seconds = 0.423404852217 earth years = 1 year for this planet.
Atmosphere = {‘Amino Acids’: 0, ‘DNA’: 0, ‘ATP’: 0, ‘Oxygen’: 0, ‘Carbon Dioxide’: 1.545e+18, ‘Pyruvate’: 0, ‘Hydrogen Sulfide’: 0, ‘Water’: 0, ‘Agents’: 0, ‘Fat’: 0, ‘Nitrogen’: 3.605e+18, ‘Phosphates’: 0, ‘Sulfur’: 0, ‘Protein’: 0, ‘Nucleotide’: 0, ‘Ammonia’: 0, ‘Glucose’: 0}
Ocean = {‘Amino Acids’: 0, ‘DNA’: 0, ‘ATP’: 0, ‘Oxygen’: 0, ‘Carbon Dioxide’: 1.4e+20, ‘Pyruvate’: 0, ‘Hydrogen Sulfide’: 0, ‘Water’: 1.12e+21, ‘Agents’: 0, ‘Fat’: 0, ‘Nitrogen’: 2.8e+20, ‘Phosphates’: 1.4e+20, ‘Sulfur’: 0, ‘Protein’: 0, ‘Nucleotide’: 0, ‘Ammonia’: 0, ‘Glucose’: 0}
Lithosphere = {‘Amino Acids’: 0, ‘DNA’: 0, ‘ATP’: 0, ‘Oxygen’: 0, ‘Carbon Dioxide’: 5000000000.0, ‘Pyruvate’: 0, ‘Hydrogen Sulfide’: 5000000000.0, ‘Water’: 0, ‘Agents’: 0, ‘Fat’: 0, ‘Nitrogen’: 0, ‘Phosphates’: 0, ‘Sulfur’: 0, ‘Protein’: 0, ‘Nucleotide’: 0, ‘Ammonia’: 0, ‘Glucose’: 0}
Spectrum on the surface = [redacted spectrum]
[Finished in 2.6s]

Created new main sequence star
Mass = 2.40534108141 solar masses.
Life Span = 7.19e+08 of our years.
Luminosity = 8.30e+27 watts.
Radius = 1.53e+09 meters.
Temperature = 8389.76031332 Kelvin.
Stellar spectrum = [redacted spectrum]
Habitable zone = [redacted hab calcs]

Created new planet.
Orbital radius = 6.56e+11 meters.
Radius = Radius of the earth = 6.37e+06 meters.
Orbital period = 1.87e+08 seconds = 5.9271568034 earth years = 1 year for this planet.
Atmosphere = {‘Amino Acids’: 0, ‘DNA’: 0, ‘ATP’: 0, ‘Oxygen’: 0, ‘Carbon Dioxide’: 1.545e+18, ‘Pyruvate’: 0, ‘Hydrogen Sulfide’: 0, ‘Water’: 0, ‘Agents’: 0, ‘Fat’: 0, ‘Nitrogen’: 3.605e+18, ‘Phosphates’: 0, ‘Sulfur’: 0, ‘Protein’: 0, ‘Nucleotide’: 0, ‘Ammonia’: 0, ‘Glucose’: 0}
Ocean = {‘Amino Acids’: 0, ‘DNA’: 0, ‘ATP’: 0, ‘Oxygen’: 0, ‘Carbon Dioxide’: 1.4e+20, ‘Pyruvate’: 0, ‘Hydrogen Sulfide’: 0, ‘Water’: 1.12e+21, ‘Agents’: 0, ‘Fat’: 0, ‘Nitrogen’: 2.8e+20, ‘Phosphates’: 1.4e+20, ‘Sulfur’: 0, ‘Protein’: 0, ‘Nucleotide’: 0, ‘Ammonia’: 0, ‘Glucose’: 0}
Lithosphere = {‘Amino Acids’: 0, ‘DNA’: 0, ‘ATP’: 0, ‘Oxygen’: 0, ‘Carbon Dioxide’: 5000000000.0, ‘Pyruvate’: 0, ‘Hydrogen Sulfide’: 5000000000.0, ‘Water’: 0, ‘Agents’: 0, ‘Fat’: 0, ‘Nitrogen’: 0, ‘Phosphates’: 0, ‘Sulfur’: 0, ‘Protein’: 0, ‘Nucleotide’: 0, ‘Ammonia’: 0, ‘Glucose’: 0}
Spectrum on the surface = [redacted spectrum]
[Finished in 2.3s]


Excellent work! It’s so exciting imagining this being used in the actual gameplay.

  1. It should be one of the starting options for the player, since it basically is a timeframe for them to reach the Space Stage and colonize other planets. I think it should be possible for the player to also turn off the possibility of their star burning out, so that they have unlimited time to play through the stages if they want.

  2. For the microbe stage, basically nothing else. For later stages, ideally nearby planets and/or moons should be generated, for example to populate the night sky. Meteor impacts and the likes can be randomized.

  3. I remember there was a big discussion on this on the old forums, and I should have saved the consensus because now I’ve forgotten. Basically, the idea was that on your first start up you have limited choice, but on future playthroughs (once you have reached ascension, or some other milestone) you can customize your starting planet to great detail.


I can’t find the thread I was looking for, but I think it’s worth having a discussion (separate thread if you’d prefer) to settle on what kind of options we want to present the player with for choosing their homeworld. For example:

Homeworld Type:

Satellites (If homeworld is a planet):

Satellite Number (If planet has moons)
-[Enter number]

Terrestrial to Aquatic Ratio:
-Fully terrestrial
-Mostly terrestrial
-Mostly aquatic
-Fully aquatic
-Not “Fully aquatic” (This option is here so that the player has a randomized amount of land, but no chance of no land and being stuck as an underwater civ with no metalworking)


Fork it, there’s enough of a difference between theory (simulation, procedural generation, etc) and gameplay concerns (unless they’re discussed in the context of how they restrict the model’s space) that we’re probably served better with separate threads.

  1. Mainly important as a proxy of how rich the protoplanetary disk is in metals. I think it can be broken down into two factors – how much of the elements there are that can be produced by fusion (the elements from Lithium through Zinc, though I think it’s mostly just the even ones); and then how much of the elements that require a nova or supernova or similar high-energy event to be created (everything else). So it makes a huge difference for the solar system, but not much at all for the star.
  2. We only need the star and planet right now. Additional stuff is plenty fun, and if you want to continue with more then I’d be happy to work with you, but yeah, I agree.
  3. Binary stars would most likely be orbiting in the same plane as the planets (really, it would have to be something crazy that happened to cause it to be otherwise); which means you’d get periodic dimming, the scale of which depends on how the stars compare in terms of size/brightness. You could have a large star with a brown dwarf companion, in which case the dimming is small and mainly due to the larger variation in distance between you and the primary star due to the fact that the primary star is not near the barycenter of the solar system. You could have two stars of similar size in which case you get a complete halving of brightness whenever one is eclipsed. All in all, generally not worth bothering with I’d say, as it either greatly shrinks the habitable zone or doesn’t affect enough to make it worth including right now.
  4. Plenty. Planet size, mass of the atmosphere, average temperature, and rotation rate are the main factors controlling how the atmospheric circulation breaks up into bands, which will affect ocean circulation and thus the microbe stage. We could do ok by handwaving this a bit though.
  5. Atmosphere amount and composition matter greatly. A certain amount of oxygen translates to a certain strength of the ozone layer, greenhouse gases greatly affect surface temperature, atmospheric surface pressure matters quite a bit for bodies of water, etc. Also, the starting atmosphere should be rich in oxygen (about 15-20%), since we assume the planet has already been oxygenated by cyanobacteria by the time microbe stage starts.
  6. We need to calculate this, though you could handwave it for now if you want.

For the points I didn’t answer, I either don’t have much to say or have too much to say and will say it later.

Random note: you probably don’t need to bother tracking the amount of amino acids, DNA, ATP, pyruvate, agents, fat, and phosphates in the atmosphere.

And now I’m reading your code, some notes:

  • we’ll need to use actual absorption spectrum data for ozone, oxygen, etc.
  • It might also be worth adding in the modulation that would happen due to the absorption/emission of light by the stellar corona/photosphere, though I’m not sure how much of a difference it makes (I’m pretty sure it explains most of the variance from pure blackbody radiation, just not sure how much of a difference that actually is).
  • All in all, I like it. Very cool.


@NickTheNick Yeah cool I agree with what you’re saying. Having to wait until the ascension stage to be able to edit your planet would require some heroic patience.


  1. Stellar Matallicity. Thing is the microbe stage doesn’t have any heavy elements. I think it only has N, H, O and C. I guess it will make a difference for awakening / civilisation and beyond.

  2. How much to generate. Yeah I think the best thing is to do the minimum now and then come back and improve it later. There’s still plate tectonics to think about and then aquatic locomotion for the multicellular stage which are important and urgent. (Well that’s Thrive type of urgent which means would be good to have something within 1 year).

7-9) Weather. Ok yeah I hadn’t thought about weather / ocean circulation. I’ll flesh that out a bit. I don’t think it’ll be that hard. Planetary mass -> radius, then add gas mass -> thickness of atmosphere -> spectrum calculations. Add rotation speed and the weather can be sorted out.

*) Keeping track of atmospheric DNA. Yeah I agree this isn’t worth much. My thinking was that it would be easiest to have all the bins be the same. So whether it is a species compounds free or a patch or the ocean or the atmosphere etc you always know it has all the same subdivisions for compounds. Then just make sure no DNA moves from the ocean to the atmosphere. Very happy for it to be implemented differently.

*) Absorption spectrum. I’ve already plugged in the right wavelengths from here it’s just the amount of absorption that isn’t set yet. That’s because it’s based on the depth / pressure of the atmosphere. I don’t think it’ll be so hard. I merged oxygen and ozone. The reason for this is that ozone exists because oxygen is floating in the atmosphere so you can’t have one without the other. We could keep track of the process, very happy to do that if you want, I’m just not sure it’s worth it.


Ok so I’ve been working a little bit on the size of the planets. I’m trying to put a lower bound on planet size and an upper bound on planet rotation speed. (Because basically you can’t live on a fast spinning asteroid). Code here.

My basic method has been about gas retention. So Jupiter is big enough to hold on to all gasses (including hydrogen and helium). The earth can hold everything bigger than N2 and mars is too small to hold even those heavier gasses (I think). So I ran the numbers:

Gas Velocity = Speed of planet spinning + root mean squared velocity of the gas (temperature = kinetic energy)

and if Gas Velocity > Escape velocity for that planet then that gas will escape. Heavier gasses move slower because their root mean squared velocity is slower (larger particles moving slowly have the same energy as smaller ones moving fast). I computed the radius from the mass assuming all rocky planets are the same density as the earth (and the earth is certainly the same density as the earth). Anyway I ran the numbers and, problem:

Radius of earth calculated = 6271188.60635 should be = 6370000.0
For the earth:
Escape Velocity = 11274.3903531 should be 11,200 ms^-1
Gas Velocity of Nitrogen = 525.508176299
Gas Velocity of Helium = 1390.36394642 should be 1390.
Surface Velocity = 456.053704976 should be 460 ms^-1

So all the numbers come out right at 310K (human body temperature), but the sum of the gas velocity of helium and the surface velocity is not nearly high enough to escape (which it should be). Anyone got any ideas? Improve the model? Take a percentage of the escape velocity? What may be happening is that 10% of the gas is fast enough to escape and once that has escaped the rest heats up more and the process repeats. Not sure. All input welcome.

This is what I was imagining it would be like, with Helium above escape velocity and nitrogen below, but this is for 20,000K (3x as hot as the surface of the sun).

Radius of earth calculated = 6271188.60635 should be = 6370000.0
For the earth:
Escape Velocity = 11274.3903531 should be 11,200 ms^-1
Gas Velocity of Nitrogen = 4220.983247
Gas Velocity of Helium = 11167.6719597
Surface Velocity = 456.053704976 should be 460 ms^-1


Oh man, it’s a complicated problem. If you take the integral of the maxwell-boltzmann distribution, you can get the proportion of particles of a specific gas at a specific height in the atmosphere that could escape if there were no particles above for them to collide into. What you’d have to do to correct for that is to do this calculation at a height high enough for an appreciable amount of those escape-velocity-particles could actually escape (ie, a height where the mean free path is long enough, though I’m not sure what is enough).

Luckily, I think that most of the parameters involved in such a calculation could be boiled down into some constants and leave us with a simple equation dependent mainly on surface temperature (which, I’m pretty sure, makes a much bigger difference than rotation).

What I htink would really happen with a very-quickly-rotating planet is that the atmosphere would equilibriate to mainly sit around the equator, with minimal atmosphere (hell, minimal ocean) farther away. That’s clearly enough to completely destroy any models we might have, so I don’t think gas retention will work as an upper limit on rotation. Gas retention is still very useful for atmospheric calculations, though, so keep at it if you want.


Ok so I think I’ve got to a reasonable place, here’s the reasoning.

The smallest a planet can be is one that can hold onto Nitrogen gas in it’s atmosphere. Therefore we are interested in the proportion of the gas that is above the escape velocity in the Maxwell-Boltzmann distribution (thanks @Moopli ). So I went through for a few planets in our solar system and calculated that gas fraction for that planet size (importantly at 310K not that planets temperature, our planets will always be in the habitable zone). You can see the results below.

Then I arbitrarily chose a value for capture. I chose that if less than 1 x 10^-100 of your gas is at escape velocity then your planet can hold the gas. You can see for the earth that puts it at the level where it can hold on to Nitrogen but not Helium whereas Jupiter can hold both and Mars neither. Then I computed the value of the escape velocity and therefore the radius and mass of the planet which would be required to have this gas fraction. As you can see it gives a value 64% the radius of the earth and 26% of it’s mass. (It’s still 2.4x the mass of mars). I think this is a reasonable lower bound for planet size. (Interestingly I was getting tired of this so I was thinking of just plucking 1/3rd of the mass of the earth out the air so, in a way, this was a lot of noise and thunder to end up where I started).

I think we should just disregard all this calculation and just use the lower bound without justification.

Anyone got any ideas for upper bound of planet mass? Is it, interestingly, where it’s big enough to hold on to hydrogen and helium? (Would that make it a gas giant and therefore too dark at the surface for life? Would we want to allow hydrogen sulfide vents on the surface of a planet like that with a super thick atmosphere?) What about planets 10x the size of their star? All interesting. Code in the repo.

– output ----

Radius of earth calculated = 6271188.60635 should be = 6370000.0

For the earth:
Escape Velocity = 11274.3903531 should be 11,200 ms^-1
Gas Velocity of Nitrogen = 525.508176299
Gas Velocity of Helium = 1390.36394642 should be 1390.
Surface Velocity = 456.053704976 should be 460 ms^-1

Maxwell Boltzmann at 310K for different planets. (%age of the gas that is moving at the escape velocity for that planet)

Mercury, Nitrogen: 2.40841031263e-44
Mercury, Helium: 1.8249611378e-08

Earth, Nitrogen: 4.29927333963e-300
Earth, Helium: 2.79189796366e-44

Mars, Nitrogen: 2.31651094149e-68
Mars, Helium: 9.8963297051e-12

Jupiter, Nitrogen: 0.0 (this is zero because it’s just too small for the computer to compute)
Jupiter, Helium: 0.0

Compute smallest planet:
Minimal value of escape velocity from temperature = 7140 ms^-1
Minimal planet radius = 4065942.54938 meters
Minimal planet mass = 1.5528927539e+24 kgs


So I did the opposite calculation, what is the largest planet that doesn’t hold on to Helium (as anything larger would be “too gassy”) and came out with.

Compute largest planet
Maximal value of escape velocity from temperature = 16140
Maximal planet radius = 9191080.21666
Maximal planet mass = 1.79373143543e+25

Which is 3x the mass of the earth which was again the figure I was going to pluck out the air. Anyone got any input about this or shall we just take these numbers?


Little bit more progress. I updated the planetary model with the new bounds for planet mass (very happy to change them if people have suggestions).

Now I’m working on how the atmosphere (whose depth can be calculated from the mass of the planet) attenuates the stellar specrtum. Two problems, first this page doesn’t have an example in the bottom section, which would be really nice, second the earth’s atmosphere blocks 100% of the energy at some frequencies, which is annoying as I can’t just scale that up and down with depth.


Note, water vapor is less massive than nitrogen, so the lower bound is actually higher than you previously calculated. Methane and ammonia, two other important compounds in the atmosphere of an early planet that might later produce life, are slightly lighter than water.

Another important lower bound is the size necessary to maintain a magnetic field strong enough to prevent the dissociation of all the atmosphere’s water/methane/ammonia/etc and subsequent loss of free hydrogen. This one isn’t so easy to figure out, but that gives us more room to fudge numbers if we decide to simplify.

As for upper bounds, those sound good, I think the effect of air pressure could be handled independently (for example, you might have a large planet with a thin atmosphere, or on the other hand, you might have a Venus or Titan).


Awesome. Good point about the water. Running it with that gives,

Compute smallest planet
Minimal value of escape velocity from temperature = 8900
Minimal planet radius = 5068191.6932
Minimal planet mass = 3.00757764473e+24

which is almost exactly 50% the mass of the earth.

With methane it gives

Compute smallest planet
Minimal value of escape velocity from temperature = 9440
Minimal planet radius = 5375699.95324
Minimal planet mass = 3.58891201193e+24

which is like 58%. Happy to use either.


On this point right now I’ve been assuming the planet should have the same mass of the atmosphere to total mass ratio as the earth, which is approx 8.62357669e-7, same with the oceans. Do you think this should be a variable? Like maybe allowing the planet to have twice that ratio of atmosphere or a half, something like that? If so what should the bounds be on that?


Made a little progress on the “light passing through the atmosphere” problem.

The toy model we are interested in is what happens when a ray of light passes through a box of dimensions 1x1xL meters along the long axis when the box is full of particles. What is the probability the ray will strike a particle? (In our case the box will be a column of air pointing at the sun from the planet and the light ray will be a photon of a specific spectrum, the particles will be the atmospheric gasses (everything will have to be done separately for each one.))

Anyway I ended up deriving the Beer-Lambert law for myself as the wikipedia page is full of jargon. Maybe that would be a good tag line for Thrive “Reinventing the wheel”, as that’s what I’ve done here. I think the answer is, the probability the ray makes it through the box is

exp(- percentage of a cross section of the box filled by one particle * number of particles)

Interestingly the length L doesn’t come into it as if you had a super dense gas in a box 1 meter long that would block the same amount of light as a super sparse gas in a box 100 meters long. It’s about number of particles only.

Here they talk about attenuation cross section and number density but it’s the same thing, I think. Anyway this is enough to finish the spectral calculations (as it’s possible to work out how much gas there is in the atmosphere -> how much gas is in the column -> how much of each light interacting particle (Nitrogen, Oxygen etc) -> what percentage of the light makes it past these particles). It can also be done for light under the sea.


Bit stuck. Basically I ran the model above for nitrogen on earth and got an exponent that is like 800,000,000 times too large. Which is close :slight_smile:

Anyway I’m thinking of just adding a fudge factor, as I think the model is good enough and I don’t want to go deeper into scattering. However in order to do this I need to know what percentage of the light the earths nitrogen blocks at different frequencies (and for other gasses as well). Basically it’s the charts on page 4 of this but in numerical format. It’s also annoying if it blocks 100% because then we have no idea how much too deep it is, you can’t scale 1/1.

Anyone got any input or shall I just bodge it with guessing?


Here is some guessed data for gas absorption in the earth’s atmosphere. This is then going to be used to work out a fudge factor, so the spectral cacluations come out right for the earth, which can then be used to extrapolate for other planets.

N2 :
Base = 0.5

Microns, Fraction Absorbed, Fraction of Base Absorbtion
0.05, 0.8, 1.6
0.05, 0.8, 1.6

O2 + O3:
Base = 0.5

0.15, 0.2, 0.4
0.20, 0.2, 0.4
0.25, 0.2, 0.4
0.30, 0.2, 0.4
0.35, 0.2, 0.4
0.40, 0.3, 0.6
0.45, 0.3, 0.6
0.50, 0.3, 0.6
0.55, 0.3, 0.6
0.60, 0.3, 0.6
0.65, 0.3, 0.6
0.70, 0.3, 0.6
0.75, 0.3, 0.6
0.80, 0.5, 1
0.85, 0.3, 0.6

1.05, 0.2, 0.4
1.25, 0.2, 0.4
1.60, 0.2, 0.4

Base = 0.5

0.05, 0.2, 0.4
0.10, 0.2, 0.4
0.15, 0.2, 0.4
0.20, 0.2, 0.4

0.60, 0.2, 0.4
0.65, 0.2, 0.4
0.70, 0.2, 0.4
0.80, 0.2, 0.4

0.95, 0.5, 1
1.10, 0.5, 1

1.35, 1 ,2
1.85, 1, 2

2.40, 1, 2
2.45, 1, 2

Carbon Dioxide:
Base = 0.5

1.40, 0.3, 0.6
1.50, 0.1, 0.2
2.00, 0.5, 1


I just did something cool which I thought you guys might like! I ran the planet generator to try and generate the earth, to see if the calculators were working correctly. The only things it sets are the mass of the sun and the radius of the earth, everything else is computed. Here’s the results, as you can see they are pretty good!

Created new main sequence star
Mass = 1 solar masses.
Life Span = 1.00e+10 of our years.
Luminosity = 3.85e+26 watts. should be 3.856e26!!
Radius = 6.96e+08 meters.
Temperature = 5777.62658506 Kelvin. should be 5778!

Created new planet.
Orbital radius = 1.48e+11 meters. should be 1.496e11!!!
Radius = 6.37e+06 meters.
Mass = 5.97e+24 kg.
Orbital period = 3.12e+07 seconds = 0.988059102892 earth years = 1 year for this planet.

Which, as you can see, is super close. I am very happy with the orbital radius, the habitable zone calculation put the earth in exactly the right place. By this model the earth is right in the middle of the habitable zone!

In other news this is the current solar spectrum generated for the earth

and this is what it should look like

So yeah some more work needed there! First part of the graph looks nice.

Edit: Posting this and this for reference because I should get around to reading it.


This is coming along great! Good job!