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

i think he means you can set 'attitude' for civs in the editor; like what kind of units they build much, their level of aggresiveness, and so on
 
i meant if the civ was expansionistic, militaristic, what kind of units to built often etc.
But i think that the AI strategies that you give your units have more influence, someone should check this out.
 
A great problem we are facing in ACW is that AI (so far)
refuses to build Army-type units

We have worked for a long time to find a solution
but without result.

Any theorys about this problem is appreciated.


Rocoteh
 
I think one way of understanding what units the AI will build is to understand the limitations of its tactics, as this has shaped many areas of the game.

1; The AI is prety useless at using artillery exept as a defences for cities, so I should imagine that it only builds them if the build often artillery flag is checked and the city already has a large contingent of deffenders.

2; Talking of deffense, the AI is useless at reinforcing its cities with units taken from another city. The only times The AI seems to move defenders is to escort setlers and to raid enemy resources. Because of this the AI has to build up every one of its cities as if it were expecting a strong and imediate attack, then if the city realy does come under attack the AI will rush build and draft defenders in that city. This is why the AI builds so many defensive units, as compared to the human player who will build up a strong defence only in those cities likely to come under attack, and if needed will transfer some of its forces to a point under attack.

3; the AI is useless at timing its attacks. In some eras in order to capture a city it can take up to a dozen units attacking on the same turn to capture a city. The AI tends to build all its units and send them imediatly in to battle, attacking one at a time peice-meal fashion. Because of this the AI only realy has a chance of winning a war in the first few turns, and in this case two types of unit have a good chance of winning;
Cheap attacking units, whatever their stats, if a lot of units attack in the same turn they have a chance of winning.
& cavalry units, which are good not only for the first few turns (where there fast movement can give them the ability to make the most of the element of suprise) but also for the rest of the war, where the AIs favoured partisan style hit and run tactics can tie up your defenders and slowly elliminate your attacking forces as they advance slowly on the AI cities.

4; The AI loves flags, amphibious, invisible, all terrain as roads, ZOC. All these give it more to help it in its essential first turn offensive and also some allow it to constantly attack, even without being at war.

5; The AI will build cruise missles ships and bombers, but tends to use them to destroy your infrastucture, rather than to soften up your troops before an attack.

Because of the strengths & weakness of the AI, it is programed to pick & use its forces in a certain way; It will build lots of cheap deffenders and attackers, It will build lots of cavalry units, It will also build special flagged units and somethimes ships, missiles and planes.

Of course this does not reveal how many of each type of unit the AI is likely to build, but it seems to be the general philosophy behind the AIs building strategy.

Two things I have heard are that the AI judges how good a unit is by how expensive it is, but I don't think that it automaticaly means that it will build the "better unit".
Also when flagging build often/never, I've heard that ticking more than three things tends to muck up the choosing capabilities of the AI. so that it tends to ignore what you've told it.
 
I don't know if this is the case, but since the AI is layered (global and for each city), one could imagine that the strategy also has two levels.
1. The global AI tries to determine the actual needs and sets priorities for cities, according to their size, production, etc.
2. City governors make the detailed choices.
If this is the case, testing may lead to very different results depending on particular circumstances. Still, this is probably the way I would have implemented the decision making. After all, units are also in competiton with other items, such as city improvements.

EDIT: Smoking Mirror, I have often seen large stacks of units coming to attack me that have included lots of defenders :ar15:. The AI thus obviously can redeploy units, although I agree that what it does sometimes seems to make little sense. To some extent such odd behaviour may be explained by the fact that the AI has a very poor understanding of the map. :crazyeye: It grasps simple concepts like, 'move these units toward the enemy's capital' or 'patrol this border', but cannot really develop any patterns for unit deployment. Redeployments are thus probably made only to assemble a striking force or to even out the defences, not as a response to potential threats. :nuke:
 
So, to update our working hypotheses --

1. The AI is (to put it kindly) poor at strategy (i.e., analyzing the OVERALL military situation and building and/or redeploying troops with the same sort of approach or ability a good human player would use.) A logical extension of this is that the overall strategic situation does not effect the AI’s decision as to what to build. (See Smoking Mirror’s earlier post on the AI’s compensating behavior for its poor strategic abilities.)
2. All flags being equal, will the AI will build a higher cost unit? – Or will it build a far greater quantity of cheaper units for both defense and offense?
3. The AI plainly gives significant weight to extra abilities, speed, and hit points.

4. All things being equal (... whatever that means at the moment ) the AI will give some preference towards building defensive units.

5. "Build Often / Never" flags are problematic: Smoking Mirror suggests that flagging more than three “build often/never” choices will confuse the AI.

6. If able to, the AI will always build a defender in an empty city, apparently choosing the cheapest available defender.

7. As the AI is pretty useless at using artillery except as a defense for cities, Smoking Mirror suggests that the AI will – only?? – build them if the both “build often” artillery flag is checked and the city already has a large contingent of defenders.

8. The AI will disband any starting Scouts at the beginning of a scenario with Map Explored checked -- Question: will the AI build any "Explore" units at all with that flag checked??

