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

Wow, been a bit since i got on here and had a look, lots happened!

pretty interesting results so far....

If theres a way the comp. figures out how useful a unit is....whats the formula? Is there a way we can figure it out mathematically without runnin 8 billion equations with enough numbers to make even my head spin??

GJ and GL all =)
 
Rocoteh,

Same thing happened to me when I upgrade to PTW 1.27. Mod makers, BEWARE THE PATCH!
 
davbenbak,

Yes it was frustrating. In the playtest I was at Turn 400,
but the save also refuse to load. (By the way, it was a DyP
variant).

About AI-builds:
In the current ACW playtest I am running, forced labor
can be used by CSA (in this test under AI-control).
AI use forced labor as a form of "extra-draft" with the result
that only 2-3 cities are at 6 in population (out of 60 cities).
They will never go over 6 in population, then AI "extra-drafts."

Now what is strange: The Last Conformist (also playtesting
against CSA-AI) reports no problems with AI "extra-drafting".

The overall strategic situation is rather similar in the 2 playtests.

At the moment I have no good idea to explain why AI reacts
with so great difference.


Rocoteh
 
Originally posted by Rocoteh
The overall strategic situation is rather similar in the 2 playtests.

At the moment I have no good idea to explain why AI reacts
with so great difference.

Any chance that, although the overall strategic situation is similar, much heavier casualties were produced in one game?

-Oz
 
I think you have found the solution!

I am keeping track of the CSA Mobile forces.
If you define them as mobile infantry + cavalry,
( mobile artillery units are few since AI refuse to
pruduce them) they are now (Turn 120) down to
183 units. It would be intesting to hear which
stats The Last Conformist have.

Anyway I think you are right.


Rocoteh
 
Originally posted by The Last Conformist
It just hit me that someone ran a test of how military strength is computed.

Some searching turns out that this someone was Oysten in this thread, and that the result was that unit strength is considered to be proportional to (3*A+2*D)*HP+B. Arathorn suggested he take a look at this thread, but if he's done so he's not commented on this issue.'

Now, my idea is that a similar formula could be used for chosing among units - of course, some sort of allowance is then presumably made for cost and flags, as well as MF.

In the present form, the formula clearly doesn't square with Rocoteh's results with units with a defensive bombard, which makes me suspect that the bombard strength should be multiplied by the bombardment range, and quite possibly also the RoF. (Oystein apparently only tested with those at =1.)

An alternative to my suggestion in post #89 could be that the AI calculates a "usefulness score" for each unit it's able to build, and then assigns each unit a proportional probability of being built. This would allow the AI to do without any "strategic planning" for what kinds of units it builds - even if a 3.1.3 attacker would have the highest "usefulness score" it would get some 1.2.1 defenders built.

My few days "silence" on this topic has been spent, among other things, pondering this info re: my initial thoughts on methodology -- i.e., trying to find an "equivalence factor" beginning with A/D, then proceeding to MF, etc. As I cannot find any statistical sense to the AI builds re: MF in the tests I've run (although it DOES seem that A~=D) this tells me that either (a) the methodology we've been trying is incorrect; (b) the methodlogy is incomplete; or (c) the AI choices around evaluating the relative worth of MF is either (i) arcane (you know, take the number of units in play, divide by the phase of the moon, and multiply times pi) or (ii) more tightly bound to the overall "vanilla" game.

