Progress Update 2019-08-21
Again no build push, just another quick update. I've completed the bulk of the work for planet gen:
And it's not just the names and orbits that are generated, it also generates:
- Type (dwarf, terrestrial, gas, super jovian)
- density, radius, gravity, mass, escape velocity, tidal force, tidal lock, axial tilt
- length of day, length of year
- tectonic activity level
- magnetic field strength
- planet image
- base temperature
- surface temperature
- hydrosphere type, if any
- extent of hydrosphere
- total atm's of atmosphere, if any
- albedo
- greenhouse factor
- the amount and types of gases in the atmosphere
These aren't generated in isolation. There are interdependencies between all of these parameters combined with the parameters of the star it orbits. Atmospheres follow the same "laws of physics" that A4X follows (surface warming, gasses frozen or escaping the atmosphere, re-recalculating surface temperature). There was a very old but
super helpful post that helped me organize how things are done. Nearly all of the things described there are done in Q4X now.
I'm currently in the middle of a sort of statistical analysis phase. I think there might be some issues in the atmosphere generation, but to check that I first have to go back down through the layers of dependencies, starting with the age of the system itself and the types and orbits of the stars. I have a save file with 1000 SM Generated systems in A4X and a button to quickly generate 1000 systems on the Q4X side to compare the results for major statistical differences. I've already fixed three bugs that would probably never have been found by normal play.
The first bug I found was I had a 100 in my code whereas the world gen pdf (
http://sol.trisen.com/downloads/wg.pdf, chart 1.3.1) had a 200, resulting in all my stars being capped at half the distance from the primary star than they should have been. This leaves much less room for planets to form without being caught by another star's gravity, which in turn skews the planet generation toward warmer, non-gas planets, which finally affects the average generation of atmospheres.
The second bug I found was in the average number of stars per system (wg.pdf, page 4). I had a single '<' that should have been a '<=', resulting in about 0.02 fewer stars per system on average, again skewing the amount and types of planets generated.
The most recent bug was in the random roll for System Abundance (wg.pdf, chart 1.2.3)... how much "stuff" the system had to work with when it was first formed. I had a '*' in the random roll where I should have had a '+', resulting in an average of 1.5 lower abundance (total range is 2 to -3) than in A4X, which was the biggest impact of all. (Footnote, the A4X DB comes with a System Abundance table that seems to include the tweaks Steve made to improve average system quality.. nice!)
Each of these bugs was literally a change in one character each, and it had a huge impact on the spread of systems generated - while at the same time not being noticeable without comparing the averages across 1000 systems between A4X and Q4X. Bug #2, for example, resulted in over 50 fewer stars than expected. I personally never paid much attention to all the columns in the F9 page when I was playing A4X, but it's really cool and surprising to realize how every single stat has a significant rippling impact on the layout, distribution, and composition of the stars and planets in the system. I am of course saving all of the database queries for re-checking system generation in the future, for those times when someone is feeling really unlucky and thinks there's a bug
It's really nice to be catching and fixing this stuff now, and overall I'm pretty happy at how close I've otherwise come. I have a lot more checking of stats to do, and then its on to asteroids!