The Big Question - How Does The AI Choose Which Units To Build?

The Last Conformist said:
I didn't mean to imply it was uninteresting, tho I realize my comment could be read that way. I rather think it's faintly reassuring that there's sufficient consistency in AI builds that there can be old news.


I don't believe it picked "randomly". My tests of about a year ago indicated that the AI will always build the cheapest available defender in an empty city; I suspect that if there's a tie, it simply picks the one coming first in the units list (this would be consistent with the ultimate tiebreaker for drafting).

If AI did not made a random choice between "A" and "B",
then it would have choosen "A" (which is first in the unit list) all the time.
It did not.

Rocoteh
 
ozymandias said:
Ah-hah! -- I wasn't aware of that. Although, looking at both Rocoteh's and my tests, this would only seem to apply to the very first build or two in the city ... ?
That's what I'm figuring - it first builds units for point defense, and when it's finished with that, it switches to another algorithm for building "field" forces.
 
The Last Conformist said:
That's what I'm figuring - it first builds units for point defense, and when it's finished with that, it switches to another algorithm for building "field" forces.

Makes good sense from an AI development POV. And we know that "field forces" are built somewhere in the range ~60% - ~55% defense and ~40% - ~45% offense ...

Hm. After trying Mrtn's suggested "blitz" I might actually try to summarize everything we know and have surmized to date; I'll probably post it both here and try to get others interested by beginning a separate thread of views on how to structure force pools for mods.

-Oz
 
That sounds like a great idea Ozymandias, I was going to read the entire thread, but now it seems I won't have to anymore :)
 
Perhaps it's in this thread, BUT I got lazy and not time to read all....

A fast answer perhaps.

When a unit is tagged as both offense and defense I think I have read that the AI will make a decision once and then stick to this for that unit.

If so tagging units with both might get an effect that's not so very good.
Mystified by the AI and it's picking.
Hoping for someone to guide me. Is my statement true or not...

Cemo
 
cemo1956 said:
Perhaps it's in this thread, BUT I got lazy and not time to read all....

A fast answer perhaps.

When a unit is tagged as both offense and defense I think I have read that the AI will make a decision once and then stick to this for that unit.

If so tagging units with both might get an effect that's not so very good.
Mystified by the AI and it's picking.
Hoping for someone to guide me. Is my statement true or not...

Cemo
O/D's were shown by some of my tests to be built as about 50% of the entire force.... averaging out to 25% O of O/D, 25% D of O/D, and 25% O, 25%, D

In other words, the AI prefers equilibrium in it's O's and D's.
 
Dom Pedro II said:
I think ozy should post all of the collected data in his first post. Just to make it easier for people... :mischief:

:D Ozy is planning on just that. I promised Mrtn I'd run another test re: the blitz flag, then I hope to compend all of our combined results and educated guesses, both here and probably at the start of another thread on force pool composition. (re: the testing I'm just temporarily delayed -- I upgraded from Windows 98 to XP and it runs like a crippled beast, so I'm upgrading machines this week)

-Oz
 
Considering not only the tags for Offense/Defense strategy one must ask the same about the aircrafts different tags.

Mostly I think about the normal situation of having multi-role modern jets doing not only CAP service but also heavy bombing.

Will the AI pick similar modded jets like F4 Phantom to do interception of other aircraft on bombing runs, and then picking it to do bombing runs itself.

To raise a question considering the more and more available special units like Anti-Tank (Bazooka), mortars, Tank Destroyers, Flamethrowers. I'm confused in how one will get the AI to build them in a more correct ratio.
I can see Flamethrowers with higher offense attacks roasting city after city.
AntiTank units used too in attacks and not in the special issue of knocking out armor vehicles.

I would be glad to get hints and knowledge on this based on tests and experience. Any one ??

Cemo
 
@cemo1956 --

1. We've focused here on ground units only, and that's been hard enough! ;) Air and/or sea might follow depending upon interest (hint, hint ...).

2. I've become increasingly convinced that the AI only "knows" how to select from a very narrow force pool; I'll be writing a lot more on that in the weeks to come.

