An idea on how to hard-code tile selection for border growth

Joined
Aug 21, 2019
Messages
757
I'm not sure if it's possible to hard-code the logic for which tiles would be selected by the city when the borders grow, but if it is, it might be prudent to discuss what order of priorities the code would follow. Here's my idea and I encourage you all to share your ideas. In any case, I hope the current logic behind border growth tile selection changes, because it can be quite vexing at the moment.

#1 Priority: Natural wonders
(#1.5: Tiles with antiquity sites - for later in the game when they appear)
#2 Atolls
#3: Strategic resources on tiles without forests or jungles
#4: Strategic resources on tiles with forests
#5: Strategic resources on tiles with jungles
#6: Tiles with marble (for bonuses to wonder production)
#7: Luxury resources on tiles without forests or jungles
#8: Luxury resources on tiles with forests
#9: Luxury resources on tiles with jungles
#10: Forests with deer
#11: Oasis
#12: Fish, lakes
#13: Hills with stone (because of stone works and bonus to wonder production)
#14: Grassland and plains with stone (because of stone works and bonus to wonder production)
#15: Wheat tiles
#16: Bison, cattle and sheep tiles
#17: Flood plains
#18: Banana tiles
#19: Forests without resources with fresh water access
#20: Jungles without resources with fresh water access
#21: Grassland and plains without resources with fresh water access
#22: Forests without resources without fresh water access
#23: Jungles without resources without fresh water access
#24: Grassland and plains without resources without fresh water access
#25: (non-snow) Hills without resources
#26: Coastal tiles without resources
#27: Ocean tiles without resources
#28: Flat tundra without resources
#29: Flat desert without resources
#30: Hills on snow
#31: Flat snow
#32: Mountains (special code exception for the Inca?)

Not sure where to put: Stone tiles on flat desert and flat tundra

Also, could we code so that between two equally valuable tiles those bordering on another minor/major civ would be prioritized. That way you'd first grab those tiles more in danger of getting snagged by the AI/CS, and only later those that are "safe" and "can wait".

I think we should limit the code to take into account only the adjacent tiles, not tiles two expansions away. So if there's an unclaimed mountain 2 tiles away from the city and a natural wonder 3 tiles away from the city, the code wouldn't prioritize getting the mountain and then the natural wonder, but would still have the mountains last as priority, because otherwise it would get too messy.
 
Last edited:
I value strategics more for offensive&defensive purposes, plus they are, as Heinz said, more valuable as a trade commodity.
 
One thing I always find strange is how the game always zooms in on sea tiles, which I am not complaining about, but even if you don't have a port, which in most cases they are useless.
 
D'oh, I forgot about atolls and mountains, thanks for reminding me! If possible, Incas could get a slight to the hard code to have mountains higher.
 
Stalker0, I know what you mean, I wasn't sure exactly which order to put them, but I thought that with all of the above, you'll usually have plenty of production and you'll need farmable tiles more. But I see your point.

Also I edited the OP to add the question of whether we could code so that between two equally valuable tiles those bordering on another minor/major civ would be prioritized. That way you'd first grab those tiles more in danger of getting snagged by the AI/CS, and only later those that are "safe" and "can wait".
 
Stalker0, I know what you mean, I wasn't sure exactly which order to put them, but I thought that with all of the above, you'll usually have plenty of production and you'll need farmable tiles more. But I see your point.

Also I edited the OP to add the question of whether we could code so that between two equally valuable tiles those bordering on another minor/major civ would be prioritized. That way you'd first grab those tiles more in danger of getting snagged by the AI/CS, and only later those that are "safe" and "can wait".

Then there is the third layer of complexity. Lets say that a natural wonder is 3 tiles off from your capital. At what point will the system go for it, even if it means having to get a very low priority tile in the mean time.
 
Then there is the third layer of complexity. Lets say that a natural wonder is 3 tiles off from your capital. At what point will the system go for it, even if it means having to get a very low priority tile in the mean time.
Y, so maybe we shouldn't think of it as priorities, but as a score. For example natural wonders and resources would give much score to the tile they are on and also some score to neighbouring tiles, so they have higher value. Also proximity with a City State or another AI could give some score to tiles to focus on these in the first place. The problem is that these numbers would need to be tweaked.
 
There is also the special case where a pantheon increase the value of a tile (for the player, not the border growth algorithm).
Desert and tundra mainly (god of the sea doesnt have this issue since those tiles are already high prio).
Petra also makes desert tiles slightly more valuable (but if I build it its mainly for the extra trade route).
Getting hammer tiles in desert and tundra is currently very expensive and you basically need to settle next to hills.
 
Your algorithm doesn't account for bananas, bison & wheat (the remaining bonus resources if I'm not forgetting one myself)

Also, it would prioritize luxury resources on desert highly which may not always be great in terms of yield.
Desert stone should be really low IMO.
Fish should be fairly high (right before or right after stone hills).
Floodplains at about the same level as forests/jungles. Perhaps above since it's easy to build a farm on them for +2f.
 
Thanks, I forgot to add about bananas, bison & wheat, I'll think about where to include them. Where would you include them? I think bananas would be lower than other bonus resources, since you need calendar to improve them?

I think it's ok to prioritize luxury resources on desert tiles because you want them asap for monopoly bonuses, happiness and exports. All luxuries on flat deserts are imho worth working once improved.
 
Probably good to mention that for a hard coding as this, it would be nice if it worked with resource mods like "even more resources".

I do think that it'd be better, if this could be regulated through governor. Governor should in theory be better at knowing what tile will be good to have at that particular time, as opposed to a static time independent predetermined ordering. If that's not working well, improve the governor, instead of hardcoding this ordering.

Lastly growing specifically to other civs/CS means that they will also grow towards you, which will just create arbitrarily more strife. If you really want those tiles, buy them in my opinion. This makes it more of a conscious choice to have contentious borders, which is a lot more interesting and there is even diplomacy build around that that buying tiles near them may make them send a threat to you.
 
I also don’t like it prioritizing stuff based on what’s a ring further out. You should just buy that tile if a really good tile is further out and then with this system u will get it properly. Nothing is worse than buying a tile so you can naturally claim a good one further out and then it doesn’t even want that tile.
 
I think we should limit the code to take into account only the adjacent tiles, not tiles two expansions away. So if there's an unclaimed mountain 2 tiles away from the city and a natural wonder 3 tiles away from the city, the code wouldn't prioritize getting the mountain and then the natural wonder, but would still have the mountains last as priority, because otherwise it would get too messy.

Stalker0, on turn 20, would you rather have your city grow to grab a tile with cattle or a tile with bananas? I'd take cattle 10/10 because odds are I'll research animal husbandry waaaaay sooner than calendar, especially if I don't have any plantation luxuries.

Solic, I get what you mean, but I think it's historically accurate that civs tended to grab land towards their neighbours to claim unclaimed land, and it makes sense that this lead to increased tensions, so it wouldn't be "arbitrarily".

Andersw&CPPMaster, that would be great if we could take into account pantheons and do it based on a score system, but I fear it would be too complex to code, so for the time being I'd rather having this system that is a bit more crude, but imo still a lot better than the current one.
 
Here's an example from the current version, with the tile expansion ignoring Flood plains with wheat and Gold on a hill in favour of normal Flood plains.

Solic, I honestly have no idea!
 

Attachments

  • 20201227095741_1.jpg
    20201227095741_1.jpg
    356.3 KB · Views: 53
Top Bottom