Be warned, this topic is kinda technical

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

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

Good news, I've found the constants that are controlling the growth rates in trek.exe and can now give a more precise algorithm for the growth rate calculation.

The not-so-good news is that it's a bit more complicated since there are several constants involved, and not everything is linear.

I'll call the constants p, q, r, s, t, u, v, w.

p is not used in the calculations, but that seems to be a bug (see below).

All of the following values are stored in trek.exe.

p

start position: 0x0017db84

size: 8 bytes (double)

default value: 0.1

meaning: unknown/unused (probably meant to be the barrier multiplier for small planets)

I tried changing this value from 0.1 to 2000.0, but it didn't seem to have any effect.

q

start position: 0x0017db8c

size: 8 bytes (double)

default value: 0.1

meaning: quadratic multiplier for growth rates, barrier value for small planets

**warning: increasing this value will lower the max. accuracy of growth rates (see below)**

r

start position: 0x0017db94

size: 8 bytes (double)

default value: 0.001

meaning: linear multiplier for growth rates

s

start position: 0x0017db9c

size: 8 bytes (double)

default value: 1.5

meaning: growth rate multiplier for large planets

t

start position: 0x0017dba4

size: 8 bytes (double)

default value: 0.4

meaning: barrier value for large planets

u

start position: 0x0017dbac

size: 8 bytes (double)

default value: 0.2

meaning: barrier value for medium planets

v

start position: 0x0017dbb4

size: 8 bytes (double)

default value: 0.5

meaning: growth rate multiplier for small planets

w

start position: 0x0017dbbc

size: 4 bytes (float)

default value: 10.0

meaning: global multiplier

**Growth Rate Calculation Step by Step**

1. Determine planet class and atmosphere type and get the corresponding habitability value from habit.bin.

*If the habitability value is undefined, then the planet 's growth rate is now set to the substitute value (see below) according to the planet's size, and then proceed to step 6.*Else, proceed to step 2.

2. If the planet is part of a minor race starting system, multiply the habitability value by the minor race growth value from race.rst. Cut the result at the decimal point. If the cut result is zero, then the planet 's growth rate is now set to 0.0 (and in that case all further calculations are skipped). If that's not the case or if the planet is not part of a minor race starting system, proceed to step 3.

3. If the planet is large, multiply the result from step 2 by s. If the planet is small, multiply by v instead. Proceed to step 4.

4. Determine the planet's growth rate via the following formula:

[growth rate] = [max. population] * r * q * [result from step 3] * 10.0%

Proceed to step 5.

5. If the result from step 4 is lower than the barrier value (see below), it is replaced by the substitute value (see below). In any case, proceed to step 6.

6. Multiply by w.

Cut the result at the decimal point.

Then multiply by q.

*(thus, all possible growth rates are multiples of q; this is how q affects the max. accuracy)*

It is possible that the barrier value for small planets was originally meant to be p, and it was accidentally replaced by q. Since the default values for p and q are the same, maybe no one noticed the bug since it does not have any effect in the default setup.

**Substitute Values**

The substitute value also depends on the planet's size.

For small planets, it's

0.1

For medium planets, it's

0.2

For large planets, it's

0.4