The Number Crunching Thread

Any number crunching been done on combat?
Like the damage expected when there is a certain Strength ratio?

I don't think so. I'm not sure the in-game display works correctly. From the XML I can tell you that a unit attacking another unit with the same strength should deal between 4 + 0-3 damage and a ranged unit 2.5 + 0-2

As for the rest, the formulas are hardcoded and there's no hint in the xml what happens when units are not of the same strength.
 
That said, I was wondering if anyone could put some of these calculations together into spreadsheets for relative ease of use to calculate some of the costs. I'm specifically thinking about something where you could input or just cross-reference the number of social policies you have with the number of cities you have founded/annexed to determine when you'll next be getting an additional SP.

Try this.View attachment SocialPolicyCalculator.rar
 
Here's a big table of my own:

Code:
	k = 0	1	2	3	4	5	6	7	8	9	10	11	12	13	14	15	16	17	18	19	20	21	22	23	24	25	26	27	28	29	30
n = 1	25	45	90	160	245	345	465	595	745	905	1075	1260	1460	1670	1890	2120	2365	2620	2885	3160	3445	3745	4050	4365	4690	5025	5370	5725	6090	6465	6845
2	30	55	120	205	320	450	605	775	970	1175	1400	1640	1900	2170	2460	2760	3075	3405	3750	4110	4480	4865	5265	5675	6100	6535	6985	7445	7920	8405	8900
3	40	70	145	255	395	555	745	955	1190	1445	1725	2020	2335	2670	3025	3395	3785	4195	4620	5060	5515	5990	6480	6985	7510	8045	8595	9165	9745	10345	10955
4	45	85	175	305	465	660	885	1135	1415	1720	2050	2400	2775	3175	3595	4035	4500	4980	5485	6010	6550	7115	7695	8295	8915	9555	10210	10885	11575	12280	13010
5	55	100	205	350	540	765	1025	1315	1640	1990	2370	2780	3215	3675	4160	4670	5210	5770	6350	6955	7585	8240	8910	9605	10325	11060	11820	12600	13400	14220	15065
6	60	115	230	400	615	870	1165	1495	1865	2265	2695	3160	3655	4175	4730	5310	5920	6555	7215	7905	8620	9360	10125	10920	11730	12570	13435	14320	15230	16160	17115
7	70	125	260	450	690	975	1305	1675	2085	2535	3020	3540	4090	4680	5295	5945	6630	7340	8085	8855	9655	10485	11345	12230	13140	14080	15045	16040	17055	18100	19170
8	75	140	285	495	765	1080	1445	1855	2310	2805	3345	3915	4530	5180	5865	6585	7340	8130	8950	9805	10690	11610	12560	13540	14550	15590	16660	17755	18885	20040	21225
9	85	155	315	545	835	1185	1585	2035	2535	3080	3665	4295	4970	5680	6430	7220	8050	8915	9815	10755	11725	12735	13775	14850	15955	17100	18270	19475	20715	21980	23280
10	90	170	345	595	910	1290	1725	2215	2760	3350	3990	4675	5405	6180	7000	7860	8760	9700	10685	11705	12760	13855	14990	16160	17365	18605	19885	21195	22540	23920	25335
11	100	180	370	640	985	1395	1865	2395	2985	3620	4315	5055	5845	6685	7570	8495	9470	10490	11550	12650	13795	14980	16205	17470	18775	20115	21495	22915	24370	25860	27390
12	105	195	400	690	1060	1500	2005	2575	3205	3895	4635	5435	6285	7185	8135	9135	10180	11275	12415	13600	14830	16105	17420	18780	20180	21625	23110	24630	26195	27800	29445
13	115	210	425	740	1135	1605	2145	2755	3430	4165	4960	5815	6725	7685	8705	9770	10895	12065	13280	14550	15865	17230	18635	20090	21590	23135	24720	26350	28025	29740	31495
14	120	225	455	785	1210	1710	2285	2935	3655	4440	5285	6195	7160	8190	9270	10410	11605	12850	14150	15500	16900	18350	19850	21400	23000	24640	26330	28070	29850	31680	33550
15	130	235	485	835	1280	1815	2425	3115	3880	4710	5610	6575	7600	8690	9840	11045	12315	13635	15015	16450	17935	19475	21070	22710	24405	26150	27945	29790	31680	33620	35605
16	135	250	510	885	1355	1920	2570	3295	4100	4980	5930	6950	8040	9190	10405	11685	13025	14425	15880	17395	18970	20600	22285	24020	25815	27660	29555	31505	33505	35560	37660
17	145	265	540	930	1430	2025	2710	3475	4325	5255	6255	7330	8475	9690	10975	12320	13735	15210	16750	18345	20005	21725	23500	25330	27220	29170	31170	33225	35335	37500	39715
18	150	280	565	980	1505	2130	2850	3655	4550	5525	6580	7710	8915	10195	11540	12960	14445	15995	17615	19295	21040	22845	24715	26645	28630	30675	32780	34945	37165	39440	41770
19	160	290	595	1030	1580	2235	2990	3835	4775	5795	6905	8090	9355	10695	12110	13595	15155	16785	18480	20245	22075	23970	25930	27955	30040	32185	34395	36665	38990	41380	43825
20	165	305	625	1075	1650	2340	3130	4015	5000	6070	7225	8470	9795	11195	12680	14235	15865	17570	19345	21195	23110	25095	27145	29265	31445	33695	36005	38380	40820	43320	45880
21	175	320	650	1125	1725	2445	3270	4195	5220	6340	7550	8850	10230	11700	13245	14870	16575	18360	20215	22145	24145	26220	28360	30575	32855	35205	37620	40100	42645	45255	47930
22	180	335	680	1175	1800	2550	3410	4375	5445	6615	7875	9230	10670	12200	13815	15510	17285	19145	21080	23090	25180	27340	29575	31885	34265	36710	39230	41820	44475	47195	49985
23	190	345	705	1220	1875	2655	3550	4555	5670	6885	8200	9605	11110	12700	14380	16145	18000	19930	21945	24040	26215	28465	30790	33195	35670	38220	40845	43540	46300	49135	52040
24	195	360	735	1270	1950	2760	3690	4735	5895	7155	8520	9985	11550	13200	14950	16785	18710	20720	22815	24990	27250	29590	32010	34505	37080	39730	42455	45255	48130	51075	54095
25	205	375	765	1320	2025	2865	3830	4915	6115	7430	8845	10365	11985	13705	15515	17420	19420	21505	23680	25940	28285	30715	33225	35815	38490	41240	44070	46975	49960	53015	56150
26	210	390	790	1365	2095	2970	3970	5095	6340	7700	9170	10745	12425	14205	16085	18060	20130	22290	24545	26890	29320	31835	34440	37125	39895	42750	45680	48695	51785	54955	58205
27	220	405	820	1415	2170	3070	4110	5275	6565	7970	9495	11125	12865	14705	16650	18695	20840	23080	25410	27835	30355	32960	35655	38435	41305	44255	47295	50410	53615	56895	60260
28	225	415	845	1465	2245	3175	4250	5455	6790	8245	9815	11505	13300	15210	17220	19335	21550	23865	26280	28785	31390	34085	36870	39745	42710	45765	48905	52130	55440	58835	62315
29	235	430	875	1510	2320	3280	4390	5635	7015	8515	10140	11885	13740	15710	17790	19970	22260	24655	27145	29735	32425	35210	38085	41055	44120	47275	50520	53850	57270	60775	64365
30	240	445	905	1560	2395	3385	4530	5815	7235	8790	10465	12265	14180	16210	18355	20610	22970	25440	28010	30685	33460	36330	39300	42370	45530	48785	52130	55570	59095	62715	66420
31	250	460	930	1610	2470	3490	4670	5995	7460	9060	10790	12640	14620	16710	18925	21245	23680	26225	28875	31635	34495	37455	40515	43680	46935	50290	53740	57285	60925	64655	68475
32	255	470	960	1655	2540	3595	4810	6175	7685	9330	11110	13020	15055	17215	19490	21885	24395	27015	29745	32585	35530	38580	41735	44990	48345	51800	55355	59005	62755	66595	70530
33	265	485	985	1705	2615	3700	4950	6355	7910	9605	11435	13400	15495	17715	20060	22520	25105	27800	30610	33530	36565	39700	42950	46300	49755	53310	56965	60725	64580	68535	72585
34	270	500	1015	1755	2690	3805	5090	6535	8130	9875	11760	13780	15935	18215	20625	23160	25815	28585	31475	34480	37600	40825	44165	47610	51160	54820	58580	62445	66410	70475	74640
35	280	515	1045	1800	2765	3910	5230	6715	8355	10145	12085	14160	16370	18720	21195	23795	26525	29375	32345	35430	38635	41950	45380	48920	52570	56325	60190	64160	68235	72415	76695
36	285	525	1070	1850	2840	4015	5370	6895	8580	10420	12405	14540	16810	19220	21760	24435	27235	30160	33210	36380	39670	43075	46595	50230	53980	57835	61805	65880	70065	74355	78745
37	295	540	1100	1900	2910	4120	5510	7075	8805	10690	12730	14920	17250	19720	22330	25070	27945	30950	34075	37330	40705	44195	47810	51540	55385	59345	63415	67600	71890	76295	80800
38	300	555	1125	1945	2985	4225	5650	7255	9030	10960	13055	15295	17690	20225	22895	25710	28655	31735	34940	38275	41735	45320	49025	52850	56795	60855	65030	69320	73720	78235	82855
39	310	570	1155	1995	3060	4330	5790	7435	9250	11235	13380	15675	18125	20725	23465	26345	29365	32520	35810	39225	42770	46445	50240	54160	58200	62365	66640	71035	75545	80170	84910
40	315	580	1185	2045	3135	4435	5930	7615	9475	11505	13700	16055	18565	21225	24035	26985	30075	33310	36675	40175	43805	47570	51455	55470	59610	63870	68255	72755	77375	82110	86965
41	325	595	1210	2090	3210	4540	6070	7795	9700	11780	14025	16435	19005	21725	24600	27620	30790	34095	37540	41125	44840	48690	52675	56780	61020	65380	69865	74475	79205	84050	89020
42	330	610	1240	2140	3285	4645	6215	7975	9925	12050	14350	16815	19440	22230	25170	28260	31500	34880	38410	42075	45875	49815	53890	58095	62425	66890	71480	76195	81030	85990	91075
43	340	625	1265	2190	3355	4750	6355	8155	10145	12320	14670	17195	19880	22730	25735	28895	32210	35670	39275	43025	46910	50940	55105	59405	63835	68400	73090	77910	82860	87930	93130
44	345	635	1295	2235	3430	4855	6495	8335	10370	12595	14995	17575	20320	23230	26305	29535	32920	36455	40140	43970	47945	52065	56320	60715	65245	69905	74705	79630	84685	89870	95180
45	355	650	1325	2285	3505	4960	6635	8515	10595	12865	15320	17955	20760	23735	26870	30170	33630	37240	41005	44920	48980	53185	57535	62025	66650	71415	76315	81350	86515	91810	97235
46	360	665	1350	2335	3580	5065	6775	8695	10820	13135	15645	18330	21195	24235	27440	30810	34340	38030	41875	45870	50015	54310	58750	63335	68060	72925	77930	83065	88340	93750	99290
47	370	680	1380	2380	3655	5170	6915	8875	11045	13410	15965	18710	21635	24735	28005	31445	35050	38815	42740	46820	51050	55435	59965	64645	69465	74435	79540	84785	90170	95690	101345
48	375	695	1405	2430	3725	5275	7055	9055	11265	13680	16290	19090	22075	25235	28575	32085	35760	39605	43605	47770	52085	56560	61180	65955	70875	75940	81150	86505	92000	97630	103400
49	385	705	1435	2480	3800	5380	7195	9235	11490	13955	16615	19470	22515	25740	29145	32720	36470	40390	44475	48715	53120	57680	62395	67265	72285	77450	82765	88225	93825	99570	105455
50	390	720	1465	2525	3875	5485	7335	9415	11715	14225	16940	19850	22950	26240	29710	33360	37185	41175	45340	49665	54155	58805	63615	68575	73690	78960	84375	89940	95655	101510	107510

