Discussion in 'Civ5 - Strategy & Tips' started by alpaca, Oct 8, 2010.

1. ### vexingknows

Joined:
Dec 24, 2010
Messages:
2,668
cool, nice find... finally a solid explanation of why you can go from 2 turns left to done on techs.

this sort of makes early exploration more important, especially on higher levels where the AI is gifted some early techs

2. ### snarzberryEmperor

Joined:
May 28, 2010
Messages:
1,240
Location:
New Zealand
yep, I'm glad that there is at least an explanation for it. That does my head in no end sometimes! I have this really intricate sequence of RA's signed to get me astronomy and steel after currency, chivalry and education and it's been buggered up a number of times because the UI indicates there are 2 or 3 (I've even seen 4) turns remaining to be researched on a specific tech only for it to be finished next turn. Many thanks for the reason, don't see why the discount can't be taken into account for the displayed info.

3. ### MouseyPoundsPrince

Joined:
Nov 8, 2010
Messages:
417
Location:
Maryland, USA
Now that the UI properly displays the adjusted tech cost, the research formula is easier to test. Civ5 does indeed divide by the total # of civs like DaveMcW suggested, but it also uses a 1/(1+x) relationship.

Given the following:
• B is the base cost of a tech; i.e. the XML cost with map size, handicap, and gamespeed modifiers already applied
• K is the number of known, living civs who have the tech.
• T is the total number of living civs in the game.
• M is the TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER global define (30 in unmodded game)
The adjusted tech cost, C is:
C = ceiling( B / ( 1 + floor( M * K / T ) / 100 ) )

or, prettier:

Some further examples are spoiled below.
Spoiler :

Prince, Huge, Standard speed game (1.3 modifier) with 12 civs.
Researching Gunpowder (B = 840 * 1.3 = 1092)
All civs still alive so T = 12.
Unmodded, so M = 30.

Here are the different costs for various numbers of known civs who have the tech:
Code:
```K    C
--  ----
0   1092
1   1071
2   1040
3   1021
4    993
5    975
6    950
7    934
8    910
9    896
10   874
11   860
12   840

Note that the last entry doesn't really matter since at
this point everyone in the game knows the tech.```
Now for a similar game but with a total of 22 civs instead of 12:
Code:
```K    C
--  ----
0  1092
1  1082
2  1071
3  1050
4  1040
5  1031
6  1012
7  1002
8   993
9   975
10  967
11  950
12  942
13  934
14  918
15  910
16  903
17  888
18  881
19  874
20  860
21  854
22  840```
Finally, in that same 22 Civ game researching Chemistry (B = 1404)
C is 1338 if everyone's alive and 4 known civs have it (K = 4 and T = 22)
C drops to 1325 if 3 of the civs that don't have it are killed (K=4 and T=19)
C increases back to 1338 if one of the civs that did have it is killed (K=3 and T=18)

4. ### vexingknows

Joined:
Dec 24, 2010
Messages:
2,668
i wonder if that was intended only for teams, given that it is called team modifier.

simplified an approximation is the tech cost multiplied by 1 / (1 + .3 * percent of known civs with tech)
if all civs are known and have it, it costs 23% less, if half know it costs 13% less... with standard's 8 civs, if 7 know, it's about 21% less

5. ### BungleChieftain

Joined:
May 14, 2011
Messages:
99
Location:
Norway
I have something for you math buffs to look at

Continued from this thread: Can anyone figure out what determines a City State's beakers per turn?

Joined:
Apr 3, 2004
Messages:
12,316
7. ### DaveMcWDeity

Joined:
Oct 8, 2002
Messages:
6,489
(x-1)^2 * 9 + 25

8. ### vexingknows

Joined:
Dec 24, 2010
Messages:
2,668
it's the same as before, the multiplier changed to 3, the exponent 2.01

