More on Cultural Expansion & Gold Costs
After rho21 made the inquiry and I provided a summary answer I took a deeper dive back into the Civ 5 code and some SP Civ 6 save files to see if I could make some headway as to what’s going on. I think I’ve got some “new” info on this.
Gold Cost to Buy Tiles
It’s been observed that gold cost goes up the more techs and civics are researched. After looking at some saves and checking various civic & tech counts against purchase costs this formula has turned up yet again:
FLOOR(BaseCost * (1 + Multiplier * FLOOR(100 * MAX(CompletedTechs / 67, CompletedCivics / 50))/100))
For second ring tiles the BaseCost = 50 while for third ring tiles BaseCost = 75. In both cases the value for Multiplier is 4.
What Tile is Being Picked (and why we all when it makes no sense)
I plowed back through the Civ 5 SDK source code and found the function GetBuyablePlotList in CvCity. Civ 5 selects the next tile to pick in the following manner:
1) Determines the “influence distance” and multiplies it by iPLOT_INFLUENCE_DISTANCE_MULTIPLIER. The influence distance is the shortest
passable route to a tile from the city. The function used to find this distance is a pathfinding routine. This means a third ring tile blocked off by mountains or other impassible terrain has an “influence distance” greater than 3. It also means that if there’s no path to the tile it will not be picked up by the tile picker. The value here is referred to as an “influence score”
2) If the distance to the plot is greater than the maximum distance from the city (hardcoded as the 5th ring) the influence score is increased by 100 (iPLOT_INFLUENCE_RING_COST in Civ 5)
3) If the plot is a water plot the influence score is increased by 25 (iPLOT_INFLUENCE_WATER_COST)
4) If the plot has an improvement and the improvement is a barbarian camp the influence score is increased by 100 (same variable as in Step 2)
5) If the plot has an improvement that is not a barbarian camp the influence score is decreased by 5 (iPLOT_INFLUENCE_IMPROVEMENT_COST)
6) Civ 5 checks for roads and adds the road influence cost if roads are present. Civ 5 has the roads influence cost set at….zero.
7) If there’s a resource then 105 is subtracted from the influence cost (iPLOT_INFLUENCE_RESOURCE_COST)
8) If there’s a natural wonder then 105 is subtracted from the influence cost (iPLOT_INFLUENCE_NW_COST)
9) The total available yield from the tile is calculated and subtracted from the influence cost (iPLOT_INFLUENCE_YIELD_COST)
10) If the plot is not adjacent to the city's territory then the influence cost is increased by 1000.
11) The tile picker chooses the lowest score and that’s the next tile.
Look in GlobalParameters.xml and you see all of the above variables (minus the starting "i") with all of the above values.
There are also some extra values, such as the distance multiplier and distance divisor. However, the Civ 5 routine used these variable names in the routine that determined the
cost of tile purchases. There’s also terrain values in Terrains.xml as pointed out by srgtb.
Let’s score out Irukandji and see what that looks like, assuming we use the above process and add in the terrain influence values at the end:
Hmmm….the spices score less than the citrus so should be the first tile picked. What’s going on?
Civ 5 used a
pathfinding routine to determine the distance, not absolute tile distance. What if the “influence distance” is “movement distance”? Using the distance as Movement Points expended to reach the tile, counting river crossings as zero, Irukandji rescores as
This puts the citrus first in the tile picker but also moves the wheat ahead of the spices.
I checked some of my other saves and noticed one case where a 2
grassland was being picked over a 2
/1
grassland hill tile. This also applies in the case of srgtb’s observation of a plains hill tile being picked over a plains forest tile. In both cases the “better” tile took more movement points to enter.
What about 3rd ring vs. 2nd ring? The easy answer is to add the PLOT_INFLUENCE_RING_COST value multiplied by the ring position to each score . Thus all 3rd ring scores will be 100 higher than a similar 2nd ring tile score.
Now, how to test this out? Well, I’ll score out each city’s 2nd ring when it’s founded and post an image showing the scores. As the game progresses we can see if the scores properly anticipate the tile picker. Note that buying tiles shouldn’t matter in most cases as the picker will move to the next lowest score. In the case of Irukandji we won’t find out if I’ve scored the spices correctly because I’ll be buying that tile before the city acquires both citrus and the wheat.