Does the AI search for resources or does it instantly know where they all are?

Not OP's question but related: when I'm farming a barbarian camp for xp/culture and it's empty, enemy scouts which have already scouted the area will return to clear it. When another barbarian unit spawns they head off in the other direction again to scout new territory. They seem to know when it's possible to clear it even without direct line of sight.
 
I respect the work you're doing inside the guts of the game but I have to say that with respect I disagree with your view that the AI can only know the value of tiles they've revealed. My experiments with this exact question in IGE included situations where the mountain range I put between the civ and the NW was maybe ten hexes long, no way their scout could have gotten round before, and the settler still beelines for that spot like his life depended on it. This was happening too often for it to be explained by a map ruin.

Conceivably I could set up some kind of video proof, but I can't really be bothered to try and find the time, and though you'd probably say the burden of proof lies with me, I'm not especially worried whether I'm right or wrong. :)


Sent from my iPad using Tapatalk
 
"I respect that you're the only person who actually bothered to actually examine how the AI works, but I will still believe in my paranoid myths about the AI, thank you very much".

The capacity of the human mind to make patterns where they are none is endlessly fascinating, and this is another example of it.

Moderator Action: Constructing a false quote is trolling, as is attributing paranoia to another user. Please refrain from this type of post.
Please read the forum rules: http://forums.civfanatics.com/showthread.php?t=422889
 
I respect the work you're doing inside the guts of the game but I have to say that with respect I disagree with your view that the AI can only know the value of tiles they've revealed. My experiments with this exact question in IGE included situations where the mountain range I put between the civ and the NW was maybe ten hexes long, no way their scout could have gotten round before, and the settler still beelines for that spot like his life depended on it. This was happening too often for it to be explained by a map ruin.

Conceivably I could set up some kind of video proof, but I can't really be bothered to try and find the time, and though you'd probably say the burden of proof lies with me, I'm not especially worried whether I'm right or wrong. :)

There's a way to activate so-called "debug layers" that overlay values on all tiles. One of the debug layers is for AI fertility, so if you can find a way to display that debug layer in the game, you'll be able to check for sure. You have to enable the overlay system in config.ini via OverlayDebug = 0 (it's under DisableSystem, so a 0 means it is not disabled), then mess around with FireTuner so that the fertility overlay is displayed. If you enable logging, you can also check to see exactly which spot the AI targets with its settler and what the fertility of that spot is, so it might reveal whether the AI picks out the spot immediately or only gets there via a series of retargets along the way (the AI will only check for retargets after it reaches its destination, AFAIK).
What natural wonder did you test with? Remember that the AI does not take culture yield into account when settling, so testing with El Dorado is probably the best idea.
 
well my opinion is that they know where they can find resources depending on the difficulty level... ive seen AI not looting ancient ruins next to his border (low difficulty) and ive seen them founding cities on areas where they can get alot of late era resources (oil/aluminium/uranium) when they are set to higher difficulty.
 
I've seen ancient ruins very close to AI caps on Deity too. The reason it's less common is that they start with more units on higher difficulties, and can therefore scout more effectively.
 
well my opinion is that they know where they can find resources depending on the difficulty level... ive seen AI not looting ancient ruins next to his border (low difficulty) and ive seen them founding cities on areas where they can get alot of late era resources (oil/aluminium/uranium) when they are set to higher difficulty.
Highly unlikely: I did a search for difficulty levels in the code, and none are related to the AI's knowledge of the map. A shame really, I'd have taken that over things like giving the AI free techs.

I've seen ancient ruins very close to AI caps on Deity too. The reason it's less common is that they start with more units on higher difficulties, and can therefore scout more effectively.
Agreed, more starting units = more early scouting = faster finding of high fertility plots.
 
ive seen them founding cities on areas where they can get alot of late era resources (oil/aluminium/uranium)

If you assume that resources are spread equally on the map and you find an area where there are no visible resources, you know that there should be some invisible resources around.
 
Regarding luxury resources, I have had the game show me a city recommendation for a certain costal spot, and the mouse-over message said it was in proximity to a luxury. However, I hadn't uncovered the luxury. It was only when I sent a unit to stand on that tile that I saw the offshore whale resource. I don't recall seeing this with strategic resources, but this is at least one case of the game providing information that should not yet be known.
 
Not OP's question but related: when I'm farming a barbarian camp for xp/culture and it's empty, enemy scouts which have already scouted the area will return to clear it. When another barbarian unit spawns they head off in the other direction again to scout new territory. They seem to know when it's possible to clear it even without direct line of sight.

When you know the location of a barb camp but don't have direct sight on it, you can go to move a combat unit onto that tile. If the icon turns red (and won't let you move there unless its a melee unit), then you know there is a combat unit in the encampment, the same as any time you try to move a unit onto a tile that's already occupied. If the icon doesn't change from what it normally looks like, then the encampment has no combat unit and can be cleared. It would make sense for the AI (and for human players!) to check all known barb camps for this at the beginning of every turn to see if it is worth trying to clear any of them.
 
