How much beakers are YOU losing to integerrounding?

oyzar

Have quit civ/forums
Joined
Oct 7, 2006
Messages
6,923
Location
Norway
You thought losing beakers to rounding was abolished with warlords enabling cities to produce fractional beakers? Then you are sadly mistaken. It is possible to lose quite alot of beakers to not running 100/0 instead of 90/10 or whatever you lazy people are running. Say a situation that might not be too uncommon. You've met 8 people out of 15 in the early game, you know they all have bw on you when you start researching it. You just settled your second city which causes your total maintenance + upkeep cost to rise to a mighty -1. Your empire is making 12 commerce. How much beakers would you lose by running 90/10 for 12 turns compared to one turn of 0/100 then 11 turns of 100/0 ?

Check the spoiler for the answer:

Spoiler :
First you get a free beaker for having at least one city. Then you get civknowmodifiers. Since 8/15 have it you get 8/15*30=16% research bonus. Then you get 20% prereqmodifiers for knowing mining. In between everything there is integerrounding.

90/10 for 12 turns give:
int(12*.1)=int(1.2)=1gold
int(12*.9+1)=int(11.8)=11 beakers before mods
int(11*1.16)=int(12.76)=12 beakers after civknowmods
int(12*1.2)=int(14.4)=14 beakers after prereqmods
14*12=168 beakers
12-12=0 gold

0/100 for one turn gives
11 gold and 1 beaker(the free beaker)

100/0 for 11 turns gives
int(12+1)=13 beakers before mods
int(13*1.16)=int(15.08)=15 beakers after civknowmods
int(15*1.2)=int(18)=18 beakers after prereqmods
11*18=198 beakers
and cost you 11 gold(that you get from one turn of 0/100)

199-168=31 extra beakers you get
divided by 12 turns this is 31/12=2.5833 beakers lost per turn! that is 15.6% of the maximum beakers you get or 18.5% increase from the lazy aproach!



This is of course just one of many different situations where you can lose beakers due to integer rounding, but it is pretty huge early in the game...
 
I don't have the time to plough through the code at this point, but basically you're saying that it rounds down to the integer after applying each civ wide modifier? That would of course amplify the rounding losses slightly. The above example must be quite close to a worse case scenario at any point in the game though, and there is still the issue that this error doesn't increase as the civ expands.

This does seem a fundamentally stupid way of performing calculations though, so I am going to have to check this out with a few empirical tests before I come to any conclusions. The issue I always hit is that any benefit from 100/0 running is purely due to a fault in the mechanics of the game, not to any strategic element. That puts me off using it as much as the additional micromanagement.
 
Hmm. You're correct the difference is more pronounced than 1 beaker per turn, which suggests it is doing this stupid rounding - left over from the original Civ 4's lack of fractions?

Some of your numbers are a little off though. Running the above scenario in game, I get 168 beakers +13 gold from 90/10 and 188 beakers +12 gold from 100/0. Basically something's not quite right in your 100/0 calculations - it only gets 17, not 18 beakers per turn in that set up.

Thread you've linked is interesting, but the vast majority of it was written long before Warlords was released, so I wouldn't rely on it being correct in how it handles fractions.
 
I did some test runs with WB (giving me a second settler and and some AI Scouts near me for contact)

Its realy better to run 100/0 and 0/100 if you have low beakers, but its always less then 1 beaker per turn (test were 20 turns of researching)


And anyway: most of the time you pop gold in a hut, so you can research a long time with 100%. You will have to lower the slider with 3 or 4 cities, and then you will have a lot more then 12 commerce, maybe 30 odr 40, a loss of about 0,5 per turn is already negligible.
 
It worked just fine in my tests, i got 14 / 18 beakers in the given example... If you research writing with full prereq's in the given example you would lose 3.1 beaker per turn instead of the given 2.6
 
For clarification; in the 12 commerce per turn are you including the free beaker? Your calculations are a little ambiguous there as you seem to have plugged 12 commerce into the 90/10 case, but only assumed 11 commerce on the gold turn of the 100/0. I've put together the exact situation specified in the OP, and I'm only seeing 14/17.

I take your point though - it's still more than the supposed 1 beaker per turn max. The effect shouldn't magnify that much throughout the game.
 
100/0 is better regardless of rounding. It reduced the chances of an AI suddenly grabbing a tech you're researching while you've put beakers into it, and also if an AI or more AIs have it then you get the discount. Of course we're ignoring obvious building libraries and such in this discussion as well, but even just the "does the AI know this" bonus can be pretty material...
 
You're ignoring the 2.4 gold lost due to the 90/10 approach.
 
For clarification; in the 12 commerce per turn are you including the free beaker? Your calculations are a little ambiguous there as you seem to have plugged 12 commerce into the 90/10 case, but only assumed 11 commerce on the gold turn of the 100/0. I've put together the exact situation specified in the OP, and I'm only seeing 14/17.

I take your point though - it's still more than the supposed 1 beaker per turn max. The effect shouldn't magnify that much throughout the game.

You are paying one gold in maintenance... Also how many civs you've met and how many are total matters quite a bit... 12 commerce and 1 maintenance, nothing ambigious about that... the free beaker come in addition of course...
 
I usually run binary research until the late middle ages/the rennaisance. After that I can live with whatever my lazy habits cost me. ;)
 
oyzar said:
You are paying one gold in maintenance...

OK, so you're taking that off in the middle of the calculations. I was just taking the simpler approach of running it for 12 turns, and checking how many beakers had been generated and the net change in the treasury. It isn't really that relevant where the gold goes.

Also how many civs you've met and how many are total matters quite a bit... 12 commerce and 1 maintenance, nothing ambigious about that... the free beaker come in addition of course..

But I set it up with the 8 of 15 civs as specified. I'm just curious why this isn't adding up in practice, because it suggests your calculations, while showing the rounding errors are magnified, are still not taking everything into account.
 
you have 15 civs including yourself right?
 
Are beakers actually lost? I checked this a long time ago in Warlords and all that was happening was that the "lost beakers" due to rounding were actually turning up as extra gold. So no commerce was lost it was just in another form. And we can convert any gold to beakers at a later stage by simply raising the slider.

Is something similar happening with BtS? Frankly I don't care if we get a fraction less beakers than the sliders indicate if it turns up as extra gold.
 
Yeah the beakers are lost... Just check the example yourself, you clearly get +1 gold, not +2...
 
Interesting thing about your example. If 7 civs know the tech then in the 100% example you get 13*1.14=14.8=14. 14*1.2=16.8=16. 16*11= 176 beakers. In the 90% example you get 11*1.14=12.5=12. 12*1.2=14.4=14. 14*12=168 as before.

Therefore the difference between 7 civs knowing the tech and 8 civs knowing the tech is 22 beakers over 12 turns or virtually 2 beakers per turn. That's a significant difference.

To actually determine the average benefit you'd probably have to set up a program varying the base commerce from 10 to 100 and the civ knowmods from 0.05 to 0.95 and then average the results.

Edit: This doesn't mean that binary research is a bad idea. You will still gain some beakers on binary research though the benefit not always going to be as dramatic as the opening illustration. If you leave researching a tech then more AIs will have learned it before you start which increases the civknowmod bonus effectively reducing your research costs.
 
I just spent about half an hour reading the game's code, trying to find out more about where and when rounding happens. One thing I found out for certain is that the prerequisite tech modifier (up to 120%) and the known civilizations modifier (up to 130%) are in fact added together for a single modifier up to 150%. (CVPlayer.cpp:6353)

Beyond that, I noticed that each city kept track of its commerce
 
That part seems to be about golden age...
 
Back
Top Bottom