Long ago, I started looking into how the AI chooses which units to build. (https://forums.civfanatics.com/thre...oes-the-ai-choose-which-units-to-build.62138/) Ultimately, that thread went on for 5-1/2 years and 530 posts, with many people participating. Scores of different test cases were devised, and thousands of individual iterations run. Many others contributed ("Names Of Yore BomberEscort; neomega; Rocoteh. Then tom2050 picked up the ball, and really ran with it, rigorously testing the AI’s preference in flags.
It all began when I stumbled across a post by a fellow named Oystein, who - back in PTW days - suggested that the AI would be equal amounts of different units, as long as the combined values, in this formula, were equal:
(((3*A+2*D)*HP)+Bombard)
The “sandbox” .biq I built to test this was on a small map, with 3 Civs (Player + 2 AIs) arranged in an equilateral triangle.
The “bench line” parameters for the units, in every test, were:
• Every unit would have the values: (AF + DF = 10.) (I’m trusting that the advantages of this are obvious.)
• Strategy flags for all units were set to both "Offensive,” and "Defensive.”
• I decided to omit Bombard, as there were already too many variables in play. Also, not much was known about Artillery in Days of Yore, plus I decided that simple math should allow me to eliminate Bombard on both sides of the equation. (As later testing showed, for non-Artillery Units with a D Bombard, the AI was shown not to take Bombard into account, anyway.)
For the Civs:
• AlI Civ values (Aggression, etc.) were identical (“3.")
• Each Civ belonged to a different Culture.
• Each Civ was also limited to one Gov type: “Despotism“ modified to " Communal Corruption” with no tile penalties. All units were free; no builds could be rushed; and “War Weariness” was set to, “None.”
• No Civs were given any bonus traits (Commercial, Expansionist, etc.)
• Each city began at size 1, and all were limited to a maximum size of 4.
• Each City had access to one bonus resource, which provided enough Gold to build one unit per turn.
• Number of citizens born content = 3; number of citizens quelled by military = 1.
• All 3 Civs started at war with each other.
• Standard victory conditions are in use.
Other:
• All Terrain Tiles were “Plains,” producing 1 food, and nothing else, and were set to a Defense Bonus of "0."
• Standard victory conditions were used.
• One (1) Victory Location was placed in each Capitol, and three others were also added, roughly equidistant to both each other and each Capitol.
• Standard victory conditions were used.
• Level of play = Regent.
• Build Rounds were either 10 or 20, depending upon circumstances.
• All 3 Civs started at war with each other (this was one reason I chose to use 3 Civs, as that's the max number of Alliances.)
I chose Rome as my “Player” Civ, and let the Governor make all of Rome’s build choices.
NOTE: In my original set of tests, I had equal strength Units of both MF=1 and MF=2, and the AI simply ignored the difference. Much later, tom2050 came to the following conclusion: "The AI does increase the percentages of it's builds to a higher amount based on the units speed factor, but in reality units speeds hardly ever surpass 2, so if all else is equal, it will build a faster unit 65% of the time."
FIRST & SECOND BUILD ROUNDS:
I had my doubts about directly equating 1 additional HP alongside a simple (1 AF + 1 DF), so I tested that first. Combing Oystein’s formula with my unit parameters of “AF + DF = 10,” there was only one possible combination:
A (6/4/1/1HP) and a (3/2/1/2HP) BOTH flagged O/D. (The astute among you will already have realized that the (3/2/1/2HP) is the superior Unit. In a battle with a 0% defensive modifier, with the 6/4/1 unit attacking, the chance for victory is only 56.25% and this would go down significantly as the defender bonus increased from 0%, e.g., if the (3/2/1/2HP) had a bonus of 25% - Forests - or greater, then the victory chance of the 6/4/1 1hp unit falls below 50%.)
Here are the resulting builds by Civ, over 10 Rounds:
These Flags ...
1. Don't affect Unit Builds by more than ~5%.
2. Selecting more than 3 (maybe 4) of these options will "confuse" the AI, causing it to ignore all of your selections entirely.
Next up: first test results, still using (A+D=10)
Spoiler HERE'S HOW IT BEGAN :
It all began when I stumbled across a post by a fellow named Oystein, who - back in PTW days - suggested that the AI would be equal amounts of different units, as long as the combined values, in this formula, were equal:
(((3*A+2*D)*HP)+Bombard)
The “sandbox” .biq I built to test this was on a small map, with 3 Civs (Player + 2 AIs) arranged in an equilateral triangle.
The “bench line” parameters for the units, in every test, were:
• Every unit would have the values: (AF + DF = 10.) (I’m trusting that the advantages of this are obvious.)
• Strategy flags for all units were set to both "Offensive,” and "Defensive.”
• I decided to omit Bombard, as there were already too many variables in play. Also, not much was known about Artillery in Days of Yore, plus I decided that simple math should allow me to eliminate Bombard on both sides of the equation. (As later testing showed, for non-Artillery Units with a D Bombard, the AI was shown not to take Bombard into account, anyway.)
For the Civs:
• AlI Civ values (Aggression, etc.) were identical (“3.")
• Each Civ belonged to a different Culture.
• Each Civ was also limited to one Gov type: “Despotism“ modified to " Communal Corruption” with no tile penalties. All units were free; no builds could be rushed; and “War Weariness” was set to, “None.”
• No Civs were given any bonus traits (Commercial, Expansionist, etc.)
• Each city began at size 1, and all were limited to a maximum size of 4.
• Each City had access to one bonus resource, which provided enough Gold to build one unit per turn.
• Number of citizens born content = 3; number of citizens quelled by military = 1.
• All 3 Civs started at war with each other.
• Standard victory conditions are in use.
Other:
• All Terrain Tiles were “Plains,” producing 1 food, and nothing else, and were set to a Defense Bonus of "0."
• Standard victory conditions were used.
• One (1) Victory Location was placed in each Capitol, and three others were also added, roughly equidistant to both each other and each Capitol.
• Standard victory conditions were used.
• Level of play = Regent.
• Build Rounds were either 10 or 20, depending upon circumstances.
• All 3 Civs started at war with each other (this was one reason I chose to use 3 Civs, as that's the max number of Alliances.)
I chose Rome as my “Player” Civ, and let the Governor make all of Rome’s build choices.
NOTE: In my original set of tests, I had equal strength Units of both MF=1 and MF=2, and the AI simply ignored the difference. Much later, tom2050 came to the following conclusion: "The AI does increase the percentages of it's builds to a higher amount based on the units speed factor, but in reality units speeds hardly ever surpass 2, so if all else is equal, it will build a faster unit 65% of the time."
FIRST & SECOND BUILD ROUNDS:
I had my doubts about directly equating 1 additional HP alongside a simple (1 AF + 1 DF), so I tested that first. Combing Oystein’s formula with my unit parameters of “AF + DF = 10,” there was only one possible combination:
A (6/4/1/1HP) and a (3/2/1/2HP) BOTH flagged O/D. (The astute among you will already have realized that the (3/2/1/2HP) is the superior Unit. In a battle with a 0% defensive modifier, with the 6/4/1 unit attacking, the chance for victory is only 56.25% and this would go down significantly as the defender bonus increased from 0%, e.g., if the (3/2/1/2HP) had a bonus of 25% - Forests - or greater, then the victory chance of the 6/4/1 1hp unit falls below 50%.)
Here are the resulting builds by Civ, over 10 Rounds:
- Romans (player Governor) = 30 6/4/1/1HP = 100%
- Greeks = 28 6/4/1/1HP = 93% and 2 3/2/1/2HP = 7%
- Egyptians = 24 6/4/1/1HP = 80% and 6 3/2/1/2HP = 20%
- Romans (player Governor) = 9 6/4/1/1HP = 30% and 21 3/2/1/2HP = 70%
- Greeks = 18 6/4/1/1HP = 60% and 12 3/2/1/2HP = 40%
- Egyptians = 9 6/4/1/1HP = 30% and 21 3/2/1/2HP = 70%
Spoiler "Build Often" / "Build Never :
These Flags ...
1. Don't affect Unit Builds by more than ~5%.
2. Selecting more than 3 (maybe 4) of these options will "confuse" the AI, causing it to ignore all of your selections entirely.
Spoiler The "Rome Question" :
@AnthonyBoscia and I have had a half-joking back-and-forth about Rome, as some monkeying around in the code had to have been done to have Roman Legions capable of performing worker tasks. Over the years, it has seemed to me that whatever Civ is assigned the Rome slot plays more aggressively than other Civs.
Because I began these tests in prehistoric times, I simply used the first 3 Civ slots - Rome; Greece; Egypt - with Rome being the Player Civ. I let the "Governor" make all decisions - and you saw the results, above. (Of course, a simple answer here might be, "Never let your Governor do your Unit Builds.)
Because I began these tests in prehistoric times, I simply used the first 3 Civ slots - Rome; Greece; Egypt - with Rome being the Player Civ. I let the "Governor" make all decisions - and you saw the results, above. (Of course, a simple answer here might be, "Never let your Governor do your Unit Builds.)
Next up: first test results, still using (A+D=10)
Last edited: