City production waste calculation error

SirPleb

Shaken, not stirred.
Joined
Jan 1, 2002
Messages
1,415
Location
Nanaimo BC Canada
Description

When I reassigned a citizen to increase total production by one shield, waste increased by TWO shields.

I.e., I get better net production in this town if I reduce gross production. That should of course be impossible :)

Steps to reproduce

Load this save file then:

1. Go to Pisae's city screen
2. Note the current production
3. Move the citizen on the olive hills to the forest and observe the new production

Expected result: Net production should either remain the same or increase by one shield.

Observed result: Net production goes down by one shield.

Here's the city screen with 17 shields gross production, 14 after waste:



Here's the city screen after moving citizen from olive hills to forest, it now has 18 shields gross production, 13 after waste:



Additional comments

The save game is from the Rise of Rome scenario.

Rome is in a Golden Age at the time of this save.
 
This seems to be a rounding issue associated with the corruption slider in the editor. I've noticed it before.

Fortunately, things like this do not happen when you leave the slider at 100%.
 
alexman: I have seen similar stuff (with tax income) in PTW 1.27 - more beakers means less science and tax at the end....
 
[Sorry, edited out my rather rude first response]

I didn't say anything about commerce. I believe that it's the corruption slider in the editor that causes the strange jump in the number of wasted shields, probably from rounding errors in integer arithmetic in an intermediate calculation.

The Rise of Rome scenario has the corruption slider at values other than 100% (the default), depending on difficulty level.
 
Since it is called corruption I'd expect that slider to affect both shields and gold :) I've never played with it, so Rise of Rome might be the first game I've played which has that slider non-standard. It makes sense they'd set it for more corruption at higher difficulties in the scenarios - something is required to offset the "level playing field" we otherwise get regardless of difficulty.
 
This is very bad, I have seen the same. :(
 
:hmm: I think carlos is right, there's also some strange stuff in epic games (with default rules).

I could re-assign citizens (change working tiles plus hiring an entertainer) in a 'medium' corrupt city and actually decrease my raw commerce production in the process. At 10% tax, 10% lux tax, I could however increase my tax harvest from 2gpt to 5gpt thereby (& info box was indeed updated, showed 3gpt more now)...
My beaker production would drop, though , but it doesn't make any sense to get more gpt from less raw commerce (unless I missed something?)...

I don't know if this is caused by the buggy corruption calculation or certain tax sliders, but the rules were untouched (so the corruption slider had the default setting).
The bottom line: with some micro-managing, I could assign a scientist, thus my beaker production would not drop, and get more gold although my raw commerce decreased...
:(
 
Oops, when he said "slider" I immediately thought of the lux/sci sliders. I haven't used the editor and didn't know about a corruption slider. Of course he did say "in the editor".

I've been away for a week so I guess I missed the "rude response". :cool:
 
Here's an example from an epic game, using default rules.
The city has market, bank, stock exchange, library and university. No wonders are built. You can keep track on all existing city improvements by viewing all pics, but pic 1) and pic 2) are the important ones.

1) http://www.civfanatics.net/uploads6/kommerz1.jpg
2) http://www.civfanatics.net/uploads6/kommerz2.jpg
3) http://www.civfanatics.net/uploads6/kommerz3.jpg

1) Citizens work tiles to get max commerce production, I get 2 gold from tax at 10% tax rate.

2) I reassigned citizens and hired a scientist, resulting in less commerce production, but giving me more gold from tax.
:confused:

(If the specialist was an entertainer, tax would give me 5gpt as well plus entertainment bonus; taxman would give an additional 2 gold on top).
Note: In this example city, I could not even out the beaker loss (1 in this case) with my scientist. So I 'lost' 1 beaker in total, but it's sometimes possible to get more gold with a certain working tiles/specialist(s) (specialists not necessarily being taxmen) combo with less commerce.

3) Another constellation of working tiles/specialist, w/o altering the gold output from tax

I don't know if this is some sort of rounding issue as well, but the corrupted commerce portion is not allocated correctly.
 
Grille,

The important thing is counting the gold from the tiles. Looking at the total commerce output gets skewed because of improvements. Improvements multiply uncorrupted gold only. Also, in C3C, the output of specialists are added to the city screen, which did not happen in PTW.

I think the problem here is that the computer is inconsistent on how to divide up some left over gold. (when you have to divide 3 gold between tax and entertainment which have equal funding).

1st screenshot:

You are collecting 31 gold (I counted the gold coming in from the tiles). Minus 15 gold for corruption, leaves you with 16 gold. 16 gold*80% (for science)=12.8 gold, which rounded up=13 gold. 13 + 100% (library + university)=26 gold, which is correct.

