Trade Routes Income performance impact

Nimek

Emperor
Joined
Jul 7, 2010
Messages
1,208
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
 
Just don't use Advanced Economy Option on game set up. That removes much of what you don't want.

JosEPh
 
I recommend
MAX_TRADE_ROUTES in the global defines set to zero

I dont know if this will prevent scripts to calculate trade income or not (some programmer must look at it)

I also encourage someone to test MAX_TRADE_ROUTES set to zero in more advanced game and compare turn times.

Maybe SO. He likes more fast turn times ;)
 
I have never liked the Advanced Economics. I don't think I have used it since trying out the original back in AND. Thank goodness I was so vocal about keeping it an option when others wanted it merged into C2C.
 
@DH

Keep in mind that trade routes income is always calculated even when advanced economy is off. I belive tha with AE on it is only more complex.
I wondering how big is turn time impact.
 
Fascinating...

Trade routes have long had a great deal of usefulness in giving purpose and meaning to many building types, trait and civic differentiations. But at the same time the whole generation from nothing factor is a slight bit disturbing to the global model. Certainly not the only spot in the game that expresses this issue but yeah.

The processing on switching those down to 0 would certainly be minimized... not completely eliminated but would definitely cut down and yes trade does take up a lot of processing.

At some point I may invent something a bit more ... rational. But trying to keep value on many things that currently center their value around trade routes will be a challenge still.
 
In the early game, trade income is a reward for connecting your cities by road, and researching techs for river/coastal trade. In the later game, when everything is connected to everything, trade income is a reward for maintaining peace.

The current trade system is an heritage from Civilization I. In Civ 1 you built a caravan unit, moved it to a city as far away as possible, then traded, which removed the caravan unit. It resulted in a lump sum and the establishment of a permanent trade route. In later versions establishing trade routes became automatic.

The idea that you get more money if the target city is further away may be historically questionable. For example, the Dutch were the dominant world trade power during the 17th century AD. They shipped stuff like spices and Chinaware from East Asia back to Europe. While these new goods fired the imagination, it wasn't all that profitable. Sure the new goods were sold at a good price, but the cost of transporting stuff all over the world in rickety wooden ships was astronomical. Ships sunk along the way or were plundered by pirates, crews died of diseases, and maintaining a world wide network of garrisoned tradeposts for resupply was expensive. An analysis of 17th century Dutch trade showed that they made very little net profit on trade with East Asia, but they made fortunes on trading salt, fish and lumber with close-by Scandinavia and the Baltic Sea area. So distance equals profitability is a questionable system.

Perhaps a different system of trade could be implemented. Instead of specific trade routes, a city is part of a trade network of connected (and known) cities.
For example, city A is connected to
- 6 cities owned by player
- 15 cities from other civs
- 35 overseas cities from other civs.

Then throw these numbers in a math equation that gives a percentage bonus that is applied to all commerce in city A, based on the size of its trade network, with diminishing return on the size of the network. And this percentage is multiplied by the number of trade routes it has in the current system.
 
Nice idea. It would need to be adjusted for buildings in the city and/or population. A city without any type of market (building or people needing the goods) would not make as much from trade as a city with a large population and many market like buildings.
 
Nimek wants C2C to follow what AND and Afforess is contemplating to do with AND. There is a discussion thread on the subject there now. Check it out to see what they are all up and about over Trade Routes.

JosEPh
 
I'm not working on this at the moment but whatever they do over there MAY work here potentially - will have to take a serious look at it once ready to manipulate trade routes.

I have some ideas too and just don't really care to present them yet.
 
I'm not sure I'll like it but I'm watching the discussion. It may also include eliminating Inflation as we know it.

JosEPh
 
We use trade routes for the spread of many things. The disease/unhealthiness stuff will use it big time for disease vectors and such like.

Inflation on the other hand is supposed to be there to stop you keep hurrying buildings by throwing money at them all the time.
 
From the AND thread on the subject (and I don't think Advanced Economy adds a whole lot to what trade routes do to processing by nature but I'm not sure til I look a bit deeper...)
:
If I may chime in since Joe asked those of us on C2C to take a look at the thread here and comment...

Ok, so ultimately 4 core points have been made so far as I can see:

1) The automated selection of trade route cities is a wretchedly time-expensive processing waste.

2) Player choice is next to non-existent in the trade route structure. There's some few variables players manipulate but to keep from there being far too much micro-management, there's a horrendous streamlining that makes the whole structure akin to a set of 'random' bonuses.

3)The concept of trade producing valuable yields/commerces from nowhere is rather flawed (though maybe not quite so bad for the Commerce Yield itself as it may be the only thing truly justified to be 'generated' this way.)

4) It would be faster and potentially more meaningful still if we were to establish new tags to adjust trade route manipulations on buildings, civis, etc... to manipulate Commerce per connected cities instead.