9. The AI will build cruise missiles, ships and bombers, but will tend to use them to attack infrastucture, rather than in support of ground attacks. (I include this point for use in some later stage of our investigations.)

10. BeBro raises the interesting question if the resources needed for a particular unit play a role; will the AI prefer e.g.. a unit that needs one resource only over another unit that needs two or three?

11. Zeekater raises the question if the AI’s aggressiveness will effect build decisions.

12. Ossric raises the question if the Civ attributes was Expansionistic, Militaristic, etc., plays any part in the AI’s decision making process

13. Rocoteh adds that coaxing the AI into building Army-type units is problematic.

Lucky 13 :)

... Please continue onto the next post ...
 
A post of Kryten's clearly laying out a progression of unit values has inspired me.

I'm proposing the following -- and definitely want feedback before I do this, so I'm neither missing anything nor doing anything stupid!

1. I'm going to build a testbed mod in which (i) all terrain is of equal movement and defensive value (ii) 3 Civs each have 3 cities (iii) these 3 cities are each at max pop (iv) improvements / wonders, settlers and workers cannot be built. Each city will have sufficient resources to build one unit per turn.

Note: given the various issues around ships etc., this first round of tests will be limited strictly to land units.

2. I'll pick a base unit -- e.g., a 5-5-1 infantry, cost of 20, as the "benchmark unit". This unit will be available in every iteration of the test.

3. Tests #1 throught "n" will be to modify the A/D/M for the alternate units to the 5-5-1, while keeping the cost for the alternates at 20. Simple math -- count up how many of each are built over, say, 50 turns. This should give a decent indication of the % weight -- e.g., "5-5-1s", "4-6-1s", "6-4-1s" etc. all equal from the AI's POV.

4. If, for example, "4-6-1s" and "6-4-1s" prove "equal", this should also fairly allow us to flag, for later tests, one as defensive and the other as offensive. So the next round of tests would how significant an effect these flags have.

5. Next set of tests will test build preferences viz. Civ attributes (militaristic etc.)

6. Next round will test build preferences viz. "build often" flags for offensive and defensive units.

... If we make it this far then we'll worry about artillery, ships, etc. ...

So, what do you all think?

Best,

Oz
 
Sound very interesting. Maybe the testing ground
should be 1 continent, since if the test will run so long
that you start testing AI building naval units, I think
AI never will,with only 1 continent.
It would be interesting to have that confirmed.


Rocoteh
 
Several people have been testing ACW's current test version to test some theories with regard to the AI, and I'll post a few of those here:

1) AI doesn't seem to build naval units if there is only one continent or a total lack of islands (as there is in ACW).

2) AI seems to build a mix of Infantry and Cavalry units IF you balance the two out, and give higher cost factors to "bonus" flags (such as ZoC, Blitz, etc.). Union/Confederate Cavalry in ACW have ZoC, movement of 2, Detect Invisible, and they can Pillage, with stats of 5/3/2 and 7/4/2. Union/Confederate Volunteers have no special flags, and have 7/9/1 and 8/10/1 for stats. Union Volunteers cost 110, Confederate Volunteers cost 130, Union Cavalry costs 140, Confederate Cavalry costs 170.

2a) Latest espionage report from Rocoteh has 20 Volunteers and 12 Cavalry being built by Confederate AI.

3) AI will build better, more expensive units once they are available. In ACW, unit stats are directly related to the cost, so they go up pretty much linear, with a slight reduction for some units later in the tech tree.

4) Naval/Artillery units in ACW all require at least 1 resource (with one exception, Napoleon artillery), and these are never built. BeBro could be on to something here.

5) AI aggressiveness has been upped substantially in latest test version of ACW, though no change in building habits has been noted yet.

6) AI refuses to build Army units even when their costs are CHEAP.

6a) AI seems hesitant to use Great Leaders to build armies.
 
I made an experiment with (ACW-thread Post 795) infantry
units bombardment strength 1 range 0 against infantry
units strenght 100 range 0.
It made no difference if strenght was set to 1 or 100.

I assume that most of you know that infantry units
(or others with dual cap.) with bombard strenght and
range 1 or more will never have their bombard strenght
used by AI.
Clarification: AI will not use bombard strenght (of dual
cap. units) to attack.


Rocoteh
 
About resource dependences:

Civ III being what it is, once you've hooked up a particular SR, there's no additional cost for using it as much as you can - the disappearance risk is independent of usage. It would therefore make zero sense for the AI to be hesitant to build resource-requiring units - if anything, it should build as many as possible as quickly as possible as insurance against getting access cut off.

Now, its not totally impossible that someone at Firaxis suffered a brain malfunction and endowed the AI with a such hesitancy, but it seems highly unlikely.
 
A thought re: the AI's refusal to build artillery in ACW; the starting units include plenty of artillery (much in the form of immobile coastal guns and fortress artillery, of course). I'm willing to bet that it makes up at least as much of the AI's forces as I've ever seen in a normal game.

