Trade Routes Income performance impact

Is it possible to disable the trade routes entirely to test how much this affects you?
 
Frankly speaking, looking at the codes, I don't see why player 1 will get a better deal than player 2. But it is true that tedious looping is involved every turn.

I may answer that one, but actually is not exactly this.

It seems to apply only if:

1- You do have Domestic Routes assigned in your cities;

2- You have cities in different landmasses;

3- You have Foreign Trade Routes with players in the same landmass as your core cities.

I still don't know where in the files it's declared the City List of your Civ, but my reasoning came from this post: http://realmsbeyond.net/forums/showthread.php?tid=4353&pid=192412#pid192412

So the idea is that your cities are ordered by TR modifiers. The better your city, the earlier it's placed in the cities' list. So when the list is done, the first city is surely the one to get the best TRs assigned to it because it'll give the best output possible (because it's your best 'Trade City').

But as this only looks at your own cities, overseasness is irrelevant.

So the issue pops when there is a tie. Imagine your 3rd city on the list may get the same ammount of :commerce: from a foreign city in its landmass or a domestic city of yours. If you are player 0, or you are before the owner of the foreign city, the domestic route will win over the foreign one. If your next city (the 4th of the list) is an island city, overseas to the foreign city being considered, it may give more :commerce: even being a worse Trade City then the 3rd one.

For the human, single player can't have this issue, if you're player 0 in MP you're also immune. Even though Player 1 won't be immune, the issue may only happen when the foreign city in a tie is Player 0's, so this won't have much effect.

The most serious scenarios I guess are:

Truly competitive MP games, where every single :commerce: makes a difference;

Massive Continent with several oversea landmasses and you are one of the last players, like player 29, in a big MP game (for unknown reasons, as it's rare to get more then 5 players playing together).


This is the only advantage of Player Order that I know of in TR calculations, and its minor. But the way to solve it seems quite simple: Just prefer the domestic over the foreign if there happens a tie. There is no loss in letting a worse city getting the foreign TR that was in a tie in the previous city's TR assignment. But there can be a gain if you let it be assigned later, if you have overseas cities.


And BTW, I would like to see where your discussion goes in the improvement of TR calculation. Even though I like the idea of getting rid entirely of the nasty loop of TR calc to enhance performance, I don't think the concept is being properly substituted, for reasons I gave there. I would prefer a not so performance-consuming TR calculation then a simple :commerce: boost that only related to TRs in connectedness.

As I said there, instead of simplification, it's turning into exploitation, as you just have to be sure every city has max cities connected to it to provide max bonuses of buildings/wonders. When you reach that point (and vassals are great assets to do it) you can declare war on anyone without fearing economic recession, while with TRs you had to be careful who you would declare war on. If my total :commerce: income from TRs was 3000, being 1500 of domestic cities and a single AI giving me 800, with the others completing the rest without much difference between then, that meaned I couldn't just declare war on this AI because I would suffer a lot from economic recession. I had to be sure I could stand the recession. Now, without TRs and with the new connectedness concept, with a couple of vassals you're free to annihilate that AI, and any other, as long as you have enough vassal cities to provide max bonuses.
 
Trade routes are picked via:
1) Loop through all cities of yours
2) Loop through all players, including yourself
3) Loop through all cities of each player in (2)
4) If this city already chosen by another city of yours, ignore it
5) Calculate the trade profit this city will give to current city in (1)
6) Add to potential list of trade cities
7) Take the best X Cities based on number of trade routes

Thus, in terms of tie, for first player, a domestic city will be chosen over a foreign city, since the system loops over your cities first.
But for last player, foreign city will be chosen since the system loops over your cities last.
But, how hard is it to loop through your cities first in step (2) and (3) so that player ID becomes irrelevant...
 
I think that current trade rout system is uneffective and unrealistic

We should figure something else (more code effective and realistic)

In reality cities trade with each other with no limit for number of cities you can trade with.

SO i think trade routes schould be divided to two categories

Trade Rutes per city:
National Income : xxx
Civ X Income: xxx
Civ Y income
Civ Z Income

This is needed because in some civics foregin trade is forbidden

National and foregin income should be calculated by how many resources and how valuable this city have that others cities dont have.

How about this idea ???
 
