Fucking magnets, how do they work?

This commit is contained in:
BirDt_ 2025-12-10 23:24:30 +08:00
parent 2a5cfc6443
commit 5bd7a17166

View file

@ -197,19 +197,37 @@ We also determine the planet's elemental composition - for the surface, we only
- For Water planets, we filter to elements that can be either solid or liquid for the surface temperature. - For Water planets, we filter to elements that can be either solid or liquid for the surface temperature.
- For Ice planets, we filter to solids only. - For Ice planets, we filter to solids only.
- For Gas planets, we filter to gasses only. - For Gas planets, we filter to gasses only.
We then look in the system abundance, and copy all elements that pass the above filters, with their percentage abundance in the system. The only exception is Silicon - if the planet class is Terrestrial, we set the percent of Silicon in the planet to 50%. We then look in the system abundance, and copy all elements that pass the above filters, with their percentage abundance in the system. The only exception is Silicon - if the planet class is Terrestrial, we set the percent of Silicon in the planet to anywhere from 20% to 50%.
Now for the copied elements and percentages, sorted by their percentage, we randomly determined the composition. The first and most abundant element of Terrestrial planets is Silicon. Otherwise, we pick a random element from the 5 most abundant elements and push it to the crust composition with a random range between 0.4 and 0.8 (if this is the first element selected) or 0 and 1.0 - the sum total of all currently selected elements. We do this anywhere between 1 and 10 times, to get the major crust composition. Now for the copied elements and percentages, sorted by their percentage, we randomly determined the composition. The first and most abundant element of Terrestrial planets is Silicon. Otherwise, we pick a random element from the 5 most abundant elements and push it to the crust composition with a random range between 0.4 and 0.8 (if this is the first element selected) or 0 and 1.0 - the sum total of all currently selected elements. We do this anywhere between 1 and 10 times, to get the major crust composition.
If the atmosphere class is not None, we also need to determine the planet's atmospheric composition. For this we filter to natural elements, and only those that are gasses given the surface temperature. If the atmosphere class is not None, we also need to determine the planet's atmospheric composition. For this we filter to natural elements, and only those that are gasses given the surface temperature.
Then we look in the system abundance, and copy all elements that pass the above filter. If the element is not a nonmetal and not a noble gas, we divide it's percent by it's atomic number * 10 - this makes it more unlikely for heavy elements to be part of the atmosphere. Then we look in the system abundance, and copy all elements that pass the above filter. If the element is not a nonmetal and not a noble gas, we divide it's percent by it's atomic number * 10 - this makes it more unlikely for heavy elements to be part of the atmosphere.
Then, we pick a random element from the 5 most abundant elements and push it to the atmosphere composition composition with a random range between 0.5 and 0.9 (if this is the first element selected) or 0 and 1.0 - the sum total of all currently selected elements. We do this anywhere between 1 and 10 times, to get the major atmospheric composition. Then, we pick a random element from the 5 most abundant elements and push it to the atmosphere composition composition with a random range between 0.5 and 0.9 (if this is the first element selected) or 0 and 1.0 - the sum total of all currently selected elements. We do this anywhere between 1 and 10 times, to get the major atmospheric composition.
Terrestrial, Metallic, and Ice planets can have oceans or other, smaller liquid bodies. There is a 22% chance that a planet will attempt to generate liquid bodies. Instead of searching for individual elements, we have specific molecules that can form oceans each with their own feasible temperature range. These are:
- Water - 273.15 to 373.15 Kelvin
- Nitrogen - 63.15 to 77.5 Kelvin
- Carbon Dioxide - 217.15 to 273.15 Kelvin
If the surface temperature does not fit within any of these ranges, the ocean fails to generate. Otherwise, we set the composition of the ocean as the percentage of the chemicals that make up each molecule.
*** Magnetic Field
With the composition determined, we can estimate the magnetic field strength, in Gauss, of the planetoid. We do this by first estimating the electrical conductivity of the elemental composition. To do this, we multiply the electrical conductivity in S/m for each element in the composition by the percent composition of that element, then sum all the resulting values. We can then calculate the magnetic field as ~sqrt((density * rotation rate in ms)/conductivity)~.
** Planetary Surface Generation
#+begin_quote
Colloquially known as having a fun time.
#+end_quote
Based off the various planet metadata calculated, we can create a chunk-based surface for each planet and populate it. If you know anything about spheres, or maps, you may know that it is very difficult to tesselate a spherical surface equally with the shapes one may usually consider for chunks (for gameplay purposes). Our chunks are triangular instead, because equilateral triangles can in fact tesselate a sphere equally.
** Limitations ** Limitations
- Elemental abundances are fully random beyond the top 10. - Elemental abundances are fully random beyond the top 10.
- Non-unary system generation is not implemented because I don't want to write the orbit math for it. - Non-unary system generation is not implemented because I don't want to write the orbit math for it.
- Only main sequence stars are currently generated. - Only main sequence stars are currently generated.
- Planetary orbits are circular, because I'm too lazy to do it otherwise. - Planetary orbits are circular, because I'm too lazy to do it otherwise.
- Volcanism is only based on tidal forces. - Volcanism is only based on tidal forces.
- Ocean composition possibilities are hardcoded.
- Ocean composition doesn't account for atmospheric pressure.
* FAQ * FAQ
** What does "semi-realistic" mean? ** What does "semi-realistic" mean?