AI analysis: The first 100 turns

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California
A good start sets the foundation for the rest of the game, so let's take a look at how the AI does! I'm looking for comments, questions, and strategies to help the AI get off to a solid start.

Settings:

Tiny Pangea
Normal speed
Prince
Temperate

I kept it small for this test, but tried to get a good spread of AI types. Let's meet our cast and their starting positions:

Player 0: De Gaulle of France (aka jdog5000)
Industrius/Charismatic
Starts with: The Wheel, Agriculture

Civ4ScreenShot0002.JPG

Player 1: Montezuma of the Aztec
Aggressive/Spiritual
Starts with: Hunting, Mysticism

Civ4ScreenShot0003.JPG

Player 2: Zara Yaqob
Creative/Organized
Starts with: Hunting, Mining

Civ4ScreenShot0004.JPG
 

Attachments

The first 10 turns ...

Note: The AI always settles in place with its first settler. The "T0 - " notation means that on turn 0 the AI selected what follows. For certain builds I will include a note to myself about the code block the AI used to select a worker or settler.


De Gaulle

Techs selected: T0 - Masonry (pushes Mining first)
Builds selected: T0 - Warrior, T3 - Warrior, T7 - Switch to Worker using method 1
Civs contacted: Aztec
Other:

Learned one interesting thing already, apparently the AI can look ahead in the tech tree more than one layer. That's a bit confusing, I didn't think it did but it's nice to know that's already in there.

Continuing a discussion from another thread, De Gaulle could have made use of a worker immediately if he'd built that first. Instead he stops his second Warrior build early to switch to Worker as soon as Paris hits Pop 2.


Montezuma

Techs selected: T0 - Meditation, T7 - Agriculture
Builds selected: T0 - Warrior, T3 Scout, T7 - Switch to Worker using method 1
Civs contacted: France, Ethiopia
Other: Gets The Wheel as a goody. Founds Confucianism.

Spiritual Monte wins an uncontested race to the first religion.


Zara Yaqob

Techs selected: T0 - Animal Husbandry, T9 - Archery
Builds selected: T0 - Warrior, T1 - Settler using method 1
Civs contacted: Aztec
Other:

I think Zara gets a boost from settling in a forest, so the first warrior is free. Picking a settler that early is a problem though! Again, Zara could have mined some hills with a pop 1 Worker build instead of the Settler build, but he didn't have any defense so the Warrior first was necessary.
 
At turn 20 ...

Since this is such a small map, all players have met each other by turn 20.

De Gaulle


Techs selected: T14 - Pottery
Builds selected: T18 - resume Warrior
Other:

Civ4ScreenShot0005.JPG

Montezuma

Techs selected: T13 - Mining, T18 - Animal Husbandry
Builds selected: T18 - Warrior
Other:

Seems like Montezuma abandoned his Scout build and wastes several early hammers in the process.

Civ4ScreenShot0006.JPG


Zara Yaqob


Techs selected: T14 - Bronze Working
Builds selected: None, Settler still one turn away
Other:

Civ4ScreenShot0007.JPG
 

Attachments

BTW, if you want to poke around the various AI empires in one of the saves, here's some tips:

1) Enter the cheatcode "chipotle" in your My Games/BTS/CivilizationIV.ini file if you haven't already.

2) You can press SHIFT+CTRL+L to change which leader you control.

3) You can press CTRL+Z to turn on Debug mode, read more about that here if interested.
 
Settler 1st on a 2h city tile isn't necessarily a bad play. It tends to win city site races and with the CRE guy its all the more potent. What triggers these AI decisions though, a combination of terrain + flavor + starting tech?
 
I think Zara gets a boost from settling in a forest
Really? Didn't know about that rule.
Continuing a discussion from another thread, De Gaulle could have made use of a worker immediately if he'd built that first. Instead he stops his second Warrior build early to switch to Worker as soon as Paris hits Pop 2.
Going for Pop2 means that the city is larger, and it finishes the Worker quicker. And a larger percentage of the resources that go into the Worker are hammers instead of food.

Admittedly, delaying the worker makes more sense when there is high raw F+H yield tiles nearby.

I've seen some very crunchy combinatorial attempts to work out early turn counts based off of worker and tile features nearby and growth rates. Building a worker earlier gets you your improved terrain earlier (if you have the tech); delaying the worker gets you city size earlier.

