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

next, Mao get a boost to 20/20/1 10sh, what will happen?
(archers and spearmen remain 10/10/1 10sh throughout this post)

Prediction: Mao will be produced in the 75% range, with the other two sharing around 12.5% This way, the actual sum power of the units will remain consistant
1 trial archers/spearmen/mao
r-4/5/91
e-3/5/92
g-6/7/87
b-3/2/95
total: archer 4%, spearman 4.75%, mao 91.25%

Question: Why did it bother building 8% of the others?
Test: Mao is bumped up to 100/100/1 10sh
1 trial archers/spearmen/mao
r-0/3/97
e-0/0/100
g-0/0/100
b-0/3/97
conclusion: that pretty much made the point that the ai gives a chance for any unit to be made, but chance increases with A and D values. Later I will test whether the flags play any role in determining if a defensive value (for O) units or an A value (for D) units, is considered.

Hypothesis: if mao is bumped down to 15/15/1, the pct for archers and spearmen will be about double that of the results when Mao was 20/20/1
1 trial archers/spearmen/maos
mao is now 15/15/1
r-10/6/84
e-12/15/73
g-9/18/73
b-6/8/86
pcts: archers: 9.25% spearmen: 11.75% Maos: 79%

Hypothesis: If mao is dropped to 10/1/1, he will be produced 25%, archers 25%, and spearmen 50%
Mao dropped to 10/1/1
r-37/41/22
e-32/57/11
g-32/47/21
b-29/48/23
pcts: archers 32.5% spear: 48.25% Mao: 19.25%
(I wanted, for purity, to make Mao 10/0/1, but then he could not have either flag selcted)
With 1 being required in maos defense, the numbers should be off a little... And I am done for the night :)
 
I agree with mrtn....fantastic work Neomega. :king:

I wonder if you could tell me if I understand your findings correctly. :)

At the moment, the late Civ3 Middle Age period has just two basic unit types; 6-3-3 Cavalry (offensive) and 2-4-1 Musketmen (defensive), so the AI should build roughly equal numbers of each.
But if Musketmen were made 4-4-1, and had dual AI stratagies (i.e. BOTH the attack & defence flags ticked), then am I right in thinking that your experiments show that the AI would build something like the following?:-
25% offensive 6-3-3 Cavalry, 25% offensive 4-4-1 Musketmen, and 50% 4-4-1 defensive Musketmen?
(Which, to a human player, would look like 3 foot units to every mounted unit, on average)
 
Originally posted by BomberEscort

Seriously, though. I am basing this on a test Ozymandias did with regards to a 3.2.1 2hp defender being chosen over a 6.4.1 1 hp defender (the 3.2.1 is the better defender and attacker, statistically). So the AI is aware of the importance of hp (nearly as important as AF/DF values) [...] We seem to have shown that the AI doesn't follow any 'logic' in its build choice, and I simply refuse to believe this is true...

In my last test, the AI built very few of the 2 available 2HP unit types; although my plea for mathematical aid had to do with a twist on this point -- that the AI seems to go, e.g., for the highest DF defenders rather than seeking any balance point; indeed, my "benchmark" 5/5/1 was a 5% build ... Anyway (given again that the AI seems to understand AF~=DF AND the value of HP -- which is the "better" defender, the 1/9/1 1HP or the 2/3/1 2HP?

-- BTW this last test of mine only furthered my opinion that there is a "breaking point" in the number of units available to select which changes the behavior of the AI erratically especially for O units; for D units it seems to simply like the highest DF, all else being equal, and will build many of these ...

Unless the mathematical analysis proves me wrong (hint, hint :D )

Best,

Oz
 
Originally posted by Kryten
I agree with mrtn....fantastic work Neomega. :king:

I wonder if you could tell me if I understand your findings correctly. :)

At the moment, the late Civ3 Middle Age period has just two basic unit types; 6-3-3 Cavalry (offensive) and 2-4-1 Musketmen (defensive), so the AI should build roughly equal numbers of each.
But if Musketmen were made 4-4-1, and had dual AI stratagies (i.e. BOTH the attack & defence flags ticked), then am I right in thinking that your experiments show that the AI would build something like the following?:-
25% offensive 6-3-3 Cavalry, 25% offensive 4-4-1 Musketmen, and 50% 4-4-1 defensive Musketmen?
(Which, to a human player, would look like 3 foot units to every mounted unit, on average)

I also concur re: your fantastic work Neomega :thumbsup: -- and Kryten's question is an interesting one, as I persist in turning up anywhere between 3 : 2 and 4 : 3 ratios of D : O units.

-Oz
 
Originally posted by Kryten
I agree with mrtn....fantastic work Neomega. :king:

I wonder if you could tell me if I understand your findings correctly. :)