Ok.

So I'll respond directly to those main points and then offer some additional points for consideration and then offer a solution I've not seen suggested here that I feel would ADD to gameplay rather than simply streamline and shed what I feel are SOME very valuable game mechanic features attached to the concept of trade routes to begin with.

So responses:
1) I can't argue here. Surely this is a horrendous processing effort. Koshling may have cached the results significantly but yes, it goes a long ways towards making the later game take a lot longer turns and overall the design is indeed terrible.

2 & 3) I've always wished that aside from Commerce generation, it would be nice if Yields and Commerces could actually BE traded between cities based on player choices. Would be far preferable if percentages of the resources (not to be misconstrued as BONUSES) of a given city could actually be given to another city via thereafter automated 'routes'. If cities could make agreements directly with one another to trade say, some food from one city FOR a certain amount of gold FROM the other. ALLOW the establishments of trades (and not just bonuses between civs at a player level) to be a PART of the game.

For example: You know you want more food for your arctic city because it has a tough time doing so for itself so you establish a trade between that city and another where it will give some of its gold income for some of the other city's food income.

Another Example: You want more production in this particular city because you're training up an army or you're trying to get it built up from an infancy status so you make a trade with another city for some of its production.

Added Commerce Yield 'from thin air' would be a positive side effect for both cities because it's the learning from each other and witnessing of the other's tricks and clever concepts in action (research), small time wheeling and dealing and thus added taxation from commerce taking place between the populations of both cities(gold), the sharing of attitudes, artwork and cultural ideas(culture) and the opportunities to learn secrets and valuable strategic information from the other locations(espionage) that is what the Commerce Yield represents and just establishing inter-city trades would generate this - in fact would be one of the most powerful ways TO generate Commerce Yield!

Sounds like something that would get more complex still and thus be a processing nightmare of an even worse magnitude right?

I think it can be done and make it done much cheaper in terms of processing.


4) I object somewhat. I liked the idea the first time I read it here but I've been thinking on the concept and it really does leave a LOT of game features out of the picture. Cultural sharing, espionage (as has been pointed out), tech diffusion issues, (for C2C we HAD trade route interactions for Properties and I still think we just need to restructure it so it can be re-established - and the advanced disease etc... structure I was working on would heavily use trade routes in a more controlled manner), Religion Sharing - You'd be wiping out automatic religious spreads here, Corporation interactions I think use trade routes. Then you've got Internal Only trade vs International Trade, trade agreements in diplomacy, events, resolutions... a TON of building and other tags that are devoted to interacting with the trade route mechanism that would need to be entirely rethought... There's a LOT of considerations that would make this seemingly simple adjustment highly complex and would leave the game lacking some useful interactions.

You'd be adding more tags that would need to be implemented through a tremendously laborious effort that includes the removal of all the previous implementations for trade route tags. I realize that AND probably doesn't use as many as C2C since we have bridges and road 'buildings' I don't think AND uses but still... that's a lot to consider. You have Civics and Traits and Techs to reconsider how to rework... As noted, this is a horrendously HUGE restructuring to go through for either mod.


However...


I have a solution to propose and it's probably what I would do for C2C at some point soon. (I've got a little work to do there yet to pave the way for this further in the way I'd implement it but it could be done in AND differently.)

So the solution I would propose:

Don't know about AND but in C2C we have Merchant units. I've got a few issues with them too. They ALSO generate production and food in a much greater volume than it takes to train them (in the case of the Food Merchants to an almost ridiculously imbalancing extent that makes it so that if you want to grow a city you'll build these until you're happy with your population no matter how high that population may become.) They seem to be a good idea in theory but are incredibly imbalancing.

If you want to use them to generate gold or commerce which is a paltry use for them (unless they're naval trader units and have thus no other use) they're laborious to utilize and problematic for the AI who currently sees them as primarily great scouting units since they can explore enemy territory as they can't be kept out by closed borders etc...


I would suggest
1) Disable all automatic determinations for trade route establishment. This immediately fixes the processing hell and 'lack of choices' problems. Give them back to the player!

2) Do so through trade units. Give the units an ability to Broker a trade route. Track the unit's 'home city' and make it necessary to send them, successfully, to the city you wish to establish a trade route with.

3) The route itself that's brokered could be of a number of different route yield types. Commerce generation would be a natural side effect for both cities but one city would give a yield in a volume determined by the upgrade phase of the trade unit for gold from the other city in a volume determined by the upgrade phase of the trade unit.

4) Otherwise disable yield/commerces generation by default.

5) Keep the max # of trade routes limits and trade route commerce yield modifiers all current buildings, civic, etc already give. Wherever possible allow trade routes to continue to work as they currently do and maintain the majority of the UI it already utilizes in the city screen, except that we are no longer talking about an automatic system of assignment. For maximum routes, your city's trade units would not be able to broker more deals than the city is limited to.