This might suggest that the ACW AI thinks it's got sufficient artillery already, especially as losses of normal units will tend to be percentually larger in the opening battles. I don't think any playtest has run to a point where most of the AI's starting artillery pieces are gone, but the AI still have the resources to do more than just desperately rush defenders? Perhaps it would build artillery in a such situation.

What I'm guessing is, of course, that the AI has some kind of "ideal" force composition it's aiming for. As I've mentioned earlier in this thread, my impression is that it has, at least for the attacked/defender ratio.

And apropos that, someone said that the AI will use double-strategied units for attack or defense randomly. If my theory is correct, one would expect that if you gave it umpteen Archers at start, and only allowed it to build one kind of unit, which would have both strategies, it would make a great proportion of those units "DEFENSE" than if you gave them the same number of starting Spearmen instead.

I'm not going to have the time to make a test of that today - if no-one does it over the night, I'll run one tomorrow.
 
Just two remarks.
1. When you assign both attack and defense properties to a type of unit, you get to choose from three strategies when you edit such a unit on the map: attack, defense and random. If it is random, the question is if this leads to an immediate permanent assignment, or if the remains random and changes over time?
2. The units I referred to earlier (the 'defenders' in a stack of attacking units) were, for instance, standard spearmen, thus having only the defensive option set.
 
Originally posted by Pawel
Just two remarks.
1. When you assign both attack and defense properties to a type of unit, you get to choose from three strategies when you edit such a unit on the map: attack, defense and random. If it is random, the question is if this leads to an immediate permanent assignment, or if the remains random and changes over time?
2. The units I referred to earlier (the 'defenders' in a stack of attacking units) were, for instance, standard spearmen, thus having only the defensive option set.

1. Anecdotally, a single unit tagged with more than one property -- attack, defend, explore -- will be permanently assigned only one, which is permanent.

2. I don't think "defender" means that the AI simply uses such units to hold cities etc. -- indeed, the example you site is an example of this. It does seem that the AI has the wit to sometimes send "defensive" units on an offense, presumably with the intent of indeed adding to the defense strength of the atttacking stack.

-Oz

P.S. -- & hoping to maybe kill the proverbial two birds with one stone -- has anyone done any playing around with giving artillery an A/D of 1 (or more) and then flagging either the defensive or offensive but not the artillery strategy box? -- If this has any rational effect, it might certainly, e.g., help out the ACW guys.

-O.
 
Just butting in here i know, but awhile back i was just toying around with my units and i gave some of my artillery a defensive rating but no offensive rating and the AI built it when it came time, not necessarily ALOT but it was alot more than I had ever seen it use before. Maybe it was just a fluke but could the defensive value on the artillery have sumthin to do with whether the AI uses it more often? (just a note: the AI still didnt use its artillery very effectively in way, in fact it used it as a defensive unit for a mountain pass i needed in that scenario at one point and didnt bother to use its bombard ability 50 pct of the time or better)

*shrug* just a thought =) hope it helped sum...
 
The defensive value prevents capture, and thus makes it much safer for the AI to build the unit (which I guess it understands). If a side captures a unit it cannot produce, it is actually destroyed anyway - but I doubt the AI checks the tech tree very carefully. :)
 
Originally posted by ozymandias
P.S. -- & hoping to maybe kill the proverbial two birds with one stone -- has anyone done any playing around with giving artillery an A/D of 1 (or more) and then flagging either the defensive or offensive but not the artillery strategy box? -- If this has any rational effect, it might certainly, e.g., help out the ACW guys.

Well, I did post a suggestion some 18 months ago, when everybody was complaining about the AI not building or using offensive bombardment units.
(Not a single bugger answered it! Not even to say it was a daft idea!)

Basically, it was to give Catapults/Cannons/etc an attack factor equal to their bombardment value, and give them the 'offensive' AI strategy.
Of course, their range would have to be reduce to zero, in order to stop players from having an advantage over the AI (Catapults attacking ships at sea? Just what ranges are we talking about? :crazyeye: ).

This is after all how they were used in the old Civ2 days, and is how Archers & Longbows are implimented in Civ3.
So a Cannon whould be say 8 attack, 1 defence, move 1, but also have a 'defensive bombardment' of 8 as well.

The problem is....the AI would just see these as very powerful foot units, and build them instead of other infantry.

Still, it is a thought. :)
 
The idea of Artillery though is attacking without suffering loss, Kryten.

I'm going to knock off the offensive values for all Artillery in ACW and see if it results in any significant change in AI behavior.
 
Originally posted by Procifica
The idea of Artillery though is attacking without suffering loss, Kryten.

I'm going to knock off the offensive values for all Artillery in ACW and see if it results in any significant change in AI behavior.

Hmmm ... IIRC in the ACW the typical "Napoleonic" field piece was far more deadly on the defense, and certainly did take losses, unlike the howitzers of, say, WW1 ... Perhaps field pieces can indeed be best represented via Kryten's method whereas Parrot guns et. al. would be "traditional" Civ artillery -- indeed, these would have been able to lob shells at ships close to shore etc. -- Just a thought.

Oh well, so much for staying OT ... :crazyeye:

-Oz
 
Top Bottom