At the moment, the late Civ3 Middle Age period has just two basic unit types; 6-3-3 Cavalry (offensive) and 2-4-1 Musketmen (defensive), so the AI should build roughly equal numbers of each.
But if Musketmen were made 4-4-1, and had dual AI stratagies (i.e. BOTH the attack & defence flags ticked), then am I right in thinking that your experiments show that the AI would build something like the following?:-
25% offensive 6-3-3 Cavalry, 25% offensive 4-4-1 Musketmen, and 50% 4-4-1 defensive Musketmen?
(Which, to a human player, would look like 3 foot units to every mounted unit, on average)

Well, I have yet to even play with the effect of MPs....
So here it is:
Archers are now flagged 10/10/2, and spearmen 10/10/1

I have already laid out the AI likes a 1:1 ratio of O and D units, so anything built above 50% for the archers should show the pct value the Ai places on a 2 MP unit over a 1 mp unit.

results: archers/spearmen
r-45/55
e-50/50
g-47/53
b-45/55

???---So the ai cares more about retaining it's 1:1 O/D balance than MP's?

OK, I'll try this:
10/10/1 archers, flagged O, 10/10/1 spearmen, flagged D, and 10/10/2 bismark
Hypothesis: I have seen the Ai cares incredibly about its balance of O and D units, so with an extra MP, I predict around 35%-40% bismarks, 10%-15% archers, and 50% spearmen.
results: archers/spearmen/bismarks
r-26/44/30
e-26/51/23
g-20/53/27
b- 22/47/31
archers: 23.5% spearmen: 48.75% Bismarks: 27.75%

this appears to be a 50/50 split on the offensive units. I do not see a real preference by the Ai for Bismarks over archers.

Next test: Does MP improve teh AI's want?
Bismark is bumped to mp of 4
Hypothesis: if Bismarks took 1/2 of the O units share with two, then 3 should take 2/3, and 4 should take 3/4. Therefore Bismark will be built with 75/2 or 37.5%, archers 12.5%, and spear of course, 50%.
r-12/49/39
e-10/52/38
g-16/52/32
b-11/53/36

:D :D :D
archers: 12.25% spearmen: 51.5% bismarks: 36.25%

Ok, so I pulled this hypothesis out of my A55, but damn I'm starting to understand this strange little thing.
 
Different Theory:

Instead of the Ai having a 1:1 desire for O and D units, I am going to instead assume it is the sum of A/D/M that is driving the ratio.

So, 10/10/1 archers and 10/10/1 spearmen were built not because of Ai's balance desire for equal amounts of O/D units, but because the Ai uses a formula that partitions ratios according to unit A/D/M sum vs total A/D/M sum.

HYPOTHESIS: To test this archers will be given 20/10/1 ,and spearmen 10/10/1 Archers A/D/M sum is 31, spearmen A/D/M sum is 21, total sum is 52, therefore archers should be built about 31/52 of the time or 59.6%
archers/spearmen
r-50/50
e-42/58
g-48/52
b-50/50

FALSE I think this can without a doubt answer that the AI seeks a balance based on the Ai property flags of a unit, perhaps later with civ build/often flags. For simple structure, it should be assumed the ai likes its offensive/defensive unit balance as 1:1

Now, Back to my mod, more in Mr. Omega's FST lesson tomorrow. :D
 
@Neomega -- although I must admit you're testing's proven more exhaustive than my own (! :worship: ) every indication of my early tests indicated that the AI ignores MF -- again, this jives with Oystein's formula as to how the AI calculates relative strengths between Civs, and was specificaly what led me to begin formulating my "Force Pool Theory" -- if the AI doesn't evaluate MFs, and the human designer wishes higher MF units to be in play, then the force pool must be constructed AROUND the fact that the AI build algorithms don't "know" what a MF is ...

... And how's THAT for a run-on sentence? :D

-Oz
 
BTW, sorry to interrupt again but has anyone thought of just contacting Firaxis people to know what algorythm they use :D but seriously.
 
Originally posted by LouLong
BTW, sorry to interrupt again but has anyone thought of just contacting Firaxis people to know what algorythm they use :D but seriously.

They periodically make a point of stating that they check out these forums -- but, no, I certainly have not. They probably view it as a proprietary business process (American legalese) anyway ... :rolleyes:

... But I suppose it's worth a try -- care to PM one of the honchos over there and pop the question :) ?

Best,

Oz
 
1 pop towns and artillery barrage

I made one stack of Red 25 infantry and placed it
in a plains tile (plains defence bonus set to 0).

I created a town (in plains) with 1 pop and 25 Red infantry
(no buildings in town).

No general settings changed.

The Yellow side consisted of only artillery:
30 Bombard 2 Range 4 ROF. Lethal land.

25 Yellow artillery were placed against the Red units in the plains.

25 Yellow artillery were placed against the Red units in the town.


I used multiplayer. (Otherwise it had been a short experiment).

6 Red units were destroyed in the plains turn 1
The remaining 19 on turn 2.

