_1. Mod version (i.e Date - 4/17):_
4/17
_2. Mod list (if using Vox Populi only, leave blank):_
_3. Error description:_
I've noticed that in my games almost every AI that isn't going for tall 3 cities is forward settling the human player. Not sure if this is bug or intended but AIs decides to skip 40 tiles of perfect land just so they can settle near human player on a mediocre location. 1 or 2 AIs do this every game (deity difficulty, epic speed, all kinds of maps) and if I don't take all spots I wanted by turn 100-120 they just make city right in my face, sometimes even between 3 or 4 of my cities. This isn't game breaking bug, but it's extremely annoying because it forces you to play a certain playstyle every time, you have to settle fast and sometimes on bad spots just so you can control that part of the land and prevent AI from taking it, not to mention diplomatic issues with the whole world for taking or razing city.
_4. Steps to reproduce (optional):_
Supporting information:
Please note that you can attach .zip files by dragging-and-dropping them. If possible, zip up all supporting data and post that way.
Log files (always attach your Logs folder, located at My Documents/My Games/Sid Meier's Civilization 5. Make sure you have enabled logging before experiencing an error! Go here to find out how: http://forums.civfanatics.com/showthread.php?t=487482):
Save game (always attach a save that was made a turn before the error; located at My Documents/My Games/Sid Meier's Civilization 5/ModdedSaves):
CvMiniDump.dmp file (attach if experiencing a game crash. Located at Program Files/Steam/steamapps/common/Sid Meier's Civilization V):
Screenshots (optional):
do you have screenshots?
@ilteroi Different player has a screenshot in this post: https://forums.civfanatics.com/threads/new-beta-version-april-17th-4-17.657164/page-25#post-15777880
The AI did this to me often in a recent game. I have a couple screenshots, all of these are of the AI settling cities not on their main continent:

Japan settled on a two tile island. Note they don't have oil revealed so the only resource is stone and 2 fish. This was not near their continent, it was on a set of islands near my continent. I had already settled one of the islands (you can see my (Aztec) borders in the screenshot) and then japan settled there. I later took the city.

Ottomans settled here in tundra. They don't have aluminum revealed so the only resources are 3 deer and a fish. Also they later declared war on me, twice. Second time I took this city, the only improvements were camps on two deer tiles and a farm was started.

England settled here. They do have oil revealed but not aluminum. So the resources are Oil, 3 fish, 1 stone. The coffee was part of a different city so they can't get that resource.
Overall AI settles cities fine early game, but then around industrial and later they go on a settling spree for some reason, and they often settle pretty bad spots that are close to the human player. From the other screenshots I've seen this even happens with Tradition AI and sometimes they ignore good settlements nearby in favor bad settlements close to others.
Sry I don't have screenshots, i'll try to make them in future games. Anyways I started this thread because of early game forward settling because it's far more impactfull, mid/late game forward settling is lesser problem imo but it boosts strongest military civ by giving it easy conquerable cities.
From my experience if you let the AI be they'll settle every available space, even the tradition ones.
Screenshots later when I get back home.
Edit:

There's absolutely no reason to settle there other than filling space.

This one was eventually conquered by a nearby city state.

Is 6 Oil worth settling cities like these?
@InkAxis will you prefer that there were a free space without cities?
p.s.: I always settle the same(like AI). In worst way I will just lose that cities. Currently when % of science and culture are recalculated after city loss - that is not a big problem.
We talk about this in this thread and we agree that it can be used in certain situations by Humans but the AI just can't defend these cities. So what happens is that the AI loses yeilds, happiness, diplomatic relations, cities, and gains war weariness. Also the opportunity cost. And this even happens for AIs that already have enough cities, but they start settling cities badly anyway. It's not a strategy the AI can do, from their perspective it's not a good idea but they keep on doing it anyway.
there seem to be two issues being mixed up here.
AI is settling in bad places from a yield perspective. This is a fine line, how do you define an acceptable site? What is a good plot, and how many do you need? Does it depend on tech level? Map settings?
AI is settling in bad places from a strategic perspective. again, hard to say what should be a general rule here? How far out is too far? Does it depend on military strength? map size? game speed? What about new continents?
of course the two aspects can overlap as well ... if anyone has a good proposal, let's hear it!
ps: on my mobile, strange things happened while typing
Since there's a score for each settle plot, maybe set a threshold for it so that if the score is lower than the threshold the AI would hold off settling?
Currently AI would always find the next settleable plot if the originally planned one is unavailable.
If you want you can take a look at function at CvPlayer.cpp CvPlayer::GetBestSettlePlot
I think the most simple solution would suffice. @ilteroi Is it possible to code AI so they settle closest available location instead skipping 40 tiles? After all that is also what human player has to do. We settle bad cities just so we can control some part of the map.
I think these are 2 different issues (although connected) that may or may not be treated differently:
1) Settling a crappy spot 40 tiles away in the EARLY game while they still HAVE plenty of good, accessible and defensible spot close to their capital
2) Settling the last available spots LATE game when they DON'T HAVE any good spots near them.
I personally do not have that much problem with #2. And I agree with @susanooooo's solution to #1.
what is the closest available location? 4 tiles out? what if there is another location 5 tiles out which is much better? where is the cutoff between acceptable and not acceptable?
right now, at game start the AI players look at the whole map and compute an "average" city site quality to calibrate themselves to the map. scores are different for each player because of flavor.
when picking a city site later, the score already depends on the distance to existing cities (unless they want to colonize other continents!), but the question is how exactly should this curve look? how steep is the drop, is it linear? does it drop to zero?
i really need a workable definition of "good", "accessible", "defensible" etc, otherwise there cannot be any progress.
Straight up forward imo coding AI to make defensible cities is impossible, even humans sometimes make bad choices. As for closest available location, I personally would code it so AI search distance for city location is max 5-6 tiles from his border. And if possible I would remove this limitation in later eras, or i would simply remove this limitation for pioneers and other guy (I forgot how is third settler called).
I don't think an arbitrary distance limit is a good idea. It tends to make the AI look very stupid in a lot of corner cases by settling just 2 tiles away from a perfect spot.
A lot of versions ago, the AI would just ignore all the good spots on unoccupied islands and continents because they were too far away, which was very cheesy on certain maps because you the Player would be the only one to try settle them (and this usually happened just before unlocking pioneers, so if the AI were to wait for them, that would still put a significant lead for the player).
[In fact, the later you try to colonise initially unoccupied continents, the more the other players already have cities there, so the harder it is to defend your new cities]
unless they want to colonize other continents!
Looking at the screenshots, that's probably the source of the problems. The AI sometimes prefers crappy positions on other islands/continents to good position nearby. Does the code simply ignore distance when settling on other continents? Or is it the distance just capped at something, like "other continent far away = distance 6"?
@ilteroi, based on the observation of MY games and what you have described above, I would say the AI is already doing a good job, but if they send a lone settler 40 tiles away to forward settle the human (or other AIs?), while they have plenty good spots near their lands in @susanooooo 's games, then maybe the distance from owned land is not having a big enough effect on the calculation (= we should try making it stronger)? Or could there be a bug producing wrong evaluation in some cases? Are some AIs programmed for bold forward-settling (while ignoring good spots around them)? I would be against an arbitrary value for settling distance.
And I really think to settle low-quality cities on distant islands (#2 in my previous post) when all good spots around owned land are taken is fine and difficult to avoid (or fixing it could do more harm than good). If the human player is afraid that another civ will - for example - block a naval passage with such a city, then they should plop a city there themselves. The meaning of such city will be purely strategic - like a military outpost.
I think there's a definite lack of consensus here. Maybe this needs its own thread on the forum.
@RecursiveStar On the contrary, I think we all agree on basics, we only don't agree about the numbers which imo are programmers choice.
Everyone agrees on basics, yes, but I think ilteroi's looking for a concrete proposal to be submitted.
i can go look for bugs but in the absence of a spec it can be hard to define what a bug even is.
so yes, i would very much appreciate a document that describes the intended behavior in the necessary detail. otherwise it's only work for me and the discussion won't stop.
@susanooooo start with running tests while tweaking this value BALANCE_EMPIRE_BORDERLAND_STRATEGIC_VALUE
Higher= more valuable; Lower = less valuable.
oh good point, there is also
SETTLER_EVALUATION_DISTANCE --> what is the max distance from a existing city
SETTLER_DISTANCE_DROPOFF_MODIFIER -> inside this range, no score reduction
basically we have piecewise linear multiplier on top of the raw plot score, constant at first, then dropping to zero. the max distance is increased a bit over time.
so most of the requested features are already there, but if you want to do experiments better wait for the next release, i might have found a small bug as well.
Several questions about the current AI:
@susanooooo start with running tests while tweaking this value BALANCE_EMPIRE_BORDERLAND_STRATEGIC_VALUE
Higher= more valuable; Lower = less valuable.
For non-moddy people, the current value is '10' and (I think) you can change it by adding this line:
UPDATE Defines SET Value = '10' WHERE Name = 'BALANCE_EMPIRE_BORDERLAND_STRATEGIC_VALUE';
to the end of /(2) Community Balance Overhaul/Balance Changes/CoreDefines.sql (and of course you need to change the '10' to whatever value you want to test)
oh good point, there is also
SETTLER_EVALUATION_DISTANCE --> what is the max distance from a existing city
SETTLER_DISTANCE_DROPOFF_MODIFIER -> inside this range, no score reductionbasically we have piecewise linear multiplier on top of the raw plot score, constant at first, then dropping to zero. the max distance is increased a bit over time.
so most of the requested features are already there, but if you want to do experiments better wait for the next release, i might have found a small bug as well.
Thank you for this. I already said it before, but I think the AI is already doing a good job (if it was not, the AI cities would be scattered all over the map and we would not be seeing the nice, mostly compact empires we are seeing in our games - at least I am), I would try experimenting with giving more value to the distance factor first before trying to reinvent the wheel.
The current value for SETTLER_EVALUATION_DISTANCE is '8' (I suppose it does not scale with the map size, correct?). Does it mean that after 8 tiles away from your borders the value of "good" city locations starts to decrease by some function of SETTLER_DISTANCE_DROPOFF_MODIFIER (currently = '4') multiplied by the extra distance from SETTLER_EVALUATION_DISTANCE? And also by BALANCE_EMPIRE_BORDERLAND_STRATEGIC_VALUE?
I suppose there is no log to check the result city spot value upon founding? Or at least the value before applying the modifiers. If you expose the code responsible for this, we can do the math offline when AI forward settles anyone 40 tiles away from their land again.
Anyway, let's wait for the next version. I will not ask when it will be ready, because I know it is super-annoying, but you know how much we are looking forward to it :-)
for the curious, here's a build with the latest fixes from recursive and me.
If people would stop HitFixing stuff I could catch up. :)
ha. glad to have you back!
@LoneGazebo I've intentionally been holding off on making changes that could impact stability so as not to interfere with a new full version - my changes since last version have mostly been tweaks and fixes.
Most helpful comment
@ilteroi, based on the observation of MY games and what you have described above, I would say the AI is already doing a good job, but if they send a lone settler 40 tiles away to forward settle the human (or other AIs?), while they have plenty good spots near their lands in @susanooooo 's games, then maybe the distance from owned land is not having a big enough effect on the calculation (= we should try making it stronger)? Or could there be a bug producing wrong evaluation in some cases? Are some AIs programmed for bold forward-settling (while ignoring good spots around them)? I would be against an arbitrary value for settling distance.
And I really think to settle low-quality cities on distant islands (#2 in my previous post) when all good spots around owned land are taken is fine and difficult to avoid (or fixing it could do more harm than good). If the human player is afraid that another civ will - for example - block a naval passage with such a city, then they should plop a city there themselves. The meaning of such city will be purely strategic - like a military outpost.