A issue with resource trade.

r_rolo1

King of myself
Joined
May 19, 2006
Messages
13,818
Location
Lisbon, Portugal
Grab the save posted here, trade clams for wine with João, end turn....

Trade is cancelled ( :confused: ), pop up informing that we have wine appears ( :confused: ), we don't have wine and João source of wine is still there for trade ( in fact he'll acept the same trade again.... )

Some kind soul can explain fully what happened here? I have some ideas but another pair of eyes would help.
 
This one really stumps me. I can reproduce it by the way ;)

Spoiler in case you don't want to know features about the map geography etc.

Spoiler :

I'm curious though... Joao is a long way away. There doesn't appear to be a conneciton by road, and the north coastal route is blocked by ice. If your route goes along the south coast can it go through barb cities? If it couldn't then I don't know why the trade would be allowed. And doing the trade again the following turn seems to work.


It wouldn't be cancelling deals, requested by another AI because you get to keep the open borders.

As I said, stumped...
 
My only possible explanation is that, because of the death of ragnar and the correspondent recheck of the whole diplo ( to check if there is any new worst enemy and what average power there is now ), something had transiently pushed the deal out during the AI turn.

The fun thing is that you can do a resource per money deal with the Romans at the same time and it will stay....... :confused:
 
I don't think there is any bug. It's just a very short interruption of your pre-Astro trade network, which gets re-established during the same IBT (probably caused by AI interacting with barbs, pillage + rebuild road?). The trade deal does not get cancelled if you give yourself Astro with WB (+ reveal all tiles).
 
spoiler again for map details

DanF,
Spoiler :

But as far as I can tell there is no obvious connection by land. The north connection is blocked by ice, and the south coast only seems to have a french work boat and a few barb cities. Do barb cities block trade routes if they use up the coast tiles the trade routes need to pass through?
 
Well, I can't see what's in the spoiler ( ongoing game ), but that could be explained by a barb galley...... barb cities cut the way to trade routes too, but that would be pretty misfortunate ( and I'm not seeing how could a barb city pop and be destroyed in the same IBT ). There are no wars in the world, so road pillaging would be pretty strange too

P.S The big issue is that the barbs IIRC are the last one to play, so the barb galley would not work too.... This needs someone that gives the trade route a look in debug mode ( a thing that I obviously can't do in this game )
 
rolo: ok, there IS a bug (a minor one).

PieceOfMind: You are right about ice and barb culture blocking trade networks. But the current network links are established via many land tiles.


I don't think I give away any important spoilerish info by explaining the following:

Resource trades between 2 players require a trade network connection :)traderoute:). But a bidirectional connection is not necessary, thus at least 1 of the players must have his capital's plot and the plot of his trading partner's capital in the same plotgroup. Plotgroups consist of adjacent tiles which can be part of a trade network of a player.

The requirements are:
  • the plot has a route OR
  • is adjacent to a river (Sailing required when outside of own culture) OR
  • has trade enabling terrain (Coast and Ocean with the known tech requirements)
Further conditions:
  • the plot must not be blocked by impassable things (ice on coast blocks, but peaks are special - they DON'T block river networks)
  • the tile must either be revealed OR owned by a non-hostile player (this is the crucial point, that's also why barb culture blocks coastal networks, everybody is always at war with the barbs)

So in the save (410 BC):

Colonel Kurtz hasn't revealed to many tiles of this Pangaea (whereas the other players have), but trade network connections are currently established with ALL other players.

Bidirectional connections:
  • Kurtz <--> Ramesses
  • Kurtz <--> De Gaulle
Thebes and Paris are in your "home" plotgroup which of course includes Kyoto, and both Ramesses and De Gaulle have Kyoto in their "home" plotgroup.

Unidirectional connections:
  • Kurtz --> Augustus
you have Rome in your "home" plotgroup, but Augustus hasn't revealed the critical unowned tiles connecting your new Viking acquisitions to your Japanese cities, so he misses Kyoto in his.
  • Kurtz <-- Wang Kon
  • Kurtz <-- Joao
Both currently have Kyoto in their "home" plotgroup, but your plotgroup doesn't reach that far to include their capitals' plots. Wang Kon has revealed enough of the unowned tiles of your area to have a "stable" network, but Joao's situation is very special and his trade network connection to you gets broken in the IBT due to the bug (it doesn't survive a forced recalculation triggered by deleting and rebuilding a critical road via WB).

However, Joao has Workers finishing a road in a certain tile within his culture (which causes the recalculation and splitting of his old plotgroup -- his "home" plotgroup loses Kyoto), but this road establishes a critical link for your "home" plotgroup to also include Lisbon, so that a new unidirectional connection is created:
  • Kurtz --> Joao :D


The bug:

The code to test whether two adjacent plots can be part of the same plotgroup is not working in an "isotropic" way, so that depending on the direction plotgroups are either allowed to combine or they get split up. The following 4 plots are critical for Joao's trade network connection:



P1 and P4 are unowned, P2 and P3 are owned (they are within your culture). Joao has revealed P1 and P3 but not P2 and P4. Thus, P4 the unowned and unrevealed plot can never be part of his "home" plotgroup. P1 the unowned but revealed plot is the critical link. The code CvPlot::isTradeNetworkConnected(const CvPlot* pPlot, TeamTypes eTeam) includes this section which says that if a plot is unowned both plots must be revealed in order to become part of the same plotgroup:
Code:
[SIZE="3"]if (!isOwned())
{
	if (!isRevealed(eTeam, false) || !(pPlot->isRevealed(eTeam, false)))
	{
		return false;
	}
}[/SIZE]
Therefore the test "is P2 connected to P1?" fails since P1 is unowned and P2 is unrevealed. But the test "is P1 connected to P2?" succeeds since P2 is owned so that it's enough that only P1 is revealed.

In the save Joao's current plotgroup must have got calculated using the direction P2-->P1, but any recalculation will use P1-->P2 (I don't know why) and thus split the old common plotgroup in two new separate plotgroups; the connection is lost...

This is a very special and rather rare situation for this bug to show an effect plus the connections will "heal" over time by new routes being built and expanding culture, but it is irritating and I think it can be fixed by changing the above code lines in order to achieve isotropy/bidirectionality. (Include in an unofficial patch? - I'm afraid Dresden is suffering from "Solver Syndrom":().

Code:
[SIZE="3"]if ( (!isOwned() && !isRevealed(eTeam, false)) || (!(pPlot->isOwned()) && !(pPlot->isRevealed(eTeam, false))) )
{
	return false;
}[/SIZE]

You are right rolo, the barbs are always last to play during an IBT, so AI-barb interaction in a single IBT couldn't explain the phenomenon completely. Also, a barb Galley would need to perform the blockade mission which is only implemented in the Better-AI code. The Galley merely sitting on a coastal tile will have no effect on the trade network.


Difference between trade network for resource trades and trade routes for cities:

As mentioned above resource trades require the capitals' plots to be in a common plotgroup of 1 or both of the 2 potential trading partners (it won't work if both plots are in the "home" plotgroup of a third player), whereas the prerequisite for city B to show up as a trade route in city A's city screen is that the owner of city A has city B's plot in the one plotgroup of his which also includes the plot of city A (this does not have to be his "home" plotgroup which includes his capital's plot). If you cancel Open Borders with everybody but Joao, Braga will be the only Portugese city available for a trade route in 410 BC. But after 2 turns (Joao builds road and you need to update your trade routes) all of Joao's cities will be available.
 
Top Bottom