Edit: Numbers fixed in respect to error in round/floor
 
Hmm.... this doesn't seem to line up with the calculations from the table here. It also doesn't seem to line up with a spreadsheet I have seen in this thread in the Hall of Fame section.

I checked it against my first five games and Alpaca's formula is accurate. I did round to the nearest five and this doesn't quite match. Alpaca did say, "rounded to the next multiple of 5," and I guess that means rounding up. There are more pressing things than chasing that five! When I first checked it I was confused by the count of social policies. The formula uses the number of the policy you are working on so that if you already have four, use '5' in the calculation.
 
I checked it against my first five games and Alpaca's formula is accurate. I did round to the nearest five and this doesn't quite match. Alpaca did say, "rounded to the next multiple of 5," and I guess that means rounding up. There are more pressing things than chasing that five! When I first checked it I was confused by the count of social policies. The formula uses the number of the policy you are working on so that if you already have four, use '5' in the calculation.

It's rounded down in the game, I think. Those 5 don't matter much, though, as you say.
 
But how many people read the wiki? :lol:

Here are the per-article visitor statistics. I'd say those are impressive figures. Also, the Top Referrers widget shows that Wikipedia has brought about 100 000 visitors to the wiki and Google has brought about 200 000 visitors. In general the more material we get there the more people will read it. What have you got to lose?
 