Sometimes when I do an advanced start in maybe the renaissance, I use the AI's city placement suggestions when I haven't managed to scout far with the starting units.
 
@akumeon: I know about radaring with units, but didn't consider that the AI would do it too. Makes sense.

Welcome to the forums by the way :)
 
faster finding of high fertility plots.
What specifically goes into calculating a plot's fertility value?

When people say that the "AI knows where all resources are," what they're likely referring to is the city placement AI.

What explanation can you provide for some of the more dubious settling locations, sites which only seem to be worthwhile in hindsight, once industrial and modern era techs have revealed additional resources. In particular, some of the tundra junk the AI is prone to settling.
 
What specifically goes into calculating a plot's fertility value?
Plot fertility is the way the AI scores the value of settling any given plot; human players see this as yellow city icons. Its base value is determined by the sum of all yield values for the given plot as well as the Happiness, Resource, and Strategic value of the plot. In the case of yield values, the AI takes the total amount of each yield available in each ring around the plot and multiplies that value by a ring multiplier (6/3/2 for 1/2/3 tiles away), a yield-specific value multiplier (15/3/1/1/0/1 for Food/Hammers/Gold/Science/Culture/Faith), and a flavor multiplier (values based on the player's flavor values for Growth, Expansion, Production, Wonders, Gold, Tile Improvement, Science, Culture, and Religion). Happiness and Resource values are checked up to 5 tiles away with the ring multipliers of 6/3/2/1/1, a multiplier of 60 and 10, and a weird way of determining actual values that I cannot recall (only that it greatly undervalues happiness from unique luxuries). Strategic value is extremely dumb in the unmodded game: the only thing the AI checks for are hills in a radius of 1 and mountains in a radius of 2, increasing strategic value by a flat amount for each one. If a tile does not have any value besides strategic, ie. it's flat desert, snow, or mountain, it decreases the original plot's fertility value by 30 * (ring multiplier). Tiles owned by another player are not counted, and tiles owned by the current player have their fertility contribution halved. Natural wonders double their fertility contribution and also add an extra 500 fertility.
In the unmodded game, certain civs will get an exorbitant amount of extra flavor for plots in certain areas: Spain gets an extra 55000 fertility when the tile is in 3 radius of a natural wonder, Celts get an extra 1000 * (faith flavor) or 2000 * (faith flavor) fertility for settling next to 1 or 3+ forests, Morocco gets 1000 extra fertility for every desert within city working radius, Brazil gets 1000 extra fertility for every jungle within city working radius, Netherlands gets 2000 extra fertility for every floodplains or marshes within city working radius, Inca gets gets 1000 to 3000 extra fertility for every hills that is adjacent to a mountain depending on how many mountains there are adjacent to the hills, and Iroquois gets 10 extra fertility for every forest within 5 tiles. Indonesia multiplies the fertility value of all plots that would give it a civ-unique luxury by 3.

Once the base fertility of a tile has been determined, the AI then applies a boatload of multipliers based on the tile itself. Fertility is halved if the tile has a visible resource, is increased by 15% if the tile is on a river, is increased by 40% if the tile is coastal and another 40% if the player has 8 or more Naval flavor, and is doubled and increased by 25 if the tile is coastal and the player is flagged as a coastal civ (England, Carthage, Polynesia, etc.). After this come the distance modifiers: basically, the AI checks to see how close its closest city is to the plot and how close the closest enemy city is to the plot and applies modifiers based the results combined with its growth and expansion flavors as well as its boldness value.

After all of these have been calculated, the settler takes the overall fertility values of plots and then reduces their value if they are too far: what constitutes "too far" depends on the map and whether or not the settler is escorted, but everything roughly 12 or more tiles away is usually reduced by the same amount.


What explanation can you provide for some of the more dubious settling locations, sites which only seem to be worthwhile in hindsight, once industrial and modern era techs have revealed additional resources. In particular, some of the tundra junk the AI is prone to settling.
Confirmation bias primarily. The AI will settle tundra plots regardless of whether there are any lategame resources in the tile, but people tend to remember the AI tundra settles that end up being good more than the AI tundra settles that stay terrible. If an AI ends up settling a tundra city that is near lategame resources that is should not see (eg. aluminum, uranium), it will still settle a city in that same spot if you go in with a map editor (either WorldBuilder or IGE) and remove those lategame resources.
 
So it sounds like that mechanic is entirely limited to the AI.

How does that relate to the suggested city location markers human players see when a settler is actively selected? Is it using the same calculations up to a point, such as when the AI begins discounting for distance (ie the last line from your explanation, with its "too far" discount)?
 
So it sounds like that mechanic is entirely limited to the AI.

How does that relate to the suggested city location markers human players see when a settler is actively selected? Is it using the same calculations up to a point, such as when the AI begins discounting for distance (ie the last line from your explanation, with its "too far" discount)?

Oh yes, I forgot to mention that the only modifier for distances between cities that gets applied to human players is that if the closest allied city is 4 tiles away, fertility is halved; the stuff related to boldness and flavors is only applied to AI players. Everything else is identical. I don't know the exact threshold for those suggested city location markers, but plots with those markers are ones that have a high fertility value, so AI players would usually want to settle those plots.
 
I don't know the exact threshold for those suggested city location markers, but plots with those markers are ones that have a high fertility value, so AI players would usually want to settle those plots.

I have come to respect my own judgment over the game’s suggestions, but those markers are extremely helpful for indicating where the AI will be going! So I do prioritize those spots (or, more likely, spots near those spots) for expos.

I used to be sure the those markers were influence by hidden resources, but others (or maybe it was Delnar) saying that was confirmation bias made me consider that more critically.
 
Keep in mind, when saying the AI "undervalues happiness" in vanilla, that the vanilla AI gets happiness bonuses the player does not on many difficulties, allowing it to milk this prioritization.
 
I have come to respect my own judgment over the game’s suggestions, but those markers are extremely helpful for indicating where the AI will be going! So I do prioritize those spots (or, more likely, spots near those spots) for expos.

I used to be sure the those markers were influence by hidden resources, but others (or maybe it was Delnar) saying that was confirmation bias made me consider that more critically.

I very rarely follow the suggestions. Often it's in the same ballpark but rarely on the exact same spot though
 
Often it's in the same ballpark but rarely on the exact same spot though

What I find really funny, and it often happens once a game, is that I will have a spot in mind and then once the settler is built -- the game suggests three spots all touching the spot I like!

You can be sure an AI would pick one of the three rather than splitting the difference! The AI also does not plan ahead, so it frequently spoils subsequent expo locations, whereas the player can (and should) be thinking about all their cities. The AI will also put three weak cities in an area that would ideal for one great city.

In my games, I have changed the setting to adjust minimum distance from the default 3 to 4. Much to my surprise, that seems to effect how the DCL play out too, but it saves me a great deal of frustration with the AI spamming. It probably helps the AI in the long run...
 
Back
Top Bottom