-Oz
 
I am going to attempt to revive the question of AI build priorities to try to figure out how the AI decides what to build. The first few tests I am doing are re-tests to compare them to previous tests done here already. In total, the AI will produce at least 150 to 200 units in each test to get a good idea of percentages of what it produces.
I will be using Ozymandias' initial format of testing and build from there. I will be taking conditions initially set by him (since they were good starting points). It only takes me about 15 minutes to do a test, so hopefully I can bust quite a few out to get a good idea on how it all works, and perhaps be able to come up with some type of 'pattern' to assist those with mods and scenarios to be able to know what types of stats to assign to get production they are looking for.
 
I am going to attempt to revive the question of AI build priorities to try to figure out how the AI decides what to build. The first few tests I am doing are re-tests to compare them to previous tests done here already. In total, the AI will produce at least 150 to 200 units in each test to get a good idea of percentages of what it produces.
I will be using Ozymandias' initial format of testing and build from there. I will be taking conditions initially set by him (since they were good starting points). It only takes me about 15 minutes to do a test, so hopefully I can bust quite a few out to get a good idea on how it all works, and perhaps be able to come up with some type of 'pattern' to assist those with mods and scenarios to be able to know what types of stats to assign to get production they are looking for.

Bravo! :clap:

BTW, I was mulling over a set of tests to see which unit ability flag(s) the AI prefers. My thought was to have one unit each of equal A/D/etc. with ONE flag checked (ZOC; amphib; etc.) and the number of cities = the number of unit types. If one flag came up preponderently in a testing (building) round, I would note it as such and remove that unit from the next round's build queue, thereby hopefully establishing the precedence the AI gives to these flags.

My Very Best,

Oz
 
Settings for Test 1

The purpose of this test is to evaluate the AI selection among 3 types of units: each unit has an Attack and Defense = 5. Combined Attack + Defense for each unit = 10. All units move 1. Conditions have been set to make this test as "vanilla" as possible.

1. There are two Civs. Each Civ has six cities and begins with no units. These civs start at war.
2. Each city begins at size 5.
3. Cities are limited to a maximum size of 5.
4. Each Civ is limited to one Gov type, “Despotism” modified to minimal corruption and no tile penalties. All units are free, no units may be rushed, and war weariness is “none”.
5. No Civs have been given any bonus traits (Commercial, Expansionist, etc.)
6. Aggression for all Civs has been set to “3".
7. All Civs have been made members of different cultural groups.
8. All terrain is grassland which produce 2 food and 3 shields, with 1 hill with bonus resource for each nation.
9. There is one bonus resource which provides 25 gold; one of these is available for each nation.
10. Standard victory conditions are in use.
11. For this round, three unit types exist – “Warrior” (A/D/M = 5/5/1) “Archer” (5/5/1) and “Spearman”(5/5/1)
12. All units cost 10 and require support.
13. EDIT: No Civ AI strategies have been checked (e.g., "Build Often"; etc.); unit strategy flags for all three unit types have been set to both "offensive and "defensive".
15. Number of citizens quelled by military = 2.
16. Each city has a temple which produces 5 content faces, 0 culture, 0 maintenance.
16. Techs take 70 turns to research minimum.
17. Level of play = Monarch, AI Aggression = Normal.
18. Each city will be able to produce 1 unit per turn.

The three types of units were:

"Warrior" A/D/M = 5/5/1
"Archer" A/D/M = 5/5/1
"Spearman" A/D/M = 5/5/1

All units were flagged both "offense" and "defense".

Results:

Excel sheet showing detailed results

Wartime builds = 27 turns (each Civ = 162 units total):

Germany:
Warriors 72 44%
Archers 39 24%
Spearman 51 32%

Russia:
Warriors 71 44%
Archers 44 27%
Spearman 47 29%