Early city size is worth the 'excess' value of unimproved unused tiles nearby. Early worker is worth the difference in yield caused by upgrading a nearby tile (which may involve completely changing your tile choices), delayed by how long it takes for the worker to come out and building the improvement.

It could get really complicated (how much are excess worker turns worth? The value of a worker varies with what techs you are researching...)
 
The hut. He poped a hut when he settled.

Maybe that gave him a free warrior?
 
Going for Pop2 means that the city is larger, and it finishes the Worker quicker. And a larger percentage of the resources that go into the Worker are hammers instead of food.

Usually, with unimproved tiles, going to pop2 reduces the time to build the worker to about 4/5 (assuming a 2F1H city and a 2F1H tile to work, say- at Pop 1 there are 4 hammer equivalents going into a worker, and adding a tile (say another 2F1H) would add 1 more hammer. It takes much longer than 1/5 the worker build time to grow to pop 2. Obviously this math gets wonkier when you introduce 3F unimproved corn or flood plains, or a high :commerce: tile that has the harder to quantify benefit of getting you a tech sooner. Or, as is pointed out in the quote, if you are Expansive and so get a bonus for having actual :hammers: involved rather than food turning into hammers.

One thing to consider when deciding when to go to pop 2, however, is at what point will you grab Bronze Working, as pop 2 is the earliest whip availability.
 
Settler 1st on a 2h city tile isn't necessarily a bad play. It tends to win city site races and with the CRE guy its all the more potent. What triggers these AI decisions though, a combination of terrain + flavor + starting tech?

Settler decisions early in the game are pretty simplistic. It basically means Zara decided he wasn't going to build anything earlier in the AI priority ordering. Settler selection method 1 checks whether the AI has a good site picked out for the settler, they aren't at war, and they can afford another city. There is no consideration of the production capabilities of the building city or AI flavor for expansion. Tech and AI flavor play a role in that they help determine whether the AI chooses something else instead, but they don't play a direct role.


Also, on the picking a worker first front, the AI is actually not blocked from doing that. What I blocked was starting a worker first based solely on the presence of bonus tiles. If the city decides that it needs a worker based on CvCityAI::AI_getWorkersNeeded, then it's still free to build a worker at pop 1. That function does consider whether the AI can do anything with the worker, but for some reason is returning 0 early in the game. I will investigate.
 
Also, on the picking a worker first front, the AI is actually not blocked from doing that. What I blocked was starting a worker first based solely on the presence of bonus tiles.
Good to know... but then it was some poor wording on the changelog ;)
If the city decides that it needs a worker based on CvCityAI::AI_getWorkersNeeded, then it's still free to build a worker at pop 1. That function does consider whether the AI can do anything with the worker, but for some reason is returning 0 early in the game. I will investigate.
Just a wild guess: it is being runned before the unit moves, thus before settling ;) You can't need workers if you don't have territory :D
 
Up to turn 30.


De Gaulle

Techs: T20 - Finishes Pottery, selects Archery
Builds selected: T24 - Granary
Other: At turn 30 turns De Gaulle has 1 Worker, 3 Warriors, 1/2 a Granary, Paris is at Pop 3.6, and he has The Wheel, Agriculture, Hunting, Mining, Pottery, Archery, and Masonry. Got a total of 140 gold from goody huts.

Since there are some settlers on the way (not for France, but for the other civs), let's take a look at where the civs will be sending them. Each civ picks out 4 sites shown by circles in their color, the top choice has a crude red target drawn on it in post by yours truly. De Gaulle would be going for coastal horses as his top choice, the icy whales are low on the priority list.

BTW, these are taken in Debug mode so the whole map is exposed. The AI does not know about the location of iron or oil or uranium, but they are exposed in this view.

Civ4ScreenShot0010.JPG



Montezuma


Techs selected: T25 - Bronze Working
Builds selected: T25 - Settler
Other: At turn 30 Monte has 1 Worker, 2 Warriors, 1/2 a Settler, Tenochtitlan is at pop 3.1, and he has The Wheel, Agriculture, Mysticism, Mining, Animal Husbandry, Meditation, and 1/2 of Bronze Working. He founded a religion and received 104 gold plus a tech from goodies, though his starting Scout was killed a while ago.