For example (and it's been so long since I've played "vanilla" Civ that the answers don't come right to mind) at any given "tech level" (yeah, I know, an abstract notion in this context, but kindly bear with me) -- maybe it's better to say, "at any given point in time (given a competent player etc.) how many different unit types does the AI have in its build inventory?" Perhaps THAT's where the whole MF question is addressed, by the limits in the AI's presumed build inventory ...

I'd be very curious to hear from any of the SOE guys as to how the AI is handling what I believe to be a huge number of available units at any time ...?

Anyway, I'm going to play around with Oystein's formula some -- my initial thoughts are (i) ignore bombardment factors at first; and (ii) see what sort of experiment I can cobble together to see if the so-far elusive "equivalence factor" is indeed ((3*A)+(2+D))*HP -- which flies in the face of our earliest tests where, with all HP equal, it seemed that A=D. Of course, as we're dealing with algorithms and not straightfoward formulae -- i.e., lots if IF / THEN / ELSE / ETC. conditions -- then it may indeed be that A=D ONLY if HP=HP ...

EDIT: Of course, the second I finished writing that last paragraph, it occured to me that (i) keeping both test units in a pair with A+D=10 is impossible if HP varies (*duh*; *sigh*) and (ii) the only test case which meets these criteria are a 3A/2D/2HP and 6A/4D/1HP.

Comments?

Thanks,

Oz
 
I began the test outlined in the last post without much in the way of expectations. As mentioned, 2 units were again involved, following Oystein's strength formula: Strength = ((3*A)+(2+D))*HP (ignoring bombardment for the time being). Again, trying to keep some sort of benchmark in place, I wanted one unit to have A+D=10. So 2 unit types were available: 6/4/1/1HP and 3/2/1/2HP, BOTH flagged O/D.

Results over 10 turns (sorry, i know it's down from 20, but it's tedious, and I've only seen value in going beyond 10 turns once so far, and methinks that determining if that was an anomaly or not is kind of like computing pi to the last decimal ...):

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%

... So much for an "all things being equal" correlation to the strength formula ...

HOWEVER, my next test case kept the same units, with the difference that 6/4/1/1HP was flagged "Offensive" and the 3/2/1/2HP "Defensive", which produced a HUGE difference in builds:

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%

NOTICE THAT THE PLAYER GOVERNOR AND THE EGYPTIANS BUILT IDENTICALLY!

-- Also, once again the Greek and Egyptian builds were considerably different; possibly I'm either (a) missing something subtly different in their strategic positions on this barest of playing fields or (b) the AI somehow chooses different build strategies for different Civs based upon unknown criteria, although NB: I would make a case that, once again, the Greeks chose a more conservative build strategy over the Egyptians -- at least that's how I'd evaluate it, PLEASE feel free to differ!

I'm not certain what (tentative) conclusion(s) to draw at this point, but I'll certainly be mulling it over this weekend.

Abraxas,

Oz
 
Sorry for not keeping in touch with this project of yours ozymandias, but the usual excuse I'm afraid....I'm already up to my neck in dozens of unfinished projects at the moment. :crazyeye:

A quick suggestion: would it help to cut down on the number of experiments if we just confined ourselves to pratical AI strategies?
Rather than experiment with every possible AI & stat combination, would it not be easier if we focused on some sort of taget?
May I suggest only combinations and variations of offensive fast units (with high attack but low defence) and duel strategy foot units (with roughly equal attack & defence).

What I mean is.....fast & mounted units in most mods/scenarios will almost always be offensive only, so even if we could 'con' the AI into building the correct amount of these if they had the defensive strategy, the AI would just use them to defend cities with (and I'm sure that nobody wants all the cavalry units hidding in cities! :lol: ).

Just a thought. :)
 
Kryten - no apologies necessary! Real-life demands are just that -- real -- which is why I strongly prefer surreal life demands ... :crazyeye:

I think your idea is in general a good one -- that is, testing faster Attackers against slower Defenders:

1. It makes sense (historical; intuitive; game) that Offensive units in general be faster than their Defensive counterparts.
2. It still allows an "anchored" benchmark unit of some sort.
3. In general I agree with you re: "fast attack" and "slow defense" -- but bear in mind that this last set of tests showed how dramatically a flag can change production of otherwise identical units!

However, I have a real concern is re: dual-strategy slow units --

1. The earliest experiments didn't seem to suggest any way to provide a benchmark (at least, via a direct correlation) between A/D tradeoffs re: speed in dual-strategy units irrespective of speed.
2. The most dramatic effect I've seen so far was in the last test, switching both units from O/D to O=6/4/1/HP=1 and DD=3/2/1/HP=2.

Also, an observation -- In general, the AI seems to give a clear preference to producing units which it considers "defensive", at least under the present "controlled" test environment (NB: One point I forgot to raise in the test of the 5/5/1s vis-a-vis the 5/5/2s was that EVERY city produced a 5/5/1 on turn 1, leading me to tentatively conclude that the AI considered this a defensive unit precisely because of its MF=1.)

There are some noteable exceptions (the Greeks in the last test -- then again, the disparity between Greek and Egyptian builds in general is puzzling :confused: )

--Anyway, I think the last test also shows that the AI seems to value HP most highly of all (which BTW jives with Oystein's formula).

So on to the next test criteria ...

I think going back to a three-unit test would be a good reality check:

1. 5/5/1/1HP flagged O/D
2. 7/3/2/1HP flagged O
3. 3/2/1/2HP flagged D

This basically grafts the most recent test (with a wider spread in A/D) with the earlier attempts re: a benchmark O/D unit.

-- Thoughts, etc.???

Best,

Oz
 
In ACW (as mentioned in an earlier post) AI will only
with (one exception) build 2 type of units at a given time.

Have this problem been observed by others?


Rocoteh
 
Originally posted by Kryten
What I mean is.....fast & mounted units in most mods/scenarios will almost always be offensive only, so even if we could 'con' the AI into building the correct amount of these if they had the defensive strategy, the AI would just use them to defend cities with (and I'm sure that nobody wants all the cavalry units hidding in cities! :lol: ).

The AI massively uses its defensive units to guard offensive troops on their way to the battlefield.
In my current game (yes, I am actually PLAYING!) the Vikings send their troops through my territory and escort nearly every offensive unit with a defensive one, which heavily slows down the troops' speed.
I agree that defensive cavalry is not a good idea, but defensive motorized troops with more than move 1 (e.g. mech infantry) are very useful for this purpose and the AI will correctly use them.

So I think fast defensive units are useful and should not be taken out of consideration.
 
Reports from ACW Scenario-Developers makes it now 100%
that AI (with one exception) will never produce more
than 2 types of units at a given time.

Have this been known before?
To me its negative news.


Rocoteh
 
Originally posted by Der PH


So these can be two different units every turn?

Clarification:

During the very long playtesting with ACW (7 months)
no one have observed AI building more than 2 type
(with one exception) of units at the same time.

For example: turn 20 CSA Volunteer/Cavalry.
If AI gets new tech it can be CSA Rifleman/Cavalry on turn 21.


Rocoteh
 
Originally posted by Rocoteh


Clarification:

During the very long playtesting with ACW (7 months)
no one have observed AI building more than 2 type
(with one exception) of units at the same time.

For example: turn 20 CSA Volunteer/Cavalry.
If AI gets new tech it can be CSA Rifleman/Cavalry on turn 21.


Rocoteh

Hi Rocoteh,

Sorry for sounding dense, but I want to be 100% certain -- is it:

1. That the AI will BEGIN PRODUCTION of no more than 2 unit types PER TURN, or

2. That the AI will NEVER HAVE IN PRODUCTION more than 2 unit types AT ANY GIVEN TIME?; and

3. What was the deal with the one exception? An exceptionally expensive unit perhaps?

-- And many thanks for all your contributions! :thumbsup:

-Oz
 
Is it always one offensive and one defensive? Or does that switch around, too? Sounds like a rather bad lock mechanism, if it's only ever two types in production....or does it change what it's building in all cities sometimes? I can just imagine some podunk border city building an archer @ 1spt, forcing core cities to do the same, even though the AI civ has chivalry..... And a loop like that could easily be infinite, or at least very long.

Lots of possibilities but still too little hard data.

Arathorn
 
Originally posted by Arathorn
Is it always one offensive and one defensive? Or does that switch around, too? Sounds like a rather bad lock mechanism, if it's only ever two types in production....or does it change what it's building in all cities sometimes? I can just imagine some podunk border city building an archer @ 1spt, forcing core cities to do the same, even though the AI civ has chivalry..... And a loop like that could easily be infinite, or at least very long.

Lots of possibilities but still too little hard data.

Arathorn

I raised this question in an earlier post -- it's been so long since I've played "vanilla" Civ that I no longer recall off-hand what units are available when.

Does anyone happen to have handy a chart showing contemporary (or roughly contemporary) units uin the un-modded game? I.E., how often are there more than 1 O/D unit available at any one time, and what are the circumstances, and how often does the alternate (like Marines) get built? -- I think a "gut" feel for this last question would suffice.

This has to do with my concern that the AI DOES NOT ACTUALLY HAVE A BUILD ALGORITHM WHICH WAS DESIGNED TO FUNCTION INDEPENDENTLY OF THE SET OF OPTIONS PROVIDED IN THE VANILLA GAME!

(Sorry for the "shouting", but I know I've got some very long threads in this post, and I wanted to get your attention ;) )

Musingly Yours,

Oz
 
Contemporary defensive units? Hardly ever.

Contemporary offensive units?
Early ancient age: Warriors and archers (and chariots)
Middle/late ancient age: Swords, horsemen, and archers
Early Medieval age: Medieval infantry (PTW, not vanilla, but...), longbow, knights
Then it narrows much more....

It does seem like the AI gets locked into a "standard" build -- if you see a couple archers, you're likely to see a million of 'em, similar with swords/horses, but I don't know whether that's a resource issue, biased anecdotal evidence, or what....

It appears the AI might have a "default" offensive and defensive unit that it chooses at some point (and changes when???????) that it builds whenever one is called for.... Hard to say, really, but it's a possibility.

I dunno....

Arathorn
 
Top Bottom