City Strength from tech calculation bug

alpaca

King of Ungulates
Joined
Aug 3, 2006
Messages
2,322
Well I played around with these global defines a bit today:

<Row Name="CITY_STRENGTH_TECH_BASE">
<Value>5</Value>
</Row>
<Row Name="CITY_STRENGTH_TECH_EXPONENT">
<Value>2.0</Value>
</Row>
<Row Name="CITY_STRENGTH_TECH_MULTIPLIER">
<Value>2</Value>
</Row>

Let me make shorthands: n=# of researched techs, m=CITY_STRENGTH_TECH_MULTIPLIER, x=CITY_STRENGTH_TECH_EXPONENT, b=CITY_STRENGTH_TECH_BASE

The intended formula is likely something on these lines: m*(b*n/100)^x

What the game actually does is this: m*(b*(n+floor(n/3))/100)^x

That is, at n = 3 the game shifts the calculation to the correct value for n'=4 (at n=4 it shifts to n'=5 and so on), at n=6 n'=8. Here's a table in case that is unclear:

Code:
n	n'
1	1
2	2
3	4
4	5
5	6
6	8
7	9
8	10
9	12
10	13
11	14
12	16
13	17
14	18
15	20
16	21
17	22
18	24
19	25
20	26
21	28
22	29
23	30
24	32
25	33
26	34
27	36
28	37
29	38
30	40

So for vanilla values these are the defense contributions:
Code:
n	def
1.	0.005
2.	0.02
3.	0.08
4.	0.125
5.	0.18
6.	0.32
7.	0.405
8.	0.5
9.	0.72
10.	0.845
11.	0.98
12.	1.28
13.	1.445
14.	1.62
15.	2.
16.	2.205
17.	2.42
18.	2.88
19.	3.125
20.	3.38
21.	3.92
22.	4.205
23.	4.5
24.	5.12
25.	5.445
26.	5.78
27.	6.48
28.	6.845
29.	7.22
30.	8.
 
The intended formula is likely something on these lines: m*(b*n/100)^x

What the game actually does is this: m*(b*(n+floor(n/3))/100)^x

What if it does what it is supposed to do :p?
Could be, that exactly this intended to happen (not that it looks logical, or so).
 
This is why I wrote the correct formula is likely to be something else :rolleyes:

Anyways, it would be quite weird. Whyever would you want to favor every third tech you research by giving it an extra defense boost?

But maybe it is an easter-egg to check if someone finds the bug? I fail to come up with a reason why the mechanic should work like this accidentally...
 
Back
Top Bottom