That leaves 3 gold remaining (16-13). How to split up 3 gold to 2 areas that are set to the same %? Apparently, it gave 2 of it to entertainment and 1 to tax. The 1 gold then gets multiplied by the marketplace, bank, etc. bringing it to 2 (It should be 2.5 because of the stock exchange, but I guess it doesn't round the number up at this stage).

2nd screenshot:

27 gold from tiles-13 corruption=14 gold *80%=11 +100% for lib.+ univ.=22 gold +3 beakers from scientist (which is now added to the city screen, which did not happen in Civ3/PTW) =26 gold, which is correct.

Again, that leaves 3 gold left over to be split between 2 areas that are set to the same percentage, but this time they gave it to tax instead of entertainment. Tax is 2 gold + 150% for your improvements, brings it to 5 gold.

3rd screenshot:

29 gold-13 for corruption=16 gold, which is the same situation as screenshot #1.
 
I have no idea about how SirPleb's waste calculations are made, but am inclined to wholeheartedly accept that rounding effects in one or more functions in the waste calculation are to blame when the slider is set at other than default -- I have no reason to believe otherwise, and a small reason to believe this is te case simply because alexman knows his stuff around corruption and waste issues.

Originally posted by Grille
Here's an example from an epic game, using default rules.

[. . .]

With respect to the commerce in a default game with an unmodded corruption slider, the only thing that strikes me as quirky or at least potentially confusing is how the non-corrupted commerce is apportioned bewteen the three separate accounts of tax, science, and entertainment.

I believe that the slider percentages are applied first to science and entertainment -- tax then gets whatever is left over. The effect of multiple tax-related city improvements can produce quirky results when the raw tax allotment jumps by even 1 commerce.

In picture 1, you have 31 total raw commerce, 15 of which are lost to corruption, leaving 16 available commerce. With science at 80%, that means 12.8 commerce should go to science -- it is rounded to 13, and the effects of the lib and univ turn that 13 into 26 total. There are 3 remaining commerce after the science allocation. Jumping back to the raw total of 16, and applying a 10% entertainment slider, means 1.6 should go to entertainment - it is rounded up to 2, and leaves only 1 for tax. The 1 to tax changes to 2 by virtue of the market / bank / exchange.

In picture 2, you have 27 raw commerce, 13 of which are lost to corruption, leaving 14 available. With the 80% science slider, 11.2 should go to science -- it is rounded to 11, the lib / univ effects bump it to 22, and the scientists adds 3 for a total of 25. As example one above, there are 3 remaining commerce for tax and entertainment. This time however, the raw total of 14, against the 10% entertainment spending, is 1.4, and is rounded down to 1. Which in turn leaves 2 raw commerce for tax -- the 2 to tax becomes 5 due to the market / bank / exchange.

In picture 3, you have 29 raw commerce, only 13 of which are lost to corruption (policeman effect), leaving 16 available. The follow-on analysis is the same as picture numebr 1.

In other words, I believe that since science and entertainment both have sliders manually controlled by the player, their percentages are applied against the available commerce first, and whatever is left goes to the tax account. The outcome just seems a bit screwy because of the rounding effects and how they are applied to indivisible units like individual commerce items. I've seen similar outcomes in PTW (before any C3C corruption issues could have influenced the outcome).

EDIT: Cross-posted with Bamspeedy. Only thing my post adds is speculation that science and enteratinment sliders are applied independently to the total available commerce and that tax gets whatever is left.END EDIT
 
Thanks for the replies.:)

I think I made a stupid mistake when calculating the gold/entertainment benefit (@10% tax/lux tax each) out of the 3 left over raw commerce units, and then made the wrong assumption the corruption wasn't allocated correctly.
:crazyeye:

But this 'speculation' makes my day:
by Catt:
In other words, I believe that since science and entertainment both have sliders manually controlled by the player, their percentages are applied against the available commerce first, and whatever is left goes to the tax account. The outcome just seems a bit screwy because of the rounding effects and how they are applied to indivisible units like individual commerce items. I've seen similar outcomes in PTW (before any C3C corruption issues could have influenced the outcome).
So priority is given to the entertainment calculation (rounding...) over the tax calculation (-> tie-break situation). This explanation makes sense IMO.


In general, I'm not really satisfied with the rounding procedures at (max. three) different calculation stages. Ok, this isn't exactly a new (C3C-) problem. But since there's only the 'terminal' beaker/gold/entertainment output shown on the city screen anyways, I'd support the idea to spare the rounding procedure before city improvements kick in. The uncorrupted/corrupted commerce/shields might be rounded, of course, but the slider distribution of the uncorrupted raw commerce shouldn't, IMHO. The 'terminal' output could be rounded to get an integer number which could be represented by the different commerce-like units on the city screen.
Well, on the other hand, the way it works now, rounding effects might be out-evened in total on larger maps, but I don't like it.


For the waste calculation in SirPleb's pics, here's my phantastic speculation:):
Given that the corruption slider was implemented later (IIRC it wasn't there in v1.07) and that the game 'loves' to round at some point, any slider adjustment other than default might result in two seperate waste/corruption calculations (incl. rounding procedures) which then sum up to figure the total amount of waste/corruption. Such measure might have been easier to implement by a patch, dunno.
I have of course no idea how the slider really works, but if it does use two (cumulative) seperate ways with seperate rounding procedures before the total amount of waste is summed up, the spooky waste jump might be derived from rounding at an inter-stage.
I would guess that one seperate way is the default ('100') calculation and the second way depends on the slider setting, both being rounded before figuring the terminal result.


Now if it was *easy* to get rid of the corruption/waste rounding procedure, I would appreciate if this was also done when calculating a city's commerce distribution.
 
Top Bottom