As we'll see, although he doesn't know it Monte is in a race to settle the river which divides Aztec and Ethiopian lands. His fourth city site is just off the bottom left corner of the screen and would pick up horses.

Civ4ScreenShot0009.JPG



Zara Yaqob


Techs selected: T24 - Polytheism (pushes Mysticism first)
Builds selected: T21 - Worker
Other: At turn 30 Zara has 1 Scout, 1 Warrior, 1 Settler, 2/3 of a Worker, Aksum is still at pop 1.3, and he has Hunting, Mysticism, Mining, Animal Husbandry, Archery, and Bronze Working. He has received 79 gold from goodies.

He built the worst possible combo though ... long settler build, then Zara won't even use the settler for a while because he has no escort and decides to build a worker. Note that Zara builds a worker in his pop 1 capital, building a worker in a pop 1 city is possible if the AI can improve the tile the city is working. Zara got Animal Husbandry during the long settler build, so he can improve the sheep he's been working.

Here's where Zara would be sending that Settler if he had an escort:

Civ4ScreenShot0008.JPG

So, if he had an escort it would have been a great move to build that settler as he'd win the race against Monte and pick up a damn good city site. As it stands, it looks like he'll lose out.
 
Up to turn 30.


De Gaulle

Techs: T20 - Finishes Pottery, selects Archery
Builds selected: T24 - Granary
Other: At turn 30 turns De Gaulle has 1 Worker, 3 Warriors, 1/2 a Granary, Paris is at Pop 3.6, and he has The Wheel, Agriculture, Hunting, Mining, Pottery, Archery, and Masonry. Got a total of 140 gold from goody huts.

Interesting. I'm not sure what France is doing, other than maybe building an economy. If he took his three warriors, and built a fourth one, he could try to rush one of the other AI's capitals while they sent out an escort for a settler. It would involve some tricky timing, but completely possible. However, I'm not sure if/what France's long term goals are here.
Montezuma

Techs selected: T25 - Bronze Working
Builds selected: T25 - Settler
Other: At turn 30 Monte has 1 Worker, 2 Warriors, 1/2 a Settler, Tenochtitlan is at pop 3.1, and he has The Wheel, Agriculture, Mysticism, Mining, Animal Husbandry, Meditation, and 1/2 of Bronze Working. He founded a religion and received 104 gold plus a tech from goodies, though his starting Scout was killed a while ago.

As we'll see, although he doesn't know it Monte is in a race to settle the river which divides Aztec and Ethiopian lands. His fourth city site is just off the bottom left corner of the screen and would pick up horses.

Monty seems to have the best set-up so far. It will be interesting to see... The first couple of turns are so pivotal.


Zara Yaqob


Techs selected: T24 - Polytheism (pushes Mysticism first)
Builds selected: T21 - Worker
Other: At turn 30 Zara has 1 Scout, 1 Warrior, 1 Settler, 2/3 of a Worker, Aksum is still at pop 1.3, and he has Hunting, Mysticism, Mining, Animal Husbandry, Archery, and Bronze Working. He has received 79 gold from goodies.

He built the worst possible combo though ... long settler build, then Zara won't even use the settler for a while because he has no escort and decides to build a worker. Note that Zara builds a worker in his pop 1 capital, building a worker in a pop 1 city is possible if the AI can improve the tile the city is working. Zara got Animal Husbandry during the long settler build, so he can improve the sheep he's been working.

Lol. He might as well use his capitals warrior as an escort, and start building a warrior right away to replace it. The AI's wouldn't have time to get to him to attack anyway. This is a splendid example of the AI squandering a perfectly good lead.
 
I've seen some very crunchy combinatorial attempts to work out early turn counts based off of worker and tile features nearby and growth rates. Building a worker earlier gets you your improved terrain earlier (if you have the tech); delaying the worker gets you city size earlier.

Improved terrain can as much as double up the value of raw terrain. Getting improved terrain sooner wins...very soon this translates into a pop advantage as well.

But not if the AI can't tech properly. Then we have to decide whether its better to make the AI player better within a set of limitations or whether its possible to strip those limitations.
 
Barring a serious change, an approximation can be done via two methods.

