Terraforming Costs (advanced)

Terraforming Costs (advanced); support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Terraforming Costs (advanced)

Post by Gowron »

This is the in-depth information for terraforming costs, see
viewtopic.php?f=157&t=58
for the basics :)


-------------------------------------------------------------
-------------------------------------------------------------


First of all, I've found a very useful global multiplier for terraforming costs. It's located in trek.exe, starting position 0x0017d3c8, length 4 bytes. The default value is 0.1, and this leads to the expanded formula:

[terraforming cost] = 10 * [global multiplier] * [planet's population capacity] * ( [planet type coefficient] + [planet atmosphere coefficient] )

If the sum of the 2 coefficients is 0 or negative AND the planet's atmosphere is "oxygen rich" or "thin oxygen" (maybe also "none", but there's no way to test it yet), then the planet does not need to be terraformed at all, and it's class letter will appear green on the system screen.

In all other cases, the result of the expanded formula is cut at the decimal point and then taken modulo 65536 so that it's within the interval [0 ; 65535]. This can make the planet "green" by accident (if it hits 0), regardless of atmosphere.

I've found the coefficients for all atmosphere types except "none" in trek.exe:


coefficient for "thin oxygen" atmosphere
starting position: 0x0017d3a8
length: 8 bytes
default value: -1.0

coefficient for "sulfuric" atmosphere
starting position: 0x0017d3b0
length: 8 bytes
default value: +1.25

coefficient for "rich oxygen" atmosphere
starting position: 0x0017d3b8
length: 8 bytes
default value: -1.5

coefficient for "methane" atmosphere
starting position: 0x0017d3c0
length: 8 bytes
default value: +1.5


I haven't found the planet classes' coefficients yet, also the coefficient for atmosphere type "none" is missing. It's 1.0 by default, so maybe it's not stored at all.
Last edited by Gowron on Sat Sep 27, 2008 8:03 pm, edited 1 time in total.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Update:

Indeed, the coefficient for atmosphere type "none" is not stored explicitly, but instead it's implemented this way (position 0xAF42C):

Code: Select all

D9E8    // fld1
DEC1    // faddp
It could still be changed, for example by sharing a coefficient with another atmosphere type.


The coefficients for the planet classes have not been able to hide ;)
Here they come (all stored as 4-byte floats):

Code: Select all

planet typeaddressdef. value
arctic......0xAF348..8.0
barren......0xAF3B6..10.0
desert......0xAF3C3..7.0
jungle......0xAF3DE..6.0
oceanic.....0xAF3EE..4.0
volcanic....0xAF40C..12.0
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

Good work as always gowron thanks for the info :-)
Last edited by Peter1981 on Wed Jan 28, 2009 7:57 am, edited 1 time in total.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

DOT wrote:Result: terraforming lasts nearly as long as in plain vanilla, but when colonising a planet there are the increased numbers of buildings.
If you only want to change the number of buildings (and/or the initial population), then you can do so directly, without the detour via terraforming costs :)

http://armadafleetcommand.com/onscreen/ ... topic&t=64
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

DOT wrote:You know, maybe I understand some basic assembler codes, but 32bit register were introduces after i quit programming.
So, can you translate the information of your link to me and all the others? Would be great... :-)
You don't need assembler knowledge for this, it's just basic hex editing. Open trek.exe and go to position 0x18E2B8, and you'll find this data table:

Code: Select all

0A 00 00 00 01 00 00 00 00 00 00 00   // CS production = 0
0A 00 00 00 02 00 00 00 00 00 00 00   // CS production = 1
14 00 00 00 02 00 00 00 01 00 00 00   // CS production = 2
14 00 00 00 03 00 00 00 01 00 00 00   // CS production = 3
There's a 12-byte data group for each CS production level.
For example, with production=1 we have

Code: Select all

0A 00 00 00 02 00 00 00 00 00 00 00
The first value, 0A000000, means 10(dec). This is the starting population. Note that your colonies will still seem to start at pop 11, since they already grow during the turn at which they're founded. Also note that this should always be a multiple of 10(dec), otherwise auto-assigning workers to buildings (when the system grows) will be bugged.

The second value, 02000000, means 2(dec). It's the number of farms that the system gets for free. The third value, 00000000, is the number of "free" factories (none in this case).

All of these values can be edited directly with a hex editor :)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
Post Reply

Return to “Terraforming Costs (advanced)”