I didn't put a lot of thought into this but when implementing an alternative to trade routes... I though up of random dice rolls each turn, where from a scale of 1-10 that randomly throws for each and every civ. 1 being the lowest trade while 10 being the highest and most successful trade. The dice rolls represents how much wealth you gain each and every turn, so your total income will always be random, however it's best to actually try to be lucky to be scoring anything higher then 5 to gain a positive profit in the future when you have to be careful of civic and building maintenance. There should be certain exisiting buildings that help increases your chances of rolling successfully and/or help increases overall based gold amount so that even rolling a 3 could be a massive profit to you if you been focusing on trade often. Great Merchants can help increase your chances and overall profit by a large amount if possible or if the developers liked this idea, a "golden era of trade" which is similar to a golden era but related towards trade that help increases chance of successes of a dice roll of 4+ to happen for a limited amount of turns (at least 4-7 for balance purposes).

Random Events have also have to be made that can frequently appear that can either races your chance for a small amount of time, or increase overall base profit to 10%, or have bad events of bad trade/criminal scams that reduces overall base profit by -10% + more depending on the city crime level, or decrease successful chances for a set amount of turns. Every city can actually profit from trade bonuses and maybe resources can help out in certain ways as well, maybe a bonus payment if the civilization required that certain resources desperately, but the bonuses and resources used during the trade is random.

let me place an example as a demonstration... on turn 356, my cities have almost all buildings that deal with commerce, so the base profit of trade is at least 2135 gold. Frederick wants copper ore and steel bars, so if i'm lucky to have that resource selected on the random roll of resources, I gain a bonus of at least 20%, possibly 5% more thanks to open borders/free trade agreement, do that leaves me with a 25% if I did a successful roll. The dice rolled a 6, which means that based profit of 2135 gold + 6% increase means I gained a 2,263 gold without the trade agreement/open border, 2376 gold if I do have the trade agreement/open border. If the resources is not copper ore or steel bars, I don't get the bonuses, but if the resource is either copper ore or steel bars, I gain 2715 gold w/o trade agreement/open borders, 2970 gold w/ trade agreement/open borders. More bonuses can happen if a random event has happened as well so you get more bang for your buck at successful times and successful rolls, leaving you richer and richer for the moment.
 
AND is preparing to completly delete trade routes from game and replace it with static bonuses to buildings.

U think that wil be the best solution.
 
I'm not a C2C player, but I am from RAND's side of things. Here is my biggest problem with Trade Routes. It's not the performance. It's the randomness. There is very, very little you can do as a player to improve your trade route selections, or control who you do and don't trade with, on a city by city basis.

Randomness is bad for game mechanics. Worse yet, trade routes do deal out a significant amount of commerce. So in essence, the game is just handing out a massive amount of commerce based on RNG rolls. That's terrible. You might as well kill trade routes and give players a RNG based amount of commerce for that turns "trade". It would amount to the same sort of thing. I imagine most players would agree RNG handing out commerce is entirely idiotic. Except, that sort of extreme idiocy is treated as "acceptable" when we discuss trade routes? Why the cognitive dissonance?

Death to trade routes.
 
Trade routes are economical gambles, like stocktrading, starting new enterprises, and from year to year the yield differs, does not stay the same, some times possibly even giving a negative yield.
Thus we accept a certain randomness automatically and I for one am good with that it is a bit random, could even consider it to be more random and yet alright.

