File: Trade Roads – Determination of the Bonus Road and Railroad Connection: (SlowThinker)
General algorithm (bug-free situations)
So I post my version of the goto algorothm. I'm not sure about everything, since only quick tests were done.
I will use the word
Path in place of trade route, because Paths are important not only for caravan deliveries, but also for blocking barbs for example (see my post in
partisan barbarians won't attack your partisans ).
First of all, I want to add
rule 0. It looks it is self-evident but it is good to express it:
There is always just one Path from point A to point B.
If Path goes from A through B to C, then Path from B to C is the corresponding sub-Path. In other words, in order to understand the complete Paths between any pair of points A and B on a given map you need to know only the 'direction' from A to B (for any pair of points A and B), i.e. only one step from square A to B. Then if you want to know the whole Path between A and B you can construct it step by step.
Now we can suppose we have a general situation - point A is the starting point and B is the destination, and
there may be obstructions on the map. Point A has 8 neighbours and the question is: which one represents the
direction to B?
Step 1
Say the distance (the 'movement' distance - i.e. number of steps of a Warrior) from A to B is
Dist. Candidates for the
directon are all neighbours with distance to B equal to
Dist-1. If there is only one such a neighbour then this one represents the
direction.
(This is equal to Zenon's point '
1. Shortest Way'. But I claim this is valid also for a map with obstacles (see paragraph 'Obstacles' at end of this post: I tested Ocean only). So I disagree with Zenon's sentence:
2. Obstacles on the trade route: If there is an obstacle the trade route is regular until it reaches the obstacle. )
Step 2
Otherwise (i.e. if there is more than 1 shortest direction) the direction is chosen in accordance with the
Civ2 Pathways diagram.
If this square is obstructed a 'secondary' direction is chosen. 'Secondary directions' are defined firmly for each square - you can imagine there is a diagram of
'Civ2 Secondary directions' - analogous to the
Civ2 Pathways diagram.
If secondary direction is obstructed then a tertiary direction is chosen (again you can imagine there is a diagram of
'Civ2 Tertiary directions') and so on.
(This step was not tested thorougly.
I didn't have time to be able to compare Step 2 with Zenon's paragraph
2.Obstacles on the trade route and to test differences)
Obstructions:
A square with an obstruction can be Ocean or enemy unit or enemy ZOC (any other?). I tested Ocean only: Civ2 counts with Ocean in advance, i.e. Civ2 chooses a shortest way with respect to Ocean squares. I have a feeling that enemy units are taken in advance also, but enemy ZOCs are ignored until they are reached by the unit. Can you confirm if this is true?
A note: I suppose enemy units don't destroy a Path (and a trade route with bonus) completely but they only redirect it. Is this true? It could be exploited: to block an AI unit on a specific square...
Bugs
The Paths don't always correspond to the algorithm in my last post. There are some bugs in the behavior of Civ2:
1. Civ2 remembers previous maps. If you reload a different map the Civ2 still 'thinks' about an old one:
Load the nolake.sav, GoTo Rome (5 steps are enough). Then load lake.sav and GoTo Rome again: The Warior will move as would be moving on a map without the lake.
Now quit Civ2 completely, run Civ2.exe again, GoTo with lake.sav first then GoTo with nolake.sav.
2. Civ2 remembers previous movements and adapt present movement to them.
(I wasn't able to repeat the test. I need more time or I was wrong.)
Warning: Also trade route are affected temporarily by these bugs.
File:
Phantom Roads and Railroads: (samson)
Phantom Roads and Railroads
I don't know if this tactic is well-known or not. But it is consistent and quite exploitable.
The existence of a road or railroad between the Source and Destination cities of a Trade Route increases the value of that Trade Route by 50% or 100% respectively. Surprisingly, the road/railroad does not actually have to be complete in order for the Trade Route to receive this bonus.
If a city belonging to the same civ as the Source city exists along the qualified route between the Source and Destination city, the road/railroad needs only extend as far as the interposed city to earn the bonus. Apparently, the algorithm that checks for a qualified road/railroad route stops as soon as a city is encountered and never checks the remainder of the route to the Destination City.
This means that an SSC can reap the full benefit of road/railroad bonuses on its trade routes to a far-off foreign megalopolis by building a road/rail connection to a local 'station' a mere 2 or 3 squares away. The 'station' must be located along the qualified path between the two cities. This location can be found by using to GOTO command to send a settler to the remote city and then terminating its travel just outside the SSC's city radius and founding a new city. When the road/rail is complete to the 'station', the full bonus will apply on trade routes to the foreign city.
This tactic not only allows road/rail bonuses to be attained quickly and with much less effort, but also makes the trade route bonus less vulnerable to disruption by non-allied units or pillagers. Foreign troops interposed on the 'phantom' portion of the road/rail have no effect on the trade route.
Trade route bonuses achieved in this way still suffer from other limitations of the road/rail bonus. For example, the trading cities can still be no more than 22 squares apart and they cannot cross the '0' meridian.
This tactic will affect only the Source city's trade route. To obtain the bonuses for the Destination city, a second 'station' must be built near it along the reverse qualified route. It is also this 'return route' which is used in Caravan Delivery Bonus calculations.
Other samson post (Q&A):
debeest -
Quote:
Your last sentence puzzles me, though. For the delivery bonus, my understanding is that the route is unimportant; what matters is the distance, as calculated by Civ's odd methodology. Am I missing something?
Yes. The Delivery Payment has a variety of bonuses that can increase the base payment, among then a Road (50%) and Railroad (100%) bonus. What I'm saying here is that the route required for the Delivery Payment bonuses is the return route (the Destination-to-Source road) and
not the Source-to-Destination route which the Trade Route bonus requires. For further information, see my post 'Calculating Caravan Delivery Payments'.
Solo -
Quote:
Can the road route connecting the "station" to the Destination city meander around, or must it also be along the optimal GOTO path?
No, it can't meander, it must follow the optimal GOTO path.
To clarify, for the Source City to receive the road/railroad trade route bonus, it needs connection to a station on the Source-to-Destination route. For the Destination City to receive the trade route bonus, it needs connection to a station on the Destination-to-Source path. Most often these two routes are different. The onetime Delivery Payment road/railroad bonus depends on the Destination-to-Source route.
Quote:
Also, will connecting this road to other Destination cities affect the railroad bonus for the Source city?
What do you mean by 'this road'?
Thoddy -
In your referenced post, you state:
Quote:
Yes, it seems so, that building roads on the opt. path outside the city radius is not neccessary.
This is not exactly correct. Merely building roads within the city radius is insufficient. The road must connect to one of your own cities which lies on the optimal path to the Destination City. If the interposed city lies well outside the city radius the road has to be built all the way to it.
SG2 -
Quote:
The rule of 22 squares - that means that no benefit can be obtained from any transport link greater than this distance? If so 22 seems a strange number ... any thoughts?
Correct. The 22 squares rule means than no Road or Railroad bonuses can be obtained if the two cities are more than 22 movement squares apart, no matter what route is involved. Two cities 22 squares apart connected by Railroad in a direct E-W line receive the 100% railroad bonus. If they are 23 squares apart, they do not.
I agree that it is a strange number and it is
not the same as a 'distance' of 22. Distance in Civ2 (as measured by the rectangle method or the formula I posted under 'Caravan Delivery Payments') counts distance in the E-W and N-S direction as 1.5 and NW/NE/SW/SE direction as 1. But the 22 squares rule is based on 22 movement points.
I'm sure you're right about receiving the 'phantom road' bonus often in game play and not recognizing why the route is greater than expected.
In the attached picture, the newly founded city of Atlanta is a 'station' for Washington. It lies on the GOTO path from Washington to Paris, from Washington to Orleans and even on the Washington to London path. In Washington, trade routes to any of these cities will receive a 50% Road bonus by virtue of the short road from Washingon to Atlanta.