Thank you for all the input, everyone, lots of good stuff here.
"Forward settling" and "settling too near the AI" are distinct from each other. The latter triggers the expansion warning, the former will trigger additional aggression for your bold move.
If an expansionist AI were to pop up and complain about the player being in the way of their forward settling, that should be its own message (the AI being an aggressive jerk, not "you're settling too near me").
Current logic (as of 1.2.1, which fixed the AI counting conquered cities and considering the whole world theirs):
- City is within 5-7 tiles (depending on AI's Boldness/UA) of one of the AI's cities, and was founded after that city was most recently acquired by the AI
- City is not conquered or the player's original capital
- City was founded less than 30 turns ago
- City is closer to the AI's city than to the owner's original capital
Too simple, unfortunately - it doesn't distinguish between "player is naturally expanding into my territorial sphere" and "player is settling outside of their normal settling range just to claim my lands", the latter of which is what I'm looking to define; in addition if any city closer to the AI's capital than your own is a forward settle that would result in a lot of AI aggression. It also doesn't account for more complex cases like looorg has mentioned.
I like this idea in principle, although I don't see why the range should differ based on difficulty level. The flag would be redundant codewise since the distance is being checked every turn anyway.
Cities that don't trigger the expansion warning can still count for territorial disputes, which is a major source of AI aggression.
What if your second city is next to their capital and 20 tiles away from yours? I do like the simplicity of this solution otherwise. It doesn't account for multiple forwarded settled cities, though.
It's easy for a human to look at the map and intuit natural growth boundaries based on defensible territory. It's much harder to train the AI to do this; not a feasible solution unless you can come up with a precise definition that works in every geography. It would also be a performance hit.
AI's desire to expand can fluctuate so I don't want the AI to be fine one turn and pissy the next, thus it won't be considered. It is considered in the territorial dispute modifier, though.
Not a bad idea, but it misses the part about needing to be close to the AI.
Also by settling cities far away in other directions you could increase D and thus make R lower, so this is exploitable. At a cost, but it's not logical for the AI to ignore a city near them just because you're playing poorly (or are Polynesia).
Number of hexes is simpler and more consistent than religious pressure or trade route paths.
This is the most detailed proposal and I like how comprehensive it is, although it's very complicated logic to implement just to handle forward settling. Perhaps.
However, it doesn't account for settling multiple forward settled cities at the same time.
I think your plan of excluding isolated cities (I assume the ai's) is enough. Like, if an ai settles a city close to their own sphere then sees a player settling near them, it could consider that as a threat. This said, maybe more expantionist civs could be more likely to give a warning if their cities are far from their own (and near the player)
"Forward settling" and "settling too near the AI" are distinct from each other. The latter triggers the expansion warning, the former will trigger additional aggression for your bold move.
If an expansionist AI were to pop up and complain about the player being in the way of their forward settling, that should be its own message (the AI being an aggressive jerk, not "you're settling too near me").
That said firstly what is it that really triggers it now? Cause it seems to be wonky sometimes where they start to complain where or when you settle some place and they are not even close to that place but they somehow seem to think that all the world is theirs and no matter where you settle you are in their sphere.
There is always going to be some kind of edge cases that can be constructed where more or less any idea will come of as bad or stupid. So perhaps do not try and make it work for every single or possible scenario or geography. A pangaea should or could be very different from a map that is just tiny islands or maps with enormous amounts of mountains etc. So it might not only be tile distance but also tile content.
Question might be some kind of definition of what is a forward settled city? In some regard I think it could be a few different things but mainly I would say it's a city that is placed by leaving your core and moving closer to the enemy then you are to your own land/border.
That said there has to be more cause eventually then things are just going to count as forward settling no matter what as borders keep pushing towards one and another.
Perhaps one could also check for foundation turn and then keep track of how it looked at foundation. But it might be or become to complex, or not even possible.
After all there are just a couple of different ways to settle. Either you have some kind of natural growth where you sort of settle close and the grow out OR you go for some kind idea where you strike out far away from the capital and then you backfill later. Usually to claim some strat resources, luxuries or a natural wonder. When you go long you sort of want to signal that everything behind this city, or between this city and my capital, is mine.
Judging from the things that can be pulled from the DLL not all of them are very interesting or useful in that regard.
Current owner could be interesting, in some scenarios more then others.
Original owner not so much in relation to the current owner, it should triggers other grievances if anything.
Previous owner could be a long list or is it just the more recent one in which case it's often going to be the same as either the first or second option. So that isn't all that interesting either.
Founding turn could be crucial if you can also recall what the border situation looked like at the time. Otherwise perhaps not so much.
Recent change, not that interesting. After all if you are in a war and conquer a city it's not really forward settling. It's taking city as part of a war. It shouldn't really count as forward settling. It might lead to border disputes, warmongering penalties etc and that could anger them but it's not really forward settling. Or? I personally don't think so. It should be naturally placed cities (by settler, you have to be both the current and original owner and it can't be a city-state etc). If it counts as both forward settling and warmongering and/or taking their capital or whatever then you are sort of double dipping into the grievances. Which may or may not make sense. But it's weird for them to be angry about both the war and that it also somehow counts as you settling a city near them.
List of players city, a total number can be gathered. At least in theory the more cities you have the more distance there should be from your capital and core cluster. That said new clusters of production and yields can usually form around conquered capitals as they tend to have fairly good land. Not sure that by itself constitutes as forward settling.
Distance should probably be the primary maker.
Current or previous Capital probably doesn't matter as far as forward settling either. As noted previously other grievances might matter more then such as you are controlling their previous capital or you have conquered a city-state or whatnot.
Perhaps some kind of ration of your total number of cities and the distance to your capital (from the city in question)? Compared that ratio then to the distance to the AI capital and their number of cities, or their ratio. Some number will be considered to be ok and others will not, possibly depending on leader type and their relation to you in general. Perhaps discount various outliers if there are just one or another city that is totally screwing with the ratio. As in what would the ratio be if that point (or city) wasn't part of the equation.
That is if you think all nations should be clumped around the capital. They sort of usually are in some way, even tho it might not be the exact geographical center of the domain. But there are not a lot of nations that have piece of land here and another there but they are somehow really connected by land in between. There is no unclaimed land in reality, eventually there won't be in civ either but it could be at the time cities are founding in the early to mid game.
At worst then you could just slowly creep up on each other. Eventually you will. It might promote a certain playstyle or settling strategy.
The longshot foundation at the start, or in the early game, if you leave your close proximity to the capital will almost always probably then be a grievance or count as a forward settle.
Current logic (as of 1.2.1, which fixed the AI counting conquered cities and considering the whole world theirs):
- City is within 5-7 tiles (depending on AI's Boldness/UA) of one of the AI's cities, and was founded after that city was most recently acquired by the AI
- City is not conquered or the player's original capital
- City was founded less than 30 turns ago
- City is closer to the AI's city than to the owner's original capital
Milae on discord used the idea of “you settle closer to a foreign capital than your own”
thaf feels like a simple yet solid definition to me
Too simple, unfortunately - it doesn't distinguish between "player is naturally expanding into my territorial sphere" and "player is settling outside of their normal settling range just to claim my lands", the latter of which is what I'm looking to define; in addition if any city closer to the AI's capital than your own is a forward settle that would result in a lot of AI aggression. It also doesn't account for more complex cases like looorg has mentioned.
What about if you got the average distance each city from the capital and used it to flag whether a city was generic expansion or a "colony". You could set a hard minimum for the initial settling phase so you don't get wonky results and assign modifiers based on difficulty. For purposes of settling disagreements, colonies would be ignored by the owner of the colony cities.
I'm thinking something like....
Code runs a calculation for each civ when a city is settled and determines their "fair settlement sphere (FSS)" that is based on the average distance each city is from the capital plus the modifier. Cities that are settled outside this value are flagged as colonies and ignored for purposes of calculation of averages. After each city placement, the FSS is recalculated, and cities are checked to see if they need to have the "colony" flag removed for purposes of future calculation.
Let's run a scenario and assume for Immortal difficulty, the modifier is 7 tiles. Austria's average distance from the capital is 7 tiles, so they have a FSS of 14, meaning any city within 14 tiles is considered normal growth. Now Austria has settled a new city, NewCity. A check shows that it is located 12 tiles from the capital so it is considered normal..
Let's assume Austria settles a second city, NewColony, on the frontier that is located 20 tiles away and towards Germany's borders. Because NewColony is outside the FSS, NewColony gets a flag so the code knows to ignore it when considering whether Austria gets upset at German growth. (Germany might, however, be peeved at Austria for the new city.) Now over time, Austria grows towards NewColony with additional cities. Each time a city is settled, a check is ran to see if NewColony still deserves the "colony" flag. As some point in history, Austria's FSS expands to include NewColony at which point the "colony flag" would get dropped, and Austria would treat it like any other city.
***
I think this idea would work and is pretty straightforward. My hesitation is in those cases where your capital is on the edge of your borders, and you are growing in the opposite direction, but I think the ever increasing average distance would automatically adjust for it. I'm also wondering how it would do for the more maritime civs that might generally have more widely spaced cities from island settlements.
I like this idea in principle, although I don't see why the range should differ based on difficulty level. The flag would be redundant codewise since the distance is being checked every turn anyway.
I mean you can already forward settle every AI once with no penalty. If land is super tight it probably should lead to conflict.
And while a more complicated system might be better if it works that is a big if. Humans often don't agree on what counts so expecting AI to work it out all the time seems very hard.
Cities that don't trigger the expansion warning can still count for territorial disputes, which is a major source of AI aggression.
Maybe it should satisfy multiple criteria to count as forward settling someone:
1) Closer to their capital than your own
2) Within at most 7 tiles of their nearest city
3) Not your 2nd city
What if your second city is next to their capital and 20 tiles away from yours? I do like the simplicity of this solution otherwise. It doesn't account for multiple forwarded settled cities, though.
I would agree with the "closer to my capital than their capital".
But, another thing to consider is how easy it is to defend a city. For example if there is a mountain range between me and another civ I will often consider my territory to be up to the mountains because after that it's harder to defend. Does the AI have methods for evaluating how defensive a city is? If not then it's probably too much to implement but if it already exists it could be used as part of the evaluation.
And another thing is how many cities I'm planning on. If I'm progress then I'll want a lot more cities than tradition.
What about initial generic territorial borders be established upon founding the capital based upon the topography of the map surrounding the area?
I have a tendency (Am guessing most do as well) to use mountain ranges/hills/rivers/coastlines/desert edges/tundra to establish a natural defensive perimeter for overall territorial expansion/city foundation where the 2nd, 3rd, 4th (Sometimes I found towards 7 or 8) city establishments will be positioned strategically, based upon the discovered resources in the localized areas within the region from my capital (Whilst maintaining tile connection within city borders to 'close off' my land to those that are not friendly.
Very few times I will push past those natural borderlines due to having very close neighbours, in which case it is more likely than not I settle my first few cities farther then 'fill in the gaps' to establish control of the region.
With city cultural acquisition of new tiles, I have noticed it generally does not pick up those tiles that are poor in yield unless there are tiles beyond them that are high yield, even then those tiles will be sought after for natural expansion when there is little else closer or those tiles beyond are quite high in yield (Generally favouring food acquisition)
Edit: It took me over 2hrs to write this... Never saw rsc2a's post (Multi-tasking first thing in the morning is not the best idea)
It's easy for a human to look at the map and intuit natural growth boundaries based on defensible territory. It's much harder to train the AI to do this; not a feasible solution unless you can come up with a precise definition that works in every geography. It would also be a performance hit.
AI's desire to expand can fluctuate so I don't want the AI to be fine one turn and pissy the next, thus it won't be considered. It is considered in the territorial dispute modifier, though.
Calculate a mean position of all your cities as the center of your civilization and call it C. Then Calculate mean distance of all your cities to C and call it D. Then calculate distance from the new city to C and call it N. Divide N/D to see how relatively far away the city is from the center of your civilization and call it R. Do the same for AI. If your R is higher than AI's R, then you are forward setting.
C = mean(your cities positions)
D = mean(distance from your cities to C)
N = distance from the new city to C
R = N / D
Player forward settling = Rplayer > Rai
I think that this simple formula would work in most scenarios. The distances could be calculated either by number of hexes or trade route distance (which is the same as religious pressure distance?)
OR
Calculate hypothetical passive (or active via TR?) religious pressure assuming the same number of believers in all your cities to the city. Do the same for AI. If AI's pressure is higher then you are forward settling.
Not a bad idea, but it misses the part about needing to be close to the AI.
Also by settling cities far away in other directions you could increase D and thus make R lower, so this is exploitable. At a cost, but it's not logical for the AI to ignore a city near them just because you're playing poorly (or are Polynesia).
Number of hexes is simpler and more consistent than religious pressure or trade route paths.
For each civ, initiate its pissy territory as a circle centered at the capital with radius 7.
For each new city founded or captured:
If new city is within existing pissy territory, add the new city to the city cluster. Otherwise it's a colony with its own new cluster.
Include 4 tiles around the new city into the pissy territory.
If a cluster is updated (through city loss or gain), calculate the center of the cluster using the average of coordinates, then draw a new pissy territory circle with the diameter equal to the longest distance between all pairs of cities within the cluster.
If an old city is now included in the territory, add that to the cluster too and update the territory again until no more city can be added.
Pissy check:
If civ A founds a city within civ B's pissy territory but not their own, it's a forward settle.
This is the most detailed proposal and I like how comprehensive it is, although it's very complicated logic to implement just to handle forward settling. Perhaps.
However, it doesn't account for settling multiple forward settled cities at the same time.