6) Obviously the somewhat heavier processing would swap over to unit generation for this purpose and the ai for those units. But I'm thinking this could be done with much less processing weight.

7) Deals must be accepted or rejected and must remain able to be cancelled. So there would be some new popups and AI considerations there but may not need to be toooo complex, particularly if the AI is programmed to be fair and generally open to trading without good strategic reason not to be.

8) Deals must be registered as an act of international trading for diplomacy's sake.

9) Some deals could be setup to be humanitarian, like food aid sent to another city where nothing is asked in return.

10) Each deal still counts as one trade route. And perhaps more than one deal could be struck with the same city even.


This way you'd make trade a lot more strategic and even adventurous as you'd need to get your merchants to their targets without those merchants being destroyed before brokering the deals you're wanting to setup. That would certainly serve C2C as it could lead to a lot more Criminal interactions and such as well.

Anyhow, take this as you will - just a suggestion from another modding mind.
 
We use trade routes for the spread of many things. The disease/unhealthiness stuff will use it big time for disease vectors and such like.

Inflation on the other hand is supposed to be there to stop you keep hurrying buildings by throwing money at them all the time.

Well that may be a problem for C2C. Afforress (AND) is thinking of using a different way for trade routes (connectivity) - because of the processing overload. (over 5 nested loops per civ per city etc.)

If C2C is too dependant on TRs.!? :rolleyes:
 
From the AND thread on the subject (and I don't think Advanced Economy adds a whole lot to what trade routes do to processing by nature but I'm not sure til I look a bit deeper...)
:

Sounds good to me - my only questions would be:
1. How long will this take to do (and to get round to), and what else will it delay you doing?

2. How broken will trade routes be while it is being done?

3. What are the estimated performance benefits (dare I say "if any":p) from such a change?

On reflection I am a bit concerned that this sounds like another huge incentive for the kind of micromanagement that I regard as unfun and would prefer not to do. There are already too many incentives for tedious micro imho, although one of the improvements of C2C over BtS and most other mods is that the benefits of micro are reduced (and/or obscured lol) by the additional content...
 
Sounds good to me - my only questions would be:
1. How long will this take to do (and to get round to), and what else will it delay you doing?

2. How broken will trade routes be while it is being done?

3. What are the estimated performance benefits (dare I say "if any":p) from such a change?

On reflection I am a bit concerned that this sounds like another huge incentive for the kind of micromanagement that I regard as unfun and would prefer not to do. There are already too many incentives for tedious micro imho, although one of the improvements of C2C over BtS and most other mods is that the benefits of micro are reduced (and/or obscured lol) by the additional content...
1) It would take a while and thus was not something I'm looking to do right away. I will want to develop the Generic Category and Ideas project first because I'd use elements of them in the design of this.

2) The change would be sudden and encompassing in one commit. It would keep a lot of the current trade route mechanics thus would not 'break' much to change HOW a trade route gets established. There's a number of things to do surrounding that basic shift, particularly for the AI and popups for interface work like the missions and so on. But it wouldn't really be too bad a project once I get into the swing of it.

3) Enormous on later games and quite a speedup to recalcs in particular. But I'd have to be careful not to overcomplicate the AI to keep it from having too many things to consider.

4) As for the micro, I'm thinking that it would be no worse than spreading religions or corporations is now except that there's the added intrigue of working internationally for the best benefits. It would certainly enhance the need for establishing more open relations with other civs. See... once the route is determined, it would just stay there as a route unless you had cause to break the route or the route was broken by external stimuli like war for example. Routes could be suppressed temporarily or completely severed - a blockade could suppress while a war with the owning player would kill the route entirely.

5) I'm thinking once the route is established it certainly doesn't mean you need to send your merchant back and forth forever... the merchant may succeed at the negotiation, fail, fail epically and thus be destroyed, return back to the city, or maybe even stay there afterwards. I want to angle to make the merchant capable of ongoing activity but the route needing no further monitoring.


I'll discuss it in much greater depth when I get closer to messing with it. At the moment, I think we should just deal with trade routes as they are. (I'd wanna make this an option as well.)
 
I am confused. I thought the overhead was because the trade routes were being set up every turn with the first player getting all the good ones then the next player and so on through the players. Simply because it cycles through each player and each of the player's cities trying to find trade routes each turn.

If instead we set the trade routes up either via diplomacy or units then this overhead every turn is gone. There is no need to throw the baby out with the bath water.
 
If instead we set the trade routes up either via diplomacy or units then this overhead every turn is gone. There is no need to throw the baby out with the bath water.
That's exactly what I'm proposing. I want to keep it out of the normal diplomacy stream though since that's already a fairly annoying slowdown when they come up to initiate diplomacy with you.

Then again, maybe, just maybe, it may be better to just keep it as is. With all its flaws.
 
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.
 
Top Bottom