Observations:
- Since all units are the same, it seems that the Warrior is built the most often solely because it is first on the build list
- The Warrior was built at a 44% level, with the Archer and Spearman being built at around 28% each, with the Spearman slightly higher. In queue, build order was: Warrior, Archer, Spearman... so since all unit stats are the same, the AI auto-picks the first on list, warrior, to build, the reason why there are so many more of these units.
- Although overall, spearman were killed the least often, but I do not know if AI takes this into consideration for how often they build (I doubt something like this was programmed, given how much the AI lacks, but then again who knows!)
- German AI showed more aggession and attacked more often whereas Soviet went on defense more often, thus Germany lost approx 15% more troops (which is correct given 10% land defense bonus, and the occasional 25% fortification bonus factoring in).

I will probably do more wartime tests, but may compare them with peacetime tests if it seems like a worthwhile test.
 
Hey, hope you don't mind me using your format :) It was very well set up and easy to go by... I am doing these initial ones just as a starting point for something to grasp on to and to make sure all of my settings are correct in the editor (which I am sure they are by now).

It's only been about 4 years since the last post here! But I must say, trying to figure out the AI in Rocoteh's WW2 Global has me dedicated to getting somewhere!
 
Game Conditions & Settings Test Round 2

The purpose of this round is to evaluate the AI selection among 3 types of units, each roughly equivalent: each unit has an Attack and Defense = 4, 5, or 6. Combined Attack + Defense for each unit = 10. All units move 1. Conditions have been set to make this test as absolutely "vanilla" as possible.

1. There are two Civs. Each Civ has six cities and begins with no units. They are locked in war.
2. Each city begins at size 5.
3. Cities are limited to a maximum size of 5.
4. Each Civ is limited to one Gov type, “Despotism” modified to minimal corruption and no tile penalties. All units are free, no units may be rushed, and war weariness is “none”.
5. No Civs have been given any bonus traits (Commercial, Expansionist, etc.)
6. Aggression for all Civs has been set to “3".
7. All Civs have been made members of different cultural groups.
8. All terrain is grassland which produce 2 food and 3 shields, with 1 hill with bonus resource for each nation.
9. There is one bonus resource which provides 25 gold; one of these is available for each nation.
10. Standard victory conditions are in use.
11. For this round, three unit types exist – “Warrior” (A/D/M = 5/5/1) “Archer” (6/4/1) and “Spearman” (4/6/1)
12. All units cost 10 and require support.
13. EDIT: No Civ AI strategies have been checked (e.g., "Build Often"; etc.); unit strategy flags for all three unit types vary, see below.
15. Number of citizens quelled by military = 3.
16. Each city has a temple which produces 5 content faces, 0 culture, 0 maintenance.
16. Techs take 70 turns to research minimum.
17. Level of play = Monarch, AI Aggression = Normal.
18. Each city will be able to produce 1 unit per turn.

Recall that the three types of units were:

"Warrior" A/D/M = 5/5/1 flagged both "offense" and "defense"
"Archer" A/D/M = 6/4/1 flagged "offense"
"Spearman" A/D/M = 4/6/1 flagged "defense"

Results:

Excel Sheet showing detailed results

Wartime builds = 30 turns (each Civ = 180 units total):

Germany:
Warriors 58 32% (even D and A)
Archers 57 32% (higher A)
Spearman 65 36% (higher D)

Russia:
Warriors 50 28% (even D and A)
Archers 72 40% (higher A)
Spearman 58 32% (higher D)

Observations:
- AI built all Spearman first turn, due to it having the highest defense, then starting incorporating Archers (highest defense), then the Warrior (commonground unit). This shows the AI builds the unit with the highest defense factor first, and other tests I have done (shown in following posts) prove that the AI does not take other factors (such as flags) into consideration when choosing a defense unit, only the defense factor (and probably cost as well, but I think tests have already been done on this).
- AI appeared to keep 2 military units in each city and 3 in the capitol (same as test 1). Number of citizens quelled by military is 3 in this test compared to 2 in the last, but no change.
- The numbers were pretty even at around 1/3rd for each unit. Germany built a slightly higher % of defensive units, and Soviet built a higher % of offensive units.
- Soviet lost less Spearmen than Germany, so this could have affected their build decision of more offense. Both countries lost near identical amounts of warriors and archers.
- Both countries first built only spearmen (defense), then started building archers (offense) a week later, and lastly started building warriors (even in both) at week 3 and 4. This is a good show of AI priorities in a very simple manner.
 
