AI city distance?

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
Has anyone figured out a value that successfully alters the distance AIs tend to place cities?

Back at Civ V's release they'd drop cities halfway across continents to get resources, and I noticed changing this variable had an effect on that:

AI_STRATEGY_MINIMUM_SETTLE_FERTILITY

It was dropped from 20k to 5k in the patch that made AIs do ICS, but increasing it back to 20k didn't seem to revert to earlier behavior. I've also tried changing other values, none of which seem to affect this.
 
I take it you want to make them value being further away (up to a point), rather than just prevent them from settling so close?
 
Yes. In release CiV they'd settle at locations much further away from the capital, typically near luxury and strategic resources. The patch made them ICS at 2-3 tiles apart mostly ignoring terrain. I know this is an AI problem most people have likely tried to solve... so there probably isn't a fix for it... but it doesn't hurt to ask.
 
All the fixes I've heard are brute force - prevent any cities from being settled so close by anyone. It might be possible, there are a lot of relevant AI weight values, I think.
 
Thank god you started this thread! :goodjob:

This seems to have done the trick for me (only been able to test it for one game, but OMG did it make a difference):

GlobalAIDefines.xml
<Update>
<Set Value="50" /> (instead of vanilla-POSTpatched value of 75)
<Where Name="AI_STRATEGY_AREA_IS_FULL_PERCENT" />
</Update>
<Update>
<Set Value="20000" />
<Where Name="AI_STRATEGY_MINIMUM_SETTLE_FERTILITY" />
</Update>​

I also use this, which you already know about...

globalDefines database:

UPDATE Defines SET Value=3
WHERE Name="MIN_CITY_RANGE";​

I've also (along with many it seems) been disappointed with the new IC spam since the patch [ruined the coolest part of Civ5 IMO], and been experimenting with my mod [ALOT]... with no good results.

I tried quite a bit of different stuff with some results, but some serious AI inability to adapt... The Handicap for Happiness/unhappiness and AI-Growth modifier works in nerfing their spam but destroys player's challenge or is too random. I personally liked increasing the City-Growth Multiplier and Exponent globally (more of a challenge- too easy as it is), but the AI seems to have no idea how to handle it [btw-I did that in conjunction with added food for bonus tiles]. I tried Minimum City Range 3 and was happier but not completely (WTH is up with AI having low yield snow-resource colonies... nonsense... especially when the AI can detect Oil/Aluminum way before Tech), because it did nothing to stop the constant spam on any available land. I tried Minimum City Range 4 and personally liked it, but the AI was so ******** that it could not plan ahead and would ruin coastline by building too close inland.

____

PS- did I mention how happy I am that you brought this up? I know it's not the first post here or on the Firaxis forums to comment on the dumb IC spam that somehow people have been able to turn a blind eye to... but THANKS for the heads-up on that AI strategy! somehow I missed the globalAIdefines.xml completely and couldn't find anything related to it! but your clue (and important value), as well as a gamble on the other, have made the game fun again! I was just about to throw in the towel.

Where can one find a listing of pre-patch values anyways, aside from having planned ahead and kept version-control differencing files?
 
Not sure yet about the variable you mention, but I've been looking at this pretty hard today, doing some testing (I've had a little luck promoting 3 hexes between rather than 2 and increasing the likelihood of distant settling for prime real estate), and I've realised this:

If the AI's factors for deciding are what they appear to be from the exposed variables, and there are no hidden factors, I'm guessing part of the problem is that it doesn't down-value hexes that are already covered by a city, or even being worked. Now, it's conceivable that it automatically zero-values hexes that are currently worked, but there ought to be a reduction for hexes already in first, second and third ring of an existing city (of any player, although ignore unknown cities for other players), much as the current ones to promote 1st ring of target hex over second, and each over third. It'd be great to have clarification from devs on this, and maybe ask for it to be added (with those variables tunable), so I think I'll seek that.
 
The odd part is, I had an old version of GlobalAIDefines and the only real difference after AI-does-ICS patch was settler fertility went from 20000 to 5000... area_is_full didn't change. Setting fertility back to the old value didn't make the AI revert behavior either. I'm trying the combination of the two and they're still acting differently than release-CiV, but it does seem to help a little.

Honestly I just wish we had the full SDK already so we could fix these AI issues ourselves. :crazyeye:
 
The odd part is, I had an old version of GlobalAIDefines and the only real difference after AI-does-ICS patch was settler fertility went from 20000 to 5000... area_is_full didn't change. Setting fertility back to the old value didn't make the AI revert behavior either. I'm trying the combination of the two and they're still acting differently than release-CiV, but it does seem to help a little.
The values that seem to make more difference are in GlobalDefines, I think, various multipliers, several with the SETTLER_ prefix. I suspect they all make a difference, though I'm doubtful of the STRATEGY ones some point to. I'm going to comb GlobalAIDefines more...