floor( 25 + ( 3 * ( policy number - 1 ) ) ^ 2.01 * (1 + number of cities policy cost mod * ( number of cities - 1 ) / 100 ) * policy percent handicap modifier * game speed culture percent * (100 - cristo redentor + piety finisher reductions) / 100 / 5 ) * 5

number of cities policy cost mod is 15 base, 10 with representation, lower with larger than standard map sizes
policy percent handicap modifier is .5 on settler, .67 on chieftain, .85 on warlord
game speed is .67 on quick, 2 on epic, 3 on marathon
cristo + piety finisher are 10 each if you have them

the floor( x / 5) * 5 is just to round down to the nearest 5

9. ### TyfoonTurkWarlord

Joined:
Feb 7, 2011
Messages:
250
So is the mulitplier 9 (DaveMcW) or 3 (vexing)?

EDIT: Oh i see now 9=3^2

10. ### KrikkitTwoImmortal

Joined:
Apr 3, 2004
Messages:
12,316
Is that still current?

11. ### vexingknows

Joined:
Dec 24, 2010
Messages:
2,668
it's based on some numbers in the defines.xml file which have changed
the base city growth is still 15,
city growth multiplier is 8,
city growth exponent is 1.5

Joined:
Oct 29, 2010
Messages:
82
13. ### vexingknows

Joined:
Dec 24, 2010
Messages:
2,668
this isn't really appropriate for number crunching thread, and there is a post on it in bug reports. it's 2^31 / 10000 = 214748 beakers, standard integer overflow.
if you're making a mod i'd just lower all research costs and gains considerably, since fractional parts are kept

14. ### cryptcChieftain

Joined:
Oct 29, 2010
Messages:
82
Sorry *is such a newb on this forum*

Thank you though

15. ### ShahJahanIIHomesick Alien

Joined:
Jul 19, 2011
Messages:
1,863
Location:
Austin, Texas
Here is a mathematical question.

In real life, if you flipped a coin 5 times and the first 4 flips got you a heads what would be the chance of getting tails on the next flip?

But, Rene Descartes mentioned in one of his books that you are more likely to get a tails on the next flip.

How does this relate to civ?

If you get super lucky with your capital and have 4 different luxuries, are you less likely to find resources further away from your capital?
This was mentioned in one of wainy's Bab2lon LPs.

16. ### KrikkitTwoImmortal

Joined:
Apr 3, 2004
Messages:
12,316
Well Decartes was wrong about coins... BUT he would be right about civ, because AFAIK the game doesn't treat each tile individually (like coin flips)

17. ### KiffeLesBifflesDo you like dogs?

Joined:
Apr 18, 2011
Messages:
385
Location:
Paris
When you flip coin, you suppose the indepandance of the 5th times compare to the 4 previous flip, which is correct.

With Civ, I bet "Find resources further away from your capital" is not independant from "have 4 different luxuries in your cap". I don't know how they distribute lux in space, but it cant be totaly random.

BTW, i never had 4 lux in my cap in random map.

Joined:
Jan 28, 2011
Messages:
4,554
it depends on your inference point.

If you're saying that you'd flip a coin 5 times and get heads the first four times, THEN flip the coin and get tails - of course it's less than 50%. H*H*H*H*T

If however, you took it at the point of "What will the next flip give?" there's only 2 answers, and every flip before it didn't count, so it's 50%.

As per the actual question:

Yes it's more like to see 'more of the same' lux's, if you had a 4 unique lux start, than many new ones. Especially if they were calendar or trapping resources, which tend to come in clusters spread over a wide area.

You can find more 'unique' luxs, but they'd be few and far between. (the game seems to 'spray' an area with a lux type)

19. ### KrikkitTwoImmortal

Joined:
Apr 3, 2004
Messages:
12,316
Well chance of H*H*H*H*T is Exactly equal to the chance of H*H*H*H*H

but Both of those are less than 50% [/tangent]

20. ### robal1991Chieftain

Joined:
May 2, 2011
Messages:
74
Location:
Poland
Do you know the formula for the city strenght?
Or at least what and in what way affects the city strenght?