Fractional trade counting

Mylon

Amateur Game Designer
Joined
Nov 4, 2005
Messages
1,013
I hate it when I have four trade routes that are at +75% each and I still only get 4 commerce, instead of the 7 commerce this should be! All of those bonuses mean nothing until it it hits the magic 2.0 size or the city gets big enough to start having 1.1 base value trades and such.

Anyhow, I've developed the code to make these factional trades count and make this information show up in the interface. Is this something you would like to see added to the UP?
 
Sounds logical because everything commerce related is counted in 2 decimals. I hate rounding issues as when you want to play optimal, you'll have to take them into account meaning more micromanagement. And it also means that some buildings which add a fractional bonus will be far less effective as some starting players would expect them to be.
 
So I noticed... When you add up the trades, it chops off the decimal there too. So if the city generates 3.75 commerce in trade, and if that trade gets cut into 80%, then multiplied by 1.25 (or whatever) to determine beakers, there's a lot of rounding that takes place! I could accept loosing up to 0.05 to rounding, but it's more than that. So I'm wondering if I should expand the scope of my fix. It'll go a bit beyond just trade, but also making all commerce fractional.
 
There are various mods that integrate the unofficial patch in their mod. They might use your code if they feel the same way about it as we do. The only issue is whether they notice this thread.
 
Just a little heads up that this won't be a trivial change code-wise. Commerce is already handled Times100 in the code, but yields are not. If the :commerce: from trade routes were handled separately, that wouldn't be such a problem. However, it's added in to the :commerce: from other sources.

I'm not trying to discourage you. I think it's a good idea as well.

There is one more consideration, however. I believe that this will break saved game compatibility. I haven't looked at the code that saves the game, but I do know that CvCity stores an array of current yields, m_aiBaseYieldRate. If you change these values to be Times100 and they are saved to disk, you won't be able to share that game with other players.

You could create a secondary Times100 array and use that only in-memory. When the CvCity is loaded from disk, you'll need to recalculate the values to put into the array.
 
The code I have doesn't break saves at all. The game stores the value of trades as a separate yield, which is also added to total yield when that gets calculated. I changed the function that calculates that value and it outputs a whole number (not the "decimal" of times100).

The only downside is the final decimal portion of trade value still gets chopped off. So in the event of running that civic, there's a few cases where the rounded-off trade would have been helpful. Example: 0.75 commerce left over from trade which gets chopped off * 1.2 for civic * 0.8 for research * 2 for various +research buildings = 1.4. Not a whole lot of beakers wasted, but if there's 20 cities in the map...

Edit: All of the code is here, though buried in a Fall Further modmodmod(mod): http://forums.civfanatics.com/downloads.php?do=file&id=12396

Should be bracketed by "Fraction Trade Counting"
CvCity.cpp+h contains the important changes, but there are changes in other areas for the interface side of things.
 
Top Bottom