Right now it is not all that random, it still tries to find the best possibilities and who one has trade agreements with, and how many routes, and if they are blocked, matter but I see the logic in it and can work towards removing any blocks (foreign soil stopping trade, if a Trade Agreement opponent has "no Foreign Trade Routes" civic or not can be fixed.

To reflect real life better more randomness could be introduced and the checking for best routes for all routes every turn could be removed, instead only checking 20% of the routes in each city every turn, or 10% even. Any "bad" routes would stay a while, like in real life, as they were once good and people try to get them back to their former glory a long while before giving up.

Just my thoughts on the matter. I would not like to see trade routes gone, nor changed to a fixed number instead, or set to completely unable to influence in any way, which one can now by chosing civics, removing blocks to good trades, increasing # of routes, decreasing with certain buildings/civics, increasing or decreasing base yield with buildings. Rather more random, like each route (one check per turn per route) can be between -200% to +200% (from -base to 3xbase), and sticking with some same routes without checking for better ones for 5-10 turns or so.

Cheers
 
Just my thoughts on the matter. I would not like to see trade routes gone, nor changed to a fixed number instead, or set to completely unable to influence in any way, which one can now by chosing civics, removing blocks to good trades, increasing # of routes, decreasing with certain buildings/civics, increasing or decreasing base yield with buildings. Rather more random, like each route (one check per turn per route) can be between -200% to +200% (from -base to 3xbase), and sticking with some same routes without checking for better ones for 5-10 turns or so.

Cheers

Trade routes have always been capped with MAX_TRADE_ROUTES in the global defines XML. This is how it works in Civ4 & BTS.
 
I do not like the way trade routes are calculated either so when I was still active modding C2C I started with an alternative approach to it by calculating a kind of local trade auras around cities depending on trade buildings and routes (among other things, with the values being WIP and not final). That then resulted in a trade network graph but I did not get to the point where that would then have an actual gameplay effect.

The code is actually in C2C but only active if the global define CALCULATE_TRADE_AURAS is set to true. The result of the calculation can then be seen as a globe layer (the auras of the different cities and the routes that connect cities with adjacent auras).
 
I do not like the way trade routes are calculated either so when I was still active modding C2C I started with an alternative approach to it by calculating a kind of local trade auras around cities depending on trade buildings and routes (among other things, with the values being WIP and not final). That then resulted in a trade network graph but I did not get to the point where that would then have an actual gameplay effect.

The code is actually in C2C but only active if the global define CALCULATE_TRADE_AURAS is set to true. The result of the calculation can then be seen as a globe layer (the auras of the different cities and the routes that connect cities with adjacent auras).

Trade auras sounds funny... I rather renamed it Trade Influence or Trade Sphere.
 
Trade routes have always been capped with MAX_TRADE_ROUTES in the global defines XML. This is how it works in Civ4 & BTS.

Not sure how you arrived at that response to my ranting. *grin* The "Fixed number" I suppose but taht was my comment on the wanting to remove trade routes and hav a fixed income, aka a fixed number instead of trade routes.

Anyway, I posted mainly to let people know that not everyone agrees about randomness being a bad thing with Trade Routes.

Cheers
 
It would be neat to have a system closer to EU4, where there is a form of competition along trade routes, but I doubt it could be implemented.
 
After Reading this thread
http://forums.civfanatics.com/showthread.php?t=529079

I noticed that calculating City Trade route income has HUGE performance impact.
Especialy in later games on big maps (more cities - bigger turn time impact)

Now Trade Routes in C2C makes also trouble with excessive food production (from thin air BTW)

How I can disable Trade Route Income calcultion or even make a gameoption for it ??

Also i think that trade route income is covered by buildings + x% :gold: with resource y

You say that there is a HUGE performance impact but did anybody test how much it is?
I never noticed that in the profiling results.
 
You say that there is a HUGE performance impact but did anybody test how much it is?
I never noticed that in the profiling results.
It is one of several algorithms that scale with square of city number so I doubt it has too much of an impact (although it does not look very optimized).
 
I had an idea that may work and should cut down on the turn times. If there is a way to code trade routes to where they are locked-in for say 5 turns (or longer, its just arbitrary), then that should cut the turn load down to 20%. For instance, when the game calculates a new trade route, that trade route would be set for 5 turns and wouldn't need recalculating every turn. At the end of 5 turns, its recalculated again for best trade route available and set again at 5 turns. BTW, only the base amount would be set, so any boosting building or civic will still change the overall amount, but the base would remain the same and 'locked in'.

The real interesting thing would be how to handle 'breaks' in the trade route. If a city starts a 5 turn route with a second city and the second city is captured, blockaded, or otherwise disturbed; deciding how the game goes about it could add another small level of strategy. One could just make the first city find a new trade route to replace it, but I like the idea that conquering or blockading cities could have a larger and more profound impact (even if it is just a slight effect) on a nations economy so that disrupting a route would leave it to yield nothing until the 5 turns are finished.

To be clear, my use of 5 turns is just an example, for instance on marathon speed you could make it more like 8 or 10 or whatever. The main point is to get the end of turn calcs down for faster turn times. If the engine was only computing an average of 200 routes per turn instead of a 1000, I believe it would be noticeable.

I wouldn't change anything else. The food or hammers coming from 'nowhere' actually makes sense to me. The real issue for me is that you can have routes that don't provide those. I could give a really long example using what I know about macro-economics, but I feel this post is long enough :p.
 
IMO, the problem with trade routes is that all of the food, commerce, and hammers come from "nowhere". If you want to optimize it, just remove the code, roll some dice, and give each player random yields each turn. There ya go, trade routes, with no performance hit.
 
Top Bottom