The town: 4 destroyed 21 remaining turn 1
5 destroyed 16 remaining turn 2
1 destroyed 15 remaining turn 3
3 destroyed 12 remaining turn 4
4 destroyed 8 remaining turn 5
6 destroyed 2 remaining turn 6
2 destroyed 0 remaining turn 7


Rocoteh
 
Originally posted by ozymandias
...which is the "better" defender, the 1/9/1 1HP or the 2/3/1 2HP...

Assuming an attack by a 1hp Cavalry and no defensive modifiers...

1hp Cavalry v. 1.9.1 1hp -- 40% Win / 60% Loss
1hp Cavalry v. 2.3.1 2hp -- 44% Win / 56% Loss

The 1.9.1 1hp unit is the better defender, but not by as much as you'd think. HP makes a huge difference... :D
 
Originally posted by BomberEscort
...decreasing [this is what I meant] the bombard defense of buildings and improvements to facilitate land unit bombarding by artillery...

This does not work, ironically this was my shortest test... I opened the editor and saw that almost all buildings have a defense of zero :cringe:

To all who come after me, TURN BACK... :suicide:
 
@BomberEscort -- many thanks on both fronts! - once again, even though the "defense=0" for most buildings is an unhappy revelation, better to know than not :wallbash: --Oops! I mean -- :thumbsup:

If I may trouble you further :) 2 questions:

(1) given all the tests we've run, do you think the AI was actually "evaluating" the 1/9/1 vs. the 2HP unit or using some other criterion (i.e., highest defense factor)? - and -

(2) in your view, of all the ((( A+D ) * HP ) = 10 ) units, is there a "best"?

Yet More Thanks,

Oz
 
Originally posted by ozymandias
(1) given all the tests we've run, do you think the AI was actually "evaluating" the 1/9/1 vs. the 2HP unit or using some other criterion (i.e., highest defense factor)? - and -

(2) in your view, of all the ((( A+D ) * HP ) = 10 ) units, is there a "best"?

Yet More Thanks,

Oz

Overall Test Results by Oz

Overall result of 320 builds --
01 1/1/1 O/D "Red Herring" = <1%
02 3/2/1 O 2HP = <1%
05 artillery = 1%
09 2/3/1 D 2HP = 3%
11 6/4/1 O = 3%
17 7/3/1 O = 5%
17 5/5/1 O/D "benchmark" = 5%
26 4/6/1 D = 8%
36 8/2/1 O = 11%
41 2/8/1 D = 13%
44 3/7/1 D = 14%
47 9/1/1 O = 15%
64 1/9/1 D = 20%

Obviously, all hp being equl the one with the highest attack factor is the best unit, in this case the 9.1.1 1hp unit...


Attacker-----Defender--AttWin-----DefenderWin
9.1.1--------1.9.1-----50.0%------50.0%
8.2.1--------1.9.1-----47.0%------53.0%
3.2.1 2hp----1.9.1-----43.8%------56.2%
7.3.1--------1.9.1-----43.8%------56.2%
6.4.1--------1.9.1-----40.0%------60.0%
5.5.1--------1.9.1-----35.7%------64.3%


Answer to Question #1
It appears, based on the information above that the AI does not factor which is 'truly' the best defender or attack availiable. If it did it would build roughly the same amount of 7.3.1 1hp units as 3.2.1 2hp units and this is not the case. I must admit, that this evaluation thought was just a very basic theory. Basically it looked like you testers had thought of most everything and I figured I'd throw this in the mix and see what happened...

Answer to Question #2
For Offense: 9.1.1
For Defense: 1.9.1
:D

This also assumes they all cost the same... BTW, has anyone done a test with the same unit but vary the cost to see how the AI factors in cost...
 
Has anyone given Catapults/Cannons/Artillery/Radar Artillery a MP of 2 or greater and the Blitz ability? Leave the rest of the stats unchanged... Maybe this will facilitate the survival of the bombard piece, since the AI can move, bombard, and moveback all in the same turn... I can't test this now, because I am at work... Maybe the issue is that after offensively bombarding the AIs turn is over, and the artillery without escort are sitting ducks... Maybe this is what it will take to get them out of their cities to attack...
 
Greetings One & All!

@BomberEscort - Thank you, and once again *sigh*.

@all - I'm going to take some time this weekend to pour back over the thread and do my best to summarize our results.

BTW I'm curious that no one has commented on my "working theory" that the AI is "designed" to work, within the context of the game, with a limited force pool selected by the game/mod designer. Any thoughts on this at all, given the evidence at hand?

Best To All,

Oz
 
I got the AI to offensively use catipults. All I had to do was give them 5 FP (4.1.5). They definately used them when I sat next to their city, and would follow it with an Archer attack (I made it so you could only build Archers, Spears, Catapults, and Galleys).

But I also saw several occasions where they'd follow a failed Archer attack with a Spear attack (against a healthy Spearman).
 
Back
Top Bottom