• Civilization 7 has been announced. For more info please check the forum here .

Any deep-dives on what an AI will do with a great person?

Joined
May 14, 2021
Messages
113
Is there any way to estimate in advance what an AI will do with a great person? Is this personality driven or consistent across all leaders?

Like, if I saw that an AI was getting a great prophet, and I know they have the Theology pre-recs, is there any way to see if they would bulb? vs build a holy city? From mucking around in gameplay testing, it seems they may be more likely to bulb Theo if they... have no other religion?

For Great Artists, it seems they may do a culture bomb if under pressure, but otherwise likely to settle?

For great scientists, it seems they may send them to the city with highest beakers for an academy, and will keep making academies on all cities before settling? Maybe they calculate the immediate beaker impact?

Does difficulty level impact any of this?

Has anyone done a write-up of what it says in the code / have strong anequecdotal experience?
 
I can tell you where in the code it's all controlled; the core functions are AI_prophetMove, AI_artistMove, AI_scientistMove, and so forth in CvUnitAI.

All together (including sub-functions they call) it's probably around a thousand lines of code, so I'm not going to summarize everything.

But here's roughly how Great Prophets work (if I'm skimming the code correctly), to give one example:
  • Check every city that the prophet can reach, on the same continent, which isn't currently threatened by an enemy unit, and see if the prophet can make a holy shrine there. If they can, move to that city and build it.
  • Check if the prophet can bulb what the civ is currently researching, without too many wasted beakers. If so, bulb it.
  • Check if the perceived "value" of a golden age (which is a whole calculation of its own) is at least ~1.7x times as high as the perceived "value" of what the prophet can bulb. If so, start a golden age.
  • Check if the perceived "value" of bulb is higher than that of golden age, without too many wasted beakers. If so, bulb.
  • Try to join a city
 
Oh interesting - it only bulbs what it has already just started to research? that would explain a lot! Also the - 'only build a shrine when the city is not endangered' may have bitten me before.

Thanks! I may try to slog through the other great people functions for a couple items I'm curious about.
 
If the bulb would go on to something that it's not currently researching, it stops and checks whether a golden age would be more useful; compares the value of the two.

If the bulb would go onto its current tech priority (and few of the bulb beakers would be wasted in the process), it doesn't even bother thinking about a golden age. Just pulls the trigger on bulbing the tech right away.
 
Wait—the AI doesn’t save great people (at least GPros) for multi-GP golden ages? Or was that left off the summary?
 
Wait—the AI doesn’t save great people (at least GPros) for multi-GP golden ages? Or was that left off the summary?
I think (although I didn't do a very careful analysis of the code, more of a quick skim, so I'm not 100% on this) if it thinks the golden age is valuable enough then it will try to start one. And that's how the unit spends its turn. If the civ didn't have enough Great People, I assume the attempt would just fail, the Great Person would sit around until next turn, and then the AI would make the whole analysis all over again. If it kept thinking "Golden Age is the best option" for enough consecutive turns, sooner or later the civ would pop a second Great Person and things would kick off.
 
really intriguing question - thanks coanda for pointing out where the code is located. Also gave a quick skim, here's what I see, mostly confiming what coanda has already said:

far as I can tell, the code cycles unit to unit, completing one units turn then moving on to the other, in this way -

  1. checks if the unit is on land or water; if on water, tries to reference instead a transporting unit, checks if transport can move, etc
  2. checks if the unit is automated, or part of an automated group -> tells it to do automated stuff
  3. gets unit type -> calls that unit types move function - some types of movement more specific, i.e. attacks, pillage, etc.
Wait—the AI doesn’t save great people

There exists a function 'AI_reserveMove', but it only seems to affect sentries and units healing, not artists, prophets, etc - as coanda said, those units fire, move through their checklists as coanda illustrated. If none of the checks are triggered, then the unit does nothing that turn, and rechecks on the next turn.

So, as far I can see, there is not code allowing saving or coordinating multiple great people for future use.
 
Do the AIs use Great Artists to speed up culture cities in a culture victory attempt?
 
Yes, if they're pursuing cultural victory (this is controlled by three strategy bits - AI_STRATEGY_CULTURE1, AI_STRATEGY_CULTURE2, and AI_STRATEGY_CULTURE3). AIs who choose to pursue cultural victory naturally progress from 1, to 2, to 3 as the game goes on, and with each stage forward they become more narrowly focused on chasing that cultural victory. An AI who is in AI_STRATEGY_CULTURE3 mode, which generally won't happen before the Industrial or Modern era, should be almost certain to use a Great Artist for a Great Work.
 
I think (although I didn't do a very careful analysis of the code, more of a quick skim, so I'm not 100% on this) if it thinks the golden age is valuable enough then it will try to start one. And that's how the unit spends its turn. If the civ didn't have enough Great People, I assume the attempt would just fail, the Great Person would sit around until next turn, and then the AI would make the whole analysis all over again. If it kept thinking "Golden Age is the best option" for enough consecutive turns, sooner or later the civ would pop a second Great Person and things would kick off.
OK; that makes some sense.
 
Top Bottom