the good stuff also won't get buried under random comments or other threads but stays there in an accessible fashion.

Good point regarding the problem of this info getting buried. I certainly had trouble finding this thread until I was pointed in its direction by another forum poster.

Any chance the mods could sticky this incredibly helpful thread? This is some of the most fundamental/basic/core info for strategy in the game.
 
Good point regarding the problem of this info getting buried. I certainly had trouble finding this thread until I was pointed in its direction by another forum poster.

Any chance the mods could sticky this incredibly helpful thread? This is some of the most fundamental/basic/core info for strategy in the game.

With alpaca's permission I could of course also copy the content of this thread into the wiki where you'd find it more easily.
 
With alpaca's permission I could of course also copy the content of this thread into the wiki where you'd find it more easily.

Sure, I don't mind at all - I haven't updated things for the new patch, though
 
Interesting...



This is a pretty counterintuitive result. It means that, if you're getting zero culture from city states, then ANY increase in cities will reduce your time between policies, as long as cT is fixed. For example, even if all of your cities produce only 1 culture, adding a city will decrease your time, as long as the new city produces at least one culture and you're getting no culture from CSes.

[That's because cT is always positive, and pm is always greater than 0 and less than 1, so 1/pm > 1.]

For what it's worth, I differentiated the time function with respect to n, and found the exact same first-order condition, although I haven't checked my math closely yet. It's interesting that the condition doesn't depend on pB or n at all (except for the fact that pB must be positive).

I'd like to look at the derivative wrt n when cT is a function of n, but for now, it's time to play...

thats nothing new for me and the reason to get representation as fast as possible if i play liberty.
the problem is if you got temples in every city you reach a point where it costs so much gold for the fresh city to get 2 buildings that you cant do this without heavy disadvantages in other fields like military, science and co.

the next issue is, its important to know that puppets work like cC but its harder to see how much puppets really contribute at all to your culture output.
 
I have checked and confirmed that the new effects of Representation (according to the text, 33% reduction in the culture cost rise from founding cities) from the March patch (1.01.217) do reduce the current Culture cost of the next Policy. I have not yet been able to confirm how this is accomplished. My theory is that it applies retroactively to your existing cities. I think a simple test for this would be to start a new game, build no cities until after you build the Oracle in your only city (your capital) and check to see if it affects the culture cost of the next policy; if it does not affect it at all, then this would likely mean that the fact I see a reduction in the cost (using the Oracle's free policy as a simple test, since adopting that free policy does not trigger a normal new-policy rise in the cost of the next policy) is due to the Representation effect being applied retroactively to the cities you have already built (as opposed to only future cities you would build after adopting the policy).

Here is the progression of the Culture Cost of Next Policy in this game:

# Policies # Cities Culture Cost of Next Policy:
0 1 50
1 1 90
2 1 185
3 1 320
3 2 385
4 2 590
5 2 840
5 3 980
6 3 1310
7 3 1680
8 3 2095
8 4 2395
8 4 2080

(Sorry for the misaligned column titles; I'm too lazy to manually reformat from my spreadsheet). New cities were founded (as you can note) after the 3rd, 5th and 8th policy adoptions; the final row which decreased the culture cost of the next policy adoption by 315 points was the effect of adopting Representation from The Oracle's free policy adoption (which, since it is free, I did not ennumerate the policy count, though technically it is the 9th policy adoption).
 
I have checked and confirmed that the new effects of Representation (according to the text, 33% reduction in the culture cost rise from founding cities) from the March patch (1.01.217) do reduce the current Culture cost of the next Policy. I have not yet been able to confirm how this is accomplished. My theory is that it applies retroactively to your existing cities. I think a simple test for this would be to start a new game, build no cities until after you build the Oracle in your only city (your capital) and check to see if it affects the culture cost of the next policy; if it does not affect it at all, then this would likely mean that the fact I see a reduction in the cost (using the Oracle's free policy as a simple test, since adopting that free policy does not trigger a normal new-policy rise in the cost of the next policy) is due to the Representation effect being applied retroactively to the cities you have already built (as opposed to only future cities you would build after adopting the policy).

Here is the progression of the Culture Cost of Next Policy in this game:

# Policies # Cities Culture Cost of Next Policy:
0 1 50
1 1 90
2 1 185
3 1 320
3 2 385
4 2 590
5 2 840
5 3 980
6 3 1310
7 3 1680
8 3 2095
8 4 2395
8 4 2080

(Sorry for the misaligned column titles; I'm too lazy to manually reformat from my spreadsheet). New cities were founded (as you can note) after the 3rd, 5th and 8th policy adoptions; the final row which decreased the culture cost of the next policy adoption by 315 points was the effect of adopting Representation from The Oracle's free policy adoption (which, since it is free, I did not ennumerate the policy count, though technically it is the 9th policy adoption).

Representation just changes the cost multplier formula from
+30% per city (or +15% on huge)
to
+20% per city (or +10% on huge)

on your size map it takes a +20% and makes it a ~+13%
4 cities no rep= +60% extra
4 cities with Rep = +40% extra

Base cost of 9th policy=~1490
 
Something new to investigate. A given player (AI or human) will research a tech faster based upon how many civs that player knows who also have the tech. I first saw this while looking into a possible research bug that dshirk later confirmed is only a UI issue. I've quoted my post from that topic in the following spoiler.

Spoiler :
OK, further testing on this and another save indicates that there is a tech cost discount based (at least in part) upon how many known civs have that tech. Whether the bug is the discount itself or the fact that the UI doesn't properly account for it (because TeamTechs:GetResearchCost() doesn't include it) I don't know.

Here is the evidence for this, spoiled because it's kinda long-winded.
Spoiler :

I am using TeamTechs:GetResearchProgress() and Player:GetOverflowResearch() to calculate the true cost of techs. Ending the turn on the OP save will result in Scientific Theory being awarded with progress of 2599 and 199 overflow, so the true cost is 2400.

On this save, 4 AI civs (all known to the player) already have Scientific Theory and a 5th (Siam) is researching it but is only about 30% done. Because of tests on another game I am pretty confident that Siam's progress doesn't significantly affect the discount, but it's something to watch for if someone else feels like investigating it.

If we start from the OP save and take Scientific Theory away from everyone, China will switch to it and get it on the in-between turn. With only 1 known civ having Scientific Theory, it takes the displayed 2 turns for the player to get it, but the cost turns out to only be 2700. (2836 spent and 136 overflow)

Once again starting from the OP and taking Scientific Theory away from everyone, but this time also resetting China's progress will result in the tech costing the actual displayed value of 2808 since the player does not know anyone with it. (2836 spent and 28 overflow)

Going the other way and giving Scientific Theory to all 6 living AIs on the OP save results in a tech cost of only 2247. (2599 spent and 352 overflow)

Some things to note on the tech discount:
  • Only known civs count, which is part of why this is more noticeable in the later eras after you've met everyone.
  • The discount applies to everyone. The AIs get it too if they know other civs with the tech they are researching.
  • The discount appears to be affected by changes to the TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER global define (30 by default) but not by changes to the TECH_COST_KNOWN_PREREQ_MODIFIER global define. However I don't currently know the exact formula as there does seem to be something else with a minor influence.
  • A rough approximation is that it is 3-4% per known civ. Note that in the game from the OP the discount was about 3.85% when 1 known civ had the tech and nearly 25% when 6 known civs had it.



Unlike in Civ4, where the known civ modifier was a bonus to beakers produced, my testing indicates that in Civ5 it is a reduction in cost. I tested the same 13-turn tech where I knew all 7 AIs who had it from the very beginning and also where they didn't get it (and I didn't know them) until I had one turn to go -- in both cases the cost reduction was the same: a tech the UI indicated should cost 1188 instead cost 943.

Here are some more sample numbers on a 533 beaker tech:
0 known civs with tech -> cost 533
1 known civs with tech -> cost 518
2 known civs with tech -> cost 499
3 known civs with tech -> cost 481
4 known civs with tech -> cost 464
5 known civs with tech -> cost 452
6 known civs with tech -> cost 437
7 known civs with tech -> cost 424

So how much is the discount? Well, it is determined at least in part by the global define TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER (30 by default) and the numbers above do indicate approximately 3% per known civ. But the numbers don't exactly match either a Base*(1-.03k) or Base/(1+.03k) formula so there is either some complexity I haven't nailed down or some other modifier at play.

One further note is that TECH_COST_KNOWN_PREREQ_MODIFIER does not seem to have any effect and so common knowledge of prerequisite techs appears to not matter.
 
So how much is the discount? Well, it is determined at least in part by the global define TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER (30 by default) and the numbers above do indicate approximately 3% per known civ. But the numbers don't exactly match either a Base*(1-.03k) or Base/(1+.03k) formula so there is either some complexity I haven't nailed down or some other modifier at play.

In Civ4 the modifier was 0.3 * known_civs_with_tech / total_civs.

If you are taking your samples from different games, that might explain why it doesn't follow a straight line.
 
All the 533 tech samples were from the same game (8 total civs); I just reloaded and changed who else knew the tech through the console, then examined the beakers spent and overflow after the tech came in.
 
Top Bottom