Aurora 4x

C# Aurora => General Discussion => Topic started by: Norm49 on August 13, 2020, 12:18:19 AM

Title: Any terraforming calculator?
Post by: Norm49 on August 13, 2020, 12:18:19 AM
Dose any terraforming calculator was create for C# like we had in 4x? I know making a spreed sheet is not hard but i don't know the formula.

Thanks for you answer.
Title: Re: Any terraforming calculator?
Post by: Demonides on August 13, 2020, 08:58:16 AM
http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115
Title: Re: Any terraforming calculator?
Post by: Iceranger on August 13, 2020, 09:39:41 AM
There is one shared in the discord server.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 13, 2020, 12:06:33 PM
EDIT: Don't download this one. I've posted a better version (http://aurora2.pentarch.org/index.php?topic=11834.0) in the utilities section.

If you want a head start on making a spreadsheet, I've attached my own.
It gives optimal target atmosphere conditions from any given starting conditions (including race parameters), and also shows how long it will take (in "TFIyrs": Terraforming Installation Years) given your current tech level, admin bonus, and average commander bonus (EDIT: the commander bonus input fields are not factored in).
It also does some aggregating of mineral deposit data for reporting/reviewing purposes. Useful for deciding which bodies to mine next.
The second sheet calculates target water vapor pressure based on your terraforming rate (so that you don't waste time adding too much), and gives ETAs for finishing vapor, finishing other gases, and vapor evaporating.

There's probably far more here than you really want, but you can pare it down as you like.

The easiest way to get the data into the spreadsheet is to run a query against the database.
I've included the query on the third sheet if you'd like to do that.
DB Browser for SQLLite is the free tool I use.


DISCLAIMER:
This was designed for personal use, so expect it to contain some things that are not self-explanatory.
I'm happy to answer any questions.
And if you find any errors, I would love to know.
Title: Re: Any terraforming calculator?
Post by: Norm49 on August 13, 2020, 04:15:35 PM
shoormit fist thanks!

Butit do have a question. Dose your spreadsheet take in to consideration the change in temperature when ice melt?
Title: Re: Any terraforming calculator?
Post by: skoormit on August 13, 2020, 06:25:59 PM
shoormit fist thanks!

Butit do have a question. Dose your spreadsheet take in to consideration the change in temperature when ice melt?

It does not.
In fact, it can't, because the albedo change is randomized.
In practice, it's not a big problem. When you get the event log entry for it, just redo the calculation and adjust your Aestusium target.
Title: Re: Any terraforming calculator?
Post by: db48x on August 13, 2020, 08:33:20 PM
If you want a head start on making a spreadsheet, I've attached my own.
It gives optimal target atmosphere conditions from any given starting conditions (including race parameters), and also shows how long it will take (in "TFIyrs": Terraforming Installation Years) given your current tech level, admin bonus, and average commander bonus.
It also does some aggregating of mineral deposit data for reporting/reviewing purposes. Useful for deciding which bodies to mine next.
The second sheet calculates target water vapor pressure based on your terraforming rate (so that you don't waste time adding too much), and gives ETAs for finishing vapor, finishing other gases, and vapor evaporating.

There's probably far more here than you really want, but you can pare it down as you like.

The easiest way to get the data into the spreadsheet is to run a query against the database.
I've included the query on the third sheet if you'd like to do that.
DB Browser for SQLLite is the free tool I use.


DISCLAIMER:
This was designed for personal use, so expect it to contain some things that are not self-explanatory.
I'm happy to answer any questions.
And if you find any errors, I would love to know.

Thanks for uploading this; I must have wasted a couple of hours messing with it already. I've got a game with real stars and a sol start, but the query only returns any rows for the moons of Minerva, Sol's planet X. The query labels Minerva SOL-A19, so that seems ok, but SOL-A3 and so on are all missing.

Is there some condition in this query that limits what it returns data for?
Title: Re: Any terraforming calculator?
Post by: Iceranger on August 13, 2020, 10:01:07 PM
shoormit fist thanks!

Butit do have a question. Dose your spreadsheet take in to consideration the change in temperature when ice melt?

It does not.
In fact, it can't, because the albedo change is randomized.
In practice, it's not a big problem. When you get the event log entry for it, just redo the calculation and adjust your Aestusium target.

Based on Steve's reply, it is not randomized.

http://aurora2.pentarch.org/index.php?topic=11405.msg133033#msg133033

So at least one calculator considers that :)
Title: Re: Any terraforming calculator?
Post by: db48x on August 13, 2020, 11:28:04 PM
DISCLAIMER:
This was designed for personal use, so expect it to contain some things that are not self-explanatory.
I'm happy to answer any questions.
And if you find any errors, I would love to know.

I haven't found any errors, but I have made some small improvements. In R2C9 I added a percentage for the terraforming difficulty; it's just another multiplicative factor in R5C9: =R[-3]C*R[-2]C*(1+R[-1]C).

I made two changes to the formula for TFIy. First, I didn't give a score to any world where the final colony cost was greater than 4. Then, I made it show a 0.0 for any world which already has a colony cost of 0, so that the worlds that are finished sort to the top. It's more of a debugging aid than information the user really needs, but on the other hand it does give a nice baseline. The formula is =IF(RC[2]=0,0,IF(OR(RC[-2]=0,RC[89]=0,RC[2]<=RC[3],RC[3]>=4),"",RC[89]/_ATMPerTFPerYear*(RC[7]^2/_EarthDiam^2)))
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 07:07:36 AM
shoormit fist thanks!

Butit do have a question. Dose your spreadsheet take in to consideration the change in temperature when ice melt?

It does not.
In fact, it can't, because the albedo change is randomized.
In practice, it's not a big problem. When you get the event log entry for it, just redo the calculation and adjust your Aestusium target.

Based on Steve's reply, it is not randomized.

http://aurora2.pentarch.org/index.php?topic=11405.msg133033#msg133033

So at least one calculator considers that :)

Awesome! How did I miss that?
I'll be updating my sheet this morning...
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 07:12:34 AM
Thanks for uploading this; I must have wasted a couple of hours messing with it already. I've got a game with real stars and a sol start, but the query only returns any rows for the moons of Minerva, Sol's planet X. The query labels Minerva SOL-A19, so that seems ok, but SOL-A3 and so on are all missing.

Is there some condition in this query that limits what it returns data for?

The query is limiting results to only show what one race knows.
And it chooses the most recently created player race.

At least, that's the intent, and it works in my games.
If you send me your db I'll dig into it.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 07:31:08 AM
DISCLAIMER:
This was designed for personal use, so expect it to contain some things that are not self-explanatory.
I'm happy to answer any questions.
And if you find any errors, I would love to know.

I haven't found any errors, but I have made some small improvements. In R2C9 I added a percentage for the terraforming difficulty; it's just another multiplicative factor in R5C9: =R[-3]C*R[-2]C*(1+R[-1]C).

I made two changes to the formula for TFIy. First, I didn't give a score to any world where the final colony cost was greater than 4. Then, I made it show a 0.0 for any world which already has a colony cost of 0, so that the worlds that are finished sort to the top. It's more of a debugging aid than information the user really needs, but on the other hand it does give a nice baseline. The formula is =IF(RC[2]=0,0,IF(OR(RC[-2]=0,RC[89]=0,RC[2]<=RC[3],RC[3]>=4),"",RC[89]/_ATMPerTFPerYear*(RC[7]^2/_EarthDiam^2)))

Very nice, thanks for that.
I was considering playing with terraforming speed turned down on my next playthrough, so I suppose I would have gotten around to adding that as well.

I like those changes to TFIy.
When a blank could mean either "done terraforming" or "can't live here", the column is less useful than it could be.

You might want to consider showing 0.0 for colonies that are done terraforming even if they aren't a 0.0 colony cost.
My current race (which was created randomly) has tight gravity tolerances, which means I have had to colonize quite a few low-grav rocks. They can't get lower than 1.0.
And I've even colonized some places that can't be brought within temperature tolerance (because of low base temps and the 3.0 GHF limit). I'd also want these to be treated the same as the 0.0 col costs in the TFIy column.
Adding all that logic makes the formula a lot harder to parse, so I'd probably add a helper column out to the far right just to check for those conditions.

I'd want this column to treat those LG colonies at 1.0 the same as the normal-grav colonies at 0.0. Makes the formula a bit more convoluted.
Title: Re: Any terraforming calculator?
Post by: Froggiest1982 on August 14, 2020, 08:04:02 AM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 08:07:43 AM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 08:09:22 AM
A note for anyone using my spreadsheet:

The TFIy column does NOT take into account average ship commander bonus.
I mistakenly claimed it did so originally.
I will edit my post accordingly.
Title: Re: Any terraforming calculator?
Post by: db48x on August 14, 2020, 08:57:56 AM
The query is limiting results to only show what one race knows.
And it chooses the most recently created player race.

At least, that's the intent, and it works in my games.
If you send me your db I'll dig into it.

Hmm, I see that Earth and Minerva have different ParentBodyIDs; Sol has 0 and Minerva has 3234.
Title: Re: Any terraforming calculator?
Post by: Zincat on August 14, 2020, 09:40:54 AM
You should really post this in the utilies subforum skoormit XD

I will make use of this one, thank you.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 09:45:27 AM
The query is limiting results to only show what one race knows.
And it chooses the most recently created player race.

At least, that's the intent, and it works in my games.
If you send me your db I'll dig into it.

Hmm, I see that Earth and Minerva have different ParentBodyIDs; Sol has 0 and Minerva has 3234.

Ah-ha!
It appears that the default planets in Sol (i.e. not Minerva) are treated differently in the database.
They have a ParentBodyID of 0 rather than the ID of the star they orbit.

Since I don't start in Sol (I generate a random race in a random system), this hasn't affected me.

Give me a few minutes and I'll modify the SQL to account for Sol starts.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 10:03:31 AM
The query is limiting results to only show what one race knows.
And it chooses the most recently created player race.

At least, that's the intent, and it works in my games.
If you send me your db I'll dig into it.

Hmm, I see that Earth and Minerva have different ParentBodyIDs; Sol has 0 and Minerva has 3234.

Here's the fix:

Immediately after these lines:
Code: [Select]
inner JOIN
FCT_Star as str
on
str.StarID = ifnull(sb_parent.ParentBodyID,sb.ParentBodyID)

Insert these lines:
Code: [Select]
or
(
--special case for Sol
--default bodies in Sol (i.e. not Minerva) have a ParentBodyID of 0
--since we know that Sol is a single-star system, we can just take the star that matches the SystemID
ifnull(sb_parent.ParentBodyID,sb.ParentBodyID) = 0
AND
str.SystemID = sys.SystemID
)

Result should look like:
Code: [Select]
inner JOIN
FCT_Star as str
on
str.StarID = ifnull(sb_parent.ParentBodyID,sb.ParentBodyID)
or
(
--special case for Sol
--default bodies in Sol (i.e. not Minerva) have a ParentBodyID of 0
--since we know that Sol is a single-star system, we can just take the star that matches the SystemID
ifnull(sb_parent.ParentBodyID,sb.ParentBodyID) = 0
AND
str.SystemID = sys.SystemID
)

Let me know if anything still (or anything else) seems amiss.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 14, 2020, 10:33:33 AM
You should really post this in the utilies subforum skoormit XD

Good idea.
Done (http://aurora2.pentarch.org/index.php?topic=11834.0).
Title: Re: Any terraforming calculator?
Post by: db48x on August 14, 2020, 10:57:18 AM
Hmm, I see that Earth and Minerva have different ParentBodyIDs; Sol has 0 and Minerva has 3234.

Here's the fix:

Immediately after these lines:

Let me know if anything still (or anything else) seems amiss.

Yea, that did the trick:

Code: [Select]
SOL|SOL-A1|4.88|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0.0|2|0.38|0.0|Y|409.853449623052|1.7|0|0|0|0|0
SOL|Sa Mines|12.104|0|0|0|0|11883.3558456979|13462.1937193773|0|0|22150.4044423818|0|32938.9783726841|0|0|0|0|0.1|1.0|0|0|0.8|0|0.7|2.6|2.6|2.6|2.6|0.25|68.5515765344433|2|0.
91|0.0||299.896247619238|1.0|0|0|0|89.745|3.255
SOL|Earth|12.756|11.2671006080972|12.5101746805206|18.9365619478989|0|0|80.728888913854|0|122.963028564712|0|0|0|0.21|0.21|0.24|0|0|0.51|0|0.62|0|0|0|0|0.62|1.79|1.79|0.0|0.2
03691917478566|2|1.0|0.697191653829571||255.0|1.02318|0.2|0|0|0|0.8
SOL|SOL-A3M1|3.474|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0.0|10|0.1654|0.0|M|255.0|1.0|0|0|0|0|0
SOL|Mars|6.8|12629.2748993437|11324.7498165573|1997.53453245819|0|0|0|249.080349015484|0|0|0|0|0.6|0.1|0.8|0|0|0|0.9|0|0|0|0|1.5|2.4|2.4|2.4|0.0|27.505164680161|2|0.38|0.3333
80233670666||206.560700121407|1.03499048288813|0.100283125441885|0.369781450755004|0|0.000343087138326176|0.000258

Thanks!

Also, I made one other tweak that I forgot to mention. Real Stars universes frequently have star names from catalogs like HH Andromedea, or NN 3849. Therefore I changed the query so that the system and body names are abbreviated using substr(replace(sys.Name,' ',''),1,5). This skips the spaces and makes them a little longer, but they don't take too much extra space.
Title: Re: Any terraforming calculator?
Post by: Froggiest1982 on August 14, 2020, 03:22:10 PM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm

Thanks, I'll run a couple of tests
Title: Re: Any terraforming calculator?
Post by: Froggiest1982 on August 15, 2020, 09:29:22 PM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm

Thanks, it does work, now I am trying to figure how much water evaporates once ice melts ;D

it should be the resulting atm *20 - current hydrosphere based on the post, however all simulation I am running have somehow returned different figures.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 15, 2020, 09:42:42 PM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm

Thanks, it does work, now I am trying to figure how much water evaporates once ice melts ;D

it should be the resulting atm *20 - current hydrosphere based on the post, however all simulation I am running have somehow returned different figures.

We know that 0.5 atm of vapor = 20 hydro extent.
So the ratio of vapor atm to hydro is 1:40.
Multiply your equalization vapor atm by 40, and that should be how much hydro was turned into vapor.
Title: Re: Any terraforming calculator?
Post by: Froggiest1982 on August 16, 2020, 03:15:26 AM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm

Thanks, it does work, now I am trying to figure how much water evaporates once ice melts ;D

it should be the resulting atm *20 - current hydrosphere based on the post, however all simulation I am running have somehow returned different figures.

We know that 0.5 atm of vapor = 20 hydro extent.
So the ratio of vapor atm to hydro is 1:40.
Multiply your equalization vapor atm by 40, and that should be how much hydro was turned into vapor.

Thanks, I still believe something is wrong . The general calc for temperature on surface (base*albedo*gh factor) does also return different values than the one that should be after terraforming a planet.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 16, 2020, 09:12:03 AM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm

Thanks, it does work, now I am trying to figure how much water evaporates once ice melts ;D

it should be the resulting atm *20 - current hydrosphere based on the post, however all simulation I am running have somehow returned different figures.

We know that 0.5 atm of vapor = 20 hydro extent.
So the ratio of vapor atm to hydro is 1:40.
Multiply your equalization vapor atm by 40, and that should be how much hydro was turned into vapor.

Thanks, I still believe something is wrong . The general calc for temperature on surface (base*albedo*gh factor) does also return different values than the one that should be after terraforming a planet.

Post some specifics, if you can. I'll take a closer look.
Title: Re: Any terraforming calculator?
Post by: db48x on August 16, 2020, 04:31:18 PM
Here's my version with my modifications, in case anyone wants to build on them. In addition to what I've mentioned before, I moved the race data to it's own sheet, and changed the mineral score to take quantity into account as well as accessibility. I also pasted all the formulas down to row 9999, just because a few thousand planets had fallen off the end of the spreadsheet when I first started and I didn't want to have to expand it too often. If I knew of a way to make _all_ rows on that sheet have the same formulas and formatting, I'd use that instead.

Also, I'm sure there's a way to hook a spreadsheet directly to an sql database. I've never done it before, but I'm thinking about looking in to it.
Title: Re: Any terraforming calculator?
Post by: Froggiest1982 on August 16, 2020, 08:44:19 PM
Does anybody know how much water vapour we get into the atmosphere one the ice melts?

It should be the equalization pressure for the current total ATM and hydro extent.
From Steve's post (http://aurora2.pentarch.org/index.php?topic=8495.msg102115#msg102115):
Code: [Select]
Atmospheric Pressure * (Hydro Extent / 100) * 0.01 atm

Thanks, it does work, now I am trying to figure how much water evaporates once ice melts ;D

it should be the resulting atm *20 - current hydrosphere based on the post, however all simulation I am running have somehow returned different figures.

We know that 0.5 atm of vapor = 20 hydro extent.
So the ratio of vapor atm to hydro is 1:40.
Multiply your equalization vapor atm by 40, and that should be how much hydro was turned into vapor.

Thanks, I still believe something is wrong . The general calc for temperature on surface (base*albedo*gh factor) does also return different values than the one that should be after terraforming a planet.

Post some specifics, if you can. I'll take a closer look.

without going too far, just start a new game and look at Earth, then we terraform Luna (it's perfect because all settings are standard and either 0 or 1) and look at Mars.

Earth:
starting
atm pressure 1.000
GH factor 1.100
Albedo factor 1.023
Base Temperature (Kelvin) 255.000
Surface Temperature (Kelvin) 287.002* displayed
This supposed to be 286.951

Luna:
starting
atm pressure 0.000
GH factor 1.000
Albedo factor 1.000
Base Temperature (Kelvin) 255.000
Surface Temperature (Kelvin) 255.000

Goal
atm pressure 0.335
GH factor 1.051
Albedo factor 1.000
Base Temperature (Kelvin) 255.000
Surface Temperature (Kelvin) 268.112* displayed
*This supposed to be 268.005
Added 0.1 Oxy, 0.0179 Aestusium, 0.2173 Nitrogen

Mars:
starting
atm pressure 0.010
GH factor 1.007
Albedo factor 1.020
Base Temperature (Kelvin) 206.561
Surface Temperature (Kelvin) 212.112* displayed
this already supposed to be  212.167

Goal
atm pressure 0.334
GH factor 1.233
Albedo factor 1.035
Base Temperature (Kelvin) 206.561
Surface Temperature (Kelvin) 263.684* displayed
*This supposed to be 263.604
Remove Carbon Dioxide, Added 0.1 Oxy, added 0.2 Aestusium, adjusted to 0.0336 Nitrogen, adjusted to 20 Hydro
Title: Re: Any terraforming calculator?
Post by: skoormit on August 16, 2020, 09:32:59 PM

Earth:
starting
atm pressure 1.000
GH factor 1.100
Albedo factor 1.023
Base Temperature (Kelvin) 255.000
Surface Temperature (Kelvin) 287.002* displayed
This supposed to be 286.951
...

The values you see in the UI are rounded from the actual values in the database.
Earth's albedo is 1.02318.
With that value, the expected surface temp is 287.00199, which rounds to 287.002.
Title: Re: Any terraforming calculator?
Post by: Froggiest1982 on August 16, 2020, 09:57:16 PM

Earth:
starting
atm pressure 1.000
GH factor 1.100
Albedo factor 1.023
Base Temperature (Kelvin) 255.000
Surface Temperature (Kelvin) 287.002* displayed
This supposed to be 286.951
...

The values you see in the UI are rounded from the actual values in the database.
Earth's albedo is 1.02318.
With that value, the expected surface temp is 287.00199, which rounds to 287.002.

I see the problem is that I guess you can see the real full Albedo only in the database then. Thanks
Title: Re: Any terraforming calculator?
Post by: skoormit on August 17, 2020, 08:30:06 AM
Also, I'm sure there's a way to hook a spreadsheet directly to an sql database. I've never done it before, but I'm thinking about looking in to it.

It's a Sqlite database, which is a little bit harder to set up a connection to than a SQL Server database.
You need an appropriate ODBC driver (here's a free one that I use (http://www.ch-werner.de/sqliteodbc/)), and you need to use that driver to create an ODBC data source on your system, and then point Excel to that data source.
Title: Re: Any terraforming calculator?
Post by: Demonides on August 17, 2020, 08:55:08 AM
Any chance to transfer this shet to google docs ?. Some people don't have microsoft exel.
Title: Re: Any terraforming calculator?
Post by: skoormit on August 17, 2020, 09:14:54 AM
Any chance to transfer this shet to google docs ?. Some people don't have microsoft exel.

Sure. Here it is (https://docs.google.com/spreadsheets/d/1OujmsH8GaMLAv_kR1otmBGe7VlybB8dZVnpMvM4d-Hs/edit?usp=sharing).
I just imported it and spot checked it. I have not thoroughly tested it.
I wouldn't be surprised if some features are missing, but I expect the formulas should all be working.
Title: Re: Any terraforming calculator?
Post by: Demonides on August 17, 2020, 11:20:10 AM
Any chance to transfer this shet to google docs ?. Some people don't have microsoft exel.

Sure. Here it is (https://docs.google.com/spreadsheets/d/1OujmsH8GaMLAv_kR1otmBGe7VlybB8dZVnpMvM4d-Hs/edit?usp=sharing).
I just imported it and spot checked it. I have not thoroughly tested it.
I wouldn't be surprised if some features are missing, but I expect the formulas should all be working.
Big THX