Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Bug/Patch Discussion => Topic started by: Nevill on September 20, 2015, 05:16:51 PM

Title: Need help with unit cost formula
Post by: Nevill on September 20, 2015, 05:16:51 PM
Ok, so I am trying to create a spreadsheet to see how a given code in alphax.txt affects unit cost... and I am stuck.

This is is the topic I use as a base for calculations:
http://alphacentauri2.info/index.php?topic=3683.0;nowap (http://alphacentauri2.info/index.php?topic=3683.0;nowap)

However, let's take for example a 12-8-4 fission foil.
Quote
r: The unit's reactor value = 1
a: The cost of the unit's armor. = 8
A: The cost of the unit's armor, halved for sea units and multiplied by 2*r for air units. = 4
w: The cost of the unit's weapon or module. = 12
W: The modified cost of the unit's weapon or module; choose the modification as part of the proposal. = 12
C: The cost of the unit's chassis.  There will be an additional option to add the reactor cost for sea units and plus the bonus reactor-based speed (twice the reactor by default) for air units. = 4
S: The total cost of the unit's special abilities. = 0

Now let"s apply the formula.
Quote
Base cost is WX(A+C)/(2^(r+1)), rounding normally.

12*(4+4)/4 = 24 rows.
Quote
If C=1, divide by 2 (rounding down) and add 1. 

Does not apply.
Quote
If w>1 and a>1 and either it is a combat unit or the alternate form is not being used, add 1, and then another 1 if it is a land unit with C>1.

Only the first one applies, cost is now 25 rows.
Quote
If it is a non-probe-team sea unit, divide by 2, rounding up.

The cost is now 13 rows.
Quote
If it is an air unit, divide by 2, rounding down; if it is also a combat unit, divide by 2 again, rounding down.
Unless W=A=C=r=1, apply a minimum of (1.5)Xr, rounding up.
Now multiply by (S+4)/4, rounding normally.

Does not apply.

So the unit should cost 13 rows, right? But it costs 14 in-game. What am I missing?
Title: Re: Need help with unit cost formula
Post by: Yitzi on September 24, 2015, 08:10:10 PM
Ok, so I am trying to create a spreadsheet to see how a given code in alphax.txt affects unit cost... and I am stuck.

This is is the topic I use as a base for calculations:
http://alphacentauri2.info/index.php?topic=3683.0;nowap (http://alphacentauri2.info/index.php?topic=3683.0;nowap)

However, let's take for example a 12-8-4 fission foil.
Quote
r: The unit's reactor value = 1
a: The cost of the unit's armor. = 8
A: The cost of the unit's armor, halved for sea units and multiplied by 2*r for air units. = 4
w: The cost of the unit's weapon or module. = 12
W: The modified cost of the unit's weapon or module; choose the modification as part of the proposal. = 12
C: The cost of the unit's chassis.  There will be an additional option to add the reactor cost for sea units and plus the bonus reactor-based speed (twice the reactor by default) for air units. = 4
S: The total cost of the unit's special abilities. = 0

Now let"s apply the formula.
Quote
Base cost is WX(A+C)/(2^(r+1)), rounding normally.

12*(4+4)/4 = 24 rows.
Quote
If C=1, divide by 2 (rounding down) and add 1. 

Does not apply.
Quote
If w>1 and a>1 and either it is a combat unit or the alternate form is not being used, add 1, and then another 1 if it is a land unit with C>1.

Only the first one applies, cost is now 25 rows.
Quote
If it is a non-probe-team sea unit, divide by 2, rounding up.

The cost is now 13 rows.
Quote
If it is an air unit, divide by 2, rounding down; if it is also a combat unit, divide by 2 again, rounding down.
Unless W=A=C=r=1, apply a minimum of (1.5)Xr, rounding up.
Now multiply by (S+4)/4, rounding normally.

Does not apply.

So the unit should cost 13 rows, right? But it costs 14 in-game. What am I missing?


My guess is that you're not playing with unit cost code 0 (which is what's described there), but rather unit cost code 8 (the actual default, which uses the variant mentioned where sea units add reactor to chassis cost and air units add twice reactor).

Thus, instead of 12*(4+4)/4=24, you get 12*(4+5)/4=27.  Adding 1 and dividing by 2 then gives 14.
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 33 - 892KB. (show)
Queries used: 20.

[Show Queries]