1> AI should value 'terrain improvement unlocking' with a boost determined by 'nearby' resources (ones in your cities fat cross, and ones near enough to build a city on), and the availability of workers (determined by how hard they are to build if you don't have any (this is for non-conventional mods), and/or if they already have a worker).

2> Early worker builds should be determined by how much the worker can do now, or with technology the AI is currently working on and will be finished by the time the worker is produced.

This doesn't require that the AI say "I should work on agriculture, because if I do, I can build a worker, and exploit that corn"; it might abstractly know that it has to build a worker, and how hard that will be, but it doesn't have to convolve the city build choice with the tech build choice directly (which would be a new frontier for the AI, and hence hard).

The AI sees the corn, says "with agriculture, I can exploit it", and decides to work on agriculture. Then the AI notices it is going to finish agriculture (or has agriculture), and decides to build a worker to be able to exploit the agriculture technology. (And yes, the AI is currently has more than this amount of M.P.D.)

... sigh, but the above doesn't take chopping into account. Which is a huge part of early game strategy for a player, and a top-notch reason why they build workers.
 
Chopping is somewhat overrated by humans (note that I say somewhat, it remains a strong play if people understand the tradeoffs). For example you'd have a hard time chopping to keep up with simply working pigs, and there are benefits to getting ASAP writing + open borders (2 or even 3 commerce trade routes give a yield close to that of a gem mine once you settle a few cities), an early great scientist, or the ability to run gambits on certain tech paths/wonders. It would be bad play for an AI to try chopping before it hooks up a pig or other 6 yield tile, those are just too strong.

This is why I usually get on the case of some coop MP friends who open up BW rather than worker techs and try to choprush everything rather than working good tiles...you barely keep up or possibly get ahead, but then you run out of trees...this is doing things backwards.

Seeing the AI make a dedicated effort to chop a wonder or critical workers/settlers would be interesting though.
 
Turns 30 - 39

We've learned several interesting things about how to improve early worker strategy for the AI. Now let's shift the attention to picking buildings and early settler strategy and see how the AI's do.


De Gaulle

Techs: T30 - finishes Archery, selects Bronze Working; T39 - finishes Bronze Working, selects Animal Husbandry
Builds selected: T32 - abandons Granary, selects city defense Archer; T35 - finishes Archer, selects Barracks
Other:

This is the second time we've seen the AI simply abandon something it was building. In this case I believe Paris hits pop 4 and therefore decides to re-examine its build priorities because of that. With higher pop and thus higher production, it meets the conditions for a high priority Barracks clause which comes much earlier in the sequence than the pretty high priority Granary clause that had triggered the prior build.


Montezuma


Techs selected: T34 - finishes Bronze Working, selects Archery; T38 - finishes Archery, selects Pottery
Tenochtitlan Builds: T34 - finishes Settler (poprush), selects Barracks; T35 - finishes Barracks, selects attack Warrior; T38 - finishes Warrior, selects city defense Archer
Teotihuacan Builds: T38 - selects Monument

Other: Since Monte is Spiritual he can switch civics without Anarchy, so he switches to Slavery immediately after getting Bronze Working. On Turn 36, Monte's Settler heads out to found the first new city. Teotihuacan is founded on turn 38 on the best plot highlighted in previous post, so he wins the settler race.

After adopting Slavery Monte decides to sacrifice 1 pop in size 3 Tenochtitlan to finish his settler early. Contributing to this decision is the fact that one of the three tiles he's working is undeveloped, so he sees the trade-off as pretty good.


Zara Yaqob

Techs selected: T39 - finishes Polytheism, selects Agriculture
Builds selected: T34 - finishes Worker, selects city defense Archer
Other: Zara founds the game's second religion in his capital. On turn 40 Zara is only half done with his escort Archer, so he loses the settler race by a mile despite having finished his settler on Turn 21. BTW, with Aggressive AI on the AI will take the risk and send out unescorted settlers.
 
This is the second time we've seen the AI simply abandon something it was building. In this case I believe Paris hits pop 4 and therefore decides to re-examine its build priorities because of that. With higher pop and thus higher production, it meets the conditions for a high priority Barracks clause which comes much earlier in the sequence than the pretty high priority Granary clause that had triggered the prior build.

This makes me wonder. Is there a value system for a building when it's already mostly done? If the AI's building a granary, and it's only a few turns away, shouldn't the value be much higher than switching to a much longer new build, the Barracks.

BTW, with Aggressive AI on the AI will take the risk and send out unescorted settlers.

Interesting, I did not know that.
 
Back
Top Bottom