Anyway, the ones that are supposed to make the difference to very-long-range settling (changed because people complained about it) are, I believe, SETTLER_EVALUATION_DISTANCE (current default 20) and SETTLER_DISTANCE_DROPOFF_MODIFIER (current default 75), which I believe give an absolute cap on the locations considered, and devalue more distant sites, respectively.
 
Well, I've tried all sorts of things and the frustrating part is it's almost like these variables are simply ignored by the game. I've done a few autoplays out to turn 200 and the settling pattern seems just like it was without these changes. :undecide:

Code:
<Defines>
  <Update>
    <Where Name="AI_STRATEGY_MINIMUM_SETTLE_FERTILITY" />
    <Set Value="20000" />
    <!-- 5000 -->
  </Update>
  <Update>
    <Where Name="AI_STRATEGY_AREA_IS_FULL_PERCENT" />
    <Set Value="50" />
    <!-- 75 -->
  </Update>
  <Update>
    <Where Name="SETTLER_EVALUATION_DISTANCE" />
    <Set Value="30" />
    <!-- 20 -->
  </Update>
  <Update>
    <Where Name="SETTLER_DISTANCE_DROPOFF_MODIFIER" />
    <Set Value="50" />
    <!-- 75 -->
  </Update>
</Defines>

I do know the file's working because it's in the same block of code as where I commented out MIN_CITY_RANGE, which did take effect.
 
Well, I've tried all sorts of things and the frustrating part is it's almost like these variables are simply ignored by the game. I've done a few autoplays out to turn 200 and the settling pattern seems just like it was without these changes. :undecide:

Code:
<Defines>
  <Update>
    <Where Name="SETTLER_DISTANCE_DROPOFF_MODIFIER" />
    <Set Value="50" />
    <!-- 75 -->
  </Update>
</Defines>

I do know the file's working because it's in the same block of code as where I commented out MIN_CITY_RANGE, which did take effect.

Did you consider increasing "SETTLER_DISTANCE_DROPOFF_MODIFIER"?

It may be a percentile multiplier that devalues further hexes. It may work that a hex 1 away is 100, 2 is 75, 3 is 56.25, 4 is 42.2...etc. I haven't tested any of this out, but it may be a possibility.
 
I tried it at 90 this time, no perceptible change between 50 and 90. No matter what I do they jam-pack 6:c5citizen: cities 2-3 tiles apart from existing ones. If these variables are used for anything, I'm unsure what it is. :undecide:
 
I've got it so they usually got for 3, in my tests, over 2, and occasionally go a little further, going much further in certain circumstances. I'm more and more convinced that what's needed is a disincentive to overlap.
 
I tried it at 90 this time, no perceptible change between 50 and 90. No matter what I do they jam-pack 6:c5citizen: cities 2-3 tiles apart from existing ones. If these variables are used for anything, I'm unsure what it is. :undecide:

I would try even going over 100. Try using 200 and see if that changes anything. And, if that doesn't work, try the opposite theory and go with 1.
 
I would try even going over 100. Try using 200 and see if that changes anything. And, if that doesn't work, try the opposite theory and go with 1.
Or, if higher means faster dropoff, try going negative. I'll try both in my next round of tests. I think I've managed a slight improvement with my combination of other stuff, the biggest benefit coming from making it less obsessed with food and valuing 2nd and 3rd rings a bit more. With the current set of values I'm trying, it seems to overall prefer 3 spaces in between, uses 2 somewhat less and larger ones a little more, but the testing isn't thorough enough to be scientific.
 
You probably know this already, but just in case in LiveTuner on the Game tab are some handy autoplay commands I've been using to test this sort of stuff. I've found 150 turns is usually enough to get the AI to build a dozen cities. If you do manage to get some numbers that work well in your testing, it'd be greatly appreciated if you could post the results!

The autoplays do take a while so it limits the pace testing can go, but I've been fiddling with the numbers and running it in the background while doing other things.
 
Yeah, I've been autoplaying when I can with a series of tests for the last couple of days. I'm fairly convinced that the changes that can be made are limited unless we can do more to limit the 'dropoff', and unless we persuade the devs to add something to down-value tiles that are already in a city's max radius... but my experimentation will continue

PS: I only autoplay for 50 turns at a time, to avoid the weird nuclear submarine bug... plus I get to look at progress a little as it goes that way, although I'm usually doing other things.
 
I've changed MIN_CITY_RANGE from 2 to 4 in my last game which prevented very nicely this silly clustering of AI mini-cities.
I personally prefer such space between my own cities on larger maps too, so shall the AI follow my good example!
 
I think the nuclear sub is something they did as a sort of "Ding I'm done!" message from the game. There's that distinctive sound effect when a unit's created even if another window's in front of CiV. A sub's a great way to handle it without interfering with the autoplay, since it can be dropped under ice on a remote part of the map.
 
Back
Top Bottom