Bravo! :clap:

BTW, I was mulling over a set of tests to see which unit ability flag(s) the AI prefers. My thought was to have one unit each of equal A/D/etc. with ONE flag checked (ZOC; amphib; etc.) and the number of cities = the number of unit types. If one flag came up preponderently in a testing (building) round, I would note it as such and remove that unit from the next round's build queue, thereby hopefully establishing the precedence the AI gives to these flags.

My Very Best,

Oz

Yes, that is a very good idea, I saw it discussed much when I was reading through the thread. I will give it a go... I am staying out of the battles though, with my city on an island to watch the AI go at it, the AI is situated perfectly identical on each side to try not to bias AI in any way. I will try it out with 6 identical units with different ability flags (since I am using 6 cities) and whichever it produces most, will eliminate it in the next round - down to the last 2.
 
Bravo! :clap:

BTW, I was mulling over a set of tests to see which unit ability flag(s) the AI prefers. My thought was to have one unit each of equal A/D/etc. with ONE flag checked (ZOC; amphib; etc.) and the number of cities = the number of unit types. If one flag came up preponderently in a testing (building) round, I would note it as such and remove that unit from the next round's build queue, thereby hopefully establishing the precedence the AI gives to these flags.
My Very Best,
Oz

Settings for Test 3

The purpose of this test is to evaluate the AI selection among 7 types of units: each unit has an Attack

and Defense = 5, and ONE Flag Checked (ZOC; amphib; etc.) and the number of cities = the number of unit types. For EACH ROUND, the highest flag type built will be noted as such, and removed from the next round of testing, to try to establish the precedence the AI gives to these flags (thanks to Ozymandias for the info!). Combined Attack + Defense for each unit = 10. All units move 1. Conditions have been set to make this test as absolutely "vanilla" as possible.

1. There are two Civs. Each Civ has 7 cities and begins with no units. These civs start at war.
2. Each city begins at size 5.
3. Cities are limited to a maximum size of 5.
4. Each Civ is limited to one Gov type, “Despotism” modified to communal corruption and no tile penalties. All units are free, no units may be rushed, and war weariness is “none”.
5. No Civs have been given any bonus traits (Commercial, Expansionist, etc.)
6. Aggression for all Civs has been set to “3".
7. All Civs have been made members of different cultural groups.
8. All terrain is grassland which produce 2 food and 3 shields, with 1 hill with bonus resource for each nation.
9. There is one bonus resource which provides 25 gold; one of these is available for each nation.
10. Standard victory conditions are in use.
11. For this round, 7 unit types exist, see below.
12. All units cost 10 and require support.
13. EDIT: No Civ AI strategies have been checked (e.g., "Build Often"; etc.); unit strategy flags for all 7 unit types have been set to both "offensive and "defensive".
15. Number of citizens quelled by military = 3.
16. Each city has a temple which produces 5 content faces, 0 culture, 0 maintenance.
16. Techs take 70 turns to research minimum.
17. Level of play = Monarch, AI Aggression = Normal.
18. Each city will be able to produce 1 unit per turn.

Recall that the 7 types of units were:

"Warrior" A/D/M = 5/5/1 Flag: Amphibious
"Archer" A/D/M = 5/5/1 Flag: Zone of Control
"Spearman" A/D/M = 5/5/1 Flag: Defensive Bombard, Strength 5, Rate 2
"Swordsman" A/D/M = 5/5/1 Flag: Radar
"Pikeman" A/D/M = 5/5/1 Flag: Enslave ability; enslave results in a Worker
"Longbowman" A/D/M = 5/5/1 Flag: Ability to Stealth Attack Musketmen
"Musketman" A/D/M = 5/5/1 Flag: 1 HP Bonus

All units were flagged both "offense" and "defense".

Results are in the post below:
 
Back
Top Bottom