Author Topic: Need help with unit cost formula  (Read 1541 times)

0 Members and 1 Guest are viewing this topic.

Offline Nevill

Need help with unit cost formula
« 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

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?

Offline Yitzi

Re: Need help with unit cost formula
« Reply #1 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

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.

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

Man has killed man from the beginning of time, and each new frontier has brought new ways and new places to die. Why should the future be different?
~Col. Corazon Santiago 'Planet: A Survivalist's Guide'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 38.

[Show Queries]