Unit AI

Show us how intelligent you are by discussing the AI in this forum.

Moderators: Balthagor, Legend, Moderators

User avatar
Legend
General
Posts: 2531
Joined: Sep 08 2002
Human: Yes
Location: Ancaster, Ontario - BattleGoat Studios
Contact:

Unit AI

Post by Legend »

Discuss Unit AI in this thread.
Janster01
Warrant Officer
Posts: 43
Joined: Aug 10 2005

Post by Janster01 »

The AI should NOT drive into out of supply areas, the AI should not build supply trucks it doesn't know what to do with.

The AI should grab land that are in supply , and make sure it continues to build the best units it has available at all times.

The AI should NOT build units it doesn't understand how to use, like the choppers or some of the planes.

Ta-da :)

Janster
Janster01
Warrant Officer
Posts: 43
Joined: Aug 10 2005

Post by Janster01 »

The Thumbhammer also works for the unit AI.

Janster
User avatar
Graymane
Major
Posts: 160
Joined: Jul 26 2005

Post by Graymane »

I think a good first step is to have the AI do the following when considering unit builds:

1. Use unit organizations and/or some form of a TO&E.
2. Have a set of defined mission types that those organizations can use.

As an example, something like mission type A, B and C and unit organization types 1, 2 and 3. Then we make a table with A, B and C along the columns and 1, 2, and 3 along the rows and put weights in for the order of preference. Once we also figure out recon and how the AI will determine force ratios and compositions, another table that would further weight the above choices with enemy estimates and terrain factors.

I also suggest having a number of different AI flavors (garrision AI, front AI, naval AI, etc, I'm not sure all the flavors needed, just the concept at the moment). Those AI would be seeded with the different types of organizations they prefer and the mission types they need to perform.

Mission types should have some of the following information:

1. Objectives (primary, secondary)
2. Objective radius (how far the units will spread out)
3. Entry/Exit criteria (how does the AI know when it is done, either fulfilling the mission or failing it).
4. Switches to other missions in some cases (i.e., if the mission succeeds, go to defense posture mission and await further instructions).

Things like pathing and in what order to move units should be at a more generic, lower level. Things like which objectives are chosen should be at a more specific, higher level. This level just fits them all together and tells them how to work together.
Janster01
Warrant Officer
Posts: 43
Joined: Aug 10 2005

Post by Janster01 »

At this moment in time, I am worried if they are able to make an AI that can coordinate attacks properly :(

While I agree it should have task forces, I seriously doubt it will understand these.

Thus, it will face an enemy and send units, who may appear piecemeal, unless they are either A stacked together or B, have an ability to judge the enemy force and wait.

The present AI does not have the ability to judge enemy forces it seems.

Janster
User avatar
Graymane
Major
Posts: 160
Joined: Jul 26 2005

Post by Graymane »

Janster01 wrote:At this moment in time, I am worried if they are able to make an AI that can coordinate attacks properly :(

While I agree it should have task forces, I seriously doubt it will understand these.

Thus, it will face an enemy and send units, who may appear piecemeal, unless they are either A stacked together or B, have an ability to judge the enemy force and wait.

The present AI does not have the ability to judge enemy forces it seems.

Janster
Yes, those are good points. It IS possible, just about anything is possible :) That is why it is helpful to make things layered, you give each layer a well-defined set of options and responsibilities. That way it only has to solve little problems instead of big problems.

If you limit the AI and say you can choose between force composition A, B and C and the enemy has force composition X, Y, and Z and by the way, here is the formula you use to evaluate force strengths, the AI can whip thru the problem in a few milliseconds. We don't let the AI just build whatever it feels like willy nilly, we tell it to use a higher level composition to take that decision out of its hands.

We also limit when and where it can go by giving it a well-defined AO (yes, this can lead to problems along the edges, but lets solve one bit at a time). Within that AO the AI has a choice of a few mission types that define what it is supposed to do and when it knows it is done.

How to tactically approach the objective with which kinds of forces is then a problem itself without all the other stuff in there as well. So if, you have a mainly armor force attacking a close-defense objective, the AI can be instructed to attack one way (maybe use more arty or air force or something). If it is on defense with the same kinds of forces, it will act another way.

Basically I'm saying lets teach the AI how to walk and talk before learning how to dance and compose poetry.
User avatar
Legend
General
Posts: 2531
Joined: Sep 08 2002
Human: Yes
Location: Ancaster, Ontario - BattleGoat Studios
Contact:

Post by Legend »

How should the AI decide how to attack or defend against multiple fronts? Perhaps one region, AI controlled, declares war and then other regions attack in response... now the region is at war with three regions.
What kind of rules should the AI make use of?
User avatar
Graymane
Major
Posts: 160
Joined: Jul 26 2005

Post by Graymane »

Legend wrote:How should the AI decide how to attack or defend against multiple fronts?
I wouldn't consider this a unit AI problem. It should really go in the other thread about AI coordination. The decision to attack has to be made at the highest level possible and the decision has to be made on the inputs of the lower level advisors (economic, diplo and military for example). It will also depend on the "flavor" of the AI (aggressive, econ, diplo, etc). Lets use Kansas as an example and pretend we have an aggressive leader AI.

The aggressive leader AI's first priority is to look for targets. Kansas shares borders with Colorado and Nebraska. The first order of business is an intel estimate of the bordering forces, this is delegated to the miltary advisor. The military advisor starts with a garrison and strategic AI to control existing forces (the AI should also start with some rough estimates of relative strengths at the beginning of any scenario since this is something every player knows going in).

The military advisor tasks the strategic AI with recon on Nebraska and Colorado. Kansas starts with a couple of long range mobile radars so one heads down the road toward Colorado and one toward Nebraska, maybe scanning along the border (depends on the mission type given the radar).

Meanwhile, the leader AI asks the diplo AI to analyze NE and CO (i.e., how aggressive are they? can we make treaties with them? etc). The econ AI is given the task of focus on military self-sufficiency (maybe stockpile oil and military goods).

The first recon comes back. There are no troops in range of the Colorado border. On the NE front, there are troop concentrations around Omaha and arty/garrison concentrations around Lincoln. Also, the diplo advisor comes back and says Colorado is neutral and NE doesn't like us.

The leader AI now has a decision point. Attack CO or NE or stay defensive? Another input might be build rates and build caps (i.e, use it or lose it). Kansas at the start seems to have a big advantage in force structure, esp armor, against both CO and NE.

CO is relatively unknown, we couldn't get good recon, NE seems like an easier target. The leader AI decides to attack NE and go to a defensive posture against CO. It gives that decision to the advisors. The econ advisor gives a list of priority areas it wants defended (oil derricks and military goods facilities since it is in military mode). The diplo AI starts negociations with CO to try to keep it neutral or friendly. The military advisor creates an offensive AI for the NE front and a defensive AI for the CO front. The front AI have defined AO (i.e., hexes it controls).

We now have a strategic AI, a garrison AI, a CO front AI and an NE front AI. The NE front is given force priority with the CO AI second, garrison 3rd and strategic 4th. There is a restriction that each AI gets at least some forces (say divisional strength or so).

Those AI now have their areas and missions in those areas (i.e., the CO defense AI will give a priority to defend high speed avenues into Kansas and protect strategic assets like any oil or military goods in its AO). It decides it needs X amounts and kinds of troops. The offensive AI sees that there are no North/South roads into NE but that it has open terrain.

Now, how it will conduct the attack and what its target will be depends on its mission and is an AI in itself, but the decision to attack has been made. After everything is sorted (troops are being built, existing troops are allocated, etc), D-Day approaches and the attack is under way.

Everything is going great but now CO decides to attack Kansas. Now the AI has to defend. We basically go thru the above process again. We need recon on CO, we need force estimates, we have to look at what is happening in NE. In our case, the attack is going well in NE so we keep up the tempo and the pressure. Maybe we take Lincoln and Omaha and decide to sue for peace (objectives met). We go over to the defense in NE and start allocating more troops to CO front.

At each point of decision, there is a clear delineation of responsibility. i.e., the lower-level AI never make choices until their mission is changed by a higher level AI. So, just because CO attacked doesn't mean the CO front starts attacking. If there was no CO front to begin with, the military advisor would create one. By default, the garrison AI has the whole country and the military advisor starts carving up the region as needed.

Now, when things start getting stretched out, then there needs to be some limits on the size of an AO (maybe 2-3 garrison AI are created, each responsible for a limited AO). Same thing with front AI, maybe they are defined from the border of a garrison AI to a depth of X hexes. The strategic AI would be responsible for areas beyond those definitions.

The basic process flow, to summarize, is:

1. goal-driven leader AI
2. goal selection (what does the AI want to do? attack, build up, work on social stuff, do research, etc)
3. gather data for decisions (how much money do we have? how big is our military? etc).
4. we now have a list of goals and data supporting each one
5. goal evaluation/sorting/selection (what do we want to do now?) A lot of work will be done here on the unit AI level to determine things like: what is a good economy? what is a good military? i.e., the evaluation functions.
6. goal delegation/execution (create missions/tasks for lower level AIs).
7. goal evaluation from the bottom up (i.e., mission completion, new targets, another AI attacked us, etc). This is where we have to turn ideas into math.
8. goals have defined exit/entry criteria, 6-7 above creates the feedback loop to evaluate how well we have completed the goal. We stay in this loop until some criteria is met.
Perhaps one region, AI controlled, declares war and then other regions attack in response... now the region is at war with three regions.
What kind of rules should the AI make use of?
Mostly I think I answered it up above.
Immunis
Corporal
Posts: 6
Joined: Aug 26 2005
Location: Birmingham, UK

Post by Immunis »

First off, I like this thread, improving the AI is essential to fulfilling the promise of SR.

One easy way to improve the unit AI is to give each unit a threat rating. This could be initialy based on the cost to build then tweaked as testing is done.

The AI will avoid combat or find defensive terrain if it is in combat with units that total a higher threat rating.
An agressive stance AI will try to back up it's units and build high threat units. Maybe it will target low threat opponents or build stacks to a certain threat value before attacking.
A defensive AI may back off before it's outpowered and build more low threat units.

The use of this single additonal data item allows the AI to judge different tactical ideas quickly and rapidly, before it gets into combat and is munched.

The next stage would be to separate land threat from air threat and allow the AI to consider where and how to use airpower over long distance.
prime_642
Captain
Posts: 106
Joined: Jan 14 2004

Post by prime_642 »

For a simpler AI threat estimation, why don't you try using hex military sums? In this system, each military unit has an assigned 'unit value', relative to the strength of light infantry, which will arbitrarily be assigned the value of 1. Only infantry and tank units, and possible ADATS units, will have unit values, all others will not have any whatsoever

Each land hex then has a 'military threat value' that is the sum of the unit values on the hex, AND the unit values of all hexes immediately adjacent to it.

In this system, first the regional/supreme AI would make a decision about which hex they should capture. The unit AI would then look at the hex and make an evaluation and decision like the following


If an AI is attacking an urban sprawl with a dense concentration of troops, with 7 light infantry on each city hex, then, the military value of the initial hex, the one farthest out and nearest the AI, would be composed of at least 14 units, and probably more like 21 units, if the hex is bordered on two sides by more urban sprawl. Then the AI would send in 42 light infantry units to capture that hex alone. Then, when the AI sees that it's remaining units' unit values are less than 2 times the unit values the next hex, which would have, say a military value of 35, presuming it was bordered on 4 sides, the AI would then stop, order it's units to entrench, and bring up artillery and additional units to complete the push. The AI would keep taking hexes until all enemy units in the immediate vicinity have been driven off, and none of it's units are under attack. The Regional AI would then pick a new target hex and the Unit AI would begin evaluating again.

Additional rules can be added in, such as:

Military value of hex greater than 21, less than 2 air defence units in a 6 hex radius, send in fighter/bombers or bombers from nearest air base

Military value of hex greater than 14, send in artillery located in a 4 hex radius

Military value of hex greater than 7, no close attack terrain, send in all tanks within a 6 hex radius

Military value of hex greater than 7, close attack terrain, withdraw all tanks, send in infantry
User avatar
Uriens
Brigadier Gen.
Posts: 588
Joined: Oct 05 2005

Post by Uriens »

Ok, some of my observations on the unit AI i came across so far:

1) Unit AI has resupply problems. It treats both lack of ammo and lack of fuel same way which it shouldn’t. When unit is out of fuel it has to stop and wait until it gets resupplied which is ok and logical. The problem is when unit runs out of ammo. Unit without ammo stands still until it gets ressuplied, just like it ran out of fuel. However, this is not good in 80% cases because unit will usually sit in a hex it just took over and have to wait for several game days until supply lines extend to its current position. During that time unit will be bombed, attacked, cursed by enemies, encircled (cutting off any chance of getting those supplies), being ridiculed by enemy for its stupidity, etc. This is one of the reasons why AI loses so many units needlessly. They run out of ammo and then - wait.

They should move to nearest hex that can ressuply them and should not override your orders when it's out of ammo (which it does currently). That improvement alone would make AI in general much tougher.

It also affects player because, when you order your out-of-ammo-unit to move somewhere and get supplies, it will only move 1 hex and then stop until supplies reach them. That means that unit that you sent back, e.g. to your base has stopped and waits without you knowing it and while it waits it gets bombed, attacked, cursed by enemies, encircled (cutting off any chance of getting those supplies), being ridiculed by enemy for its stupidity and eventually killed. Only way to avoid it now is to babysit your units and move them 1 hex at the time. This is most notable problem when you attack enemy territory deeper without supply trucks and need to pull your units back for ressuply.

2) AI has serious problem with attacking anything over sea. Basically it doesn't use transports of any sort (air or sea) to transport its troops and to attack its enemy. Playing Ireland or Britain in Europe scenario, for example, is a breeze since there is NO WAY you can lose as one of those 2 regions.

3) AI is too defensive with its ships. It basically waits for you to take one of its hexes (works like trigger) before he starts doing something with its ships.

4) AI needs to use artillery for attacks, not only defense. Currently only infantry/tanks/anti tanks/recons attack, while artillery sits in cities and (more often) around base where it was built. AI runs out of those attackers often enough (mostly because issue I mentioned in under 1) and is left sitting with loads of artillery sitting around its bases. This is most notable with Greece in Europe scenario.
Note that AI will place units in cities it owns including artillery and it’s a good thing and improvement of the AI. However AI very often doesn’t send artillery in those cities (sometimes it does) even though it has them sitting around bases doing nothing. AI should try to place at least 1 artillery unit in each of its cities whenever possible.

5) Related closely to 4. AI needs to build less artillery and more other (attack) troops when it decides on unit production. It most often runs out of attackers and response troops (those units that go after your units attacking his territory), so he is left wide open for you to do whatever you want with it (cut his supplies, bomb him with artillery, attack specific targets) without feat of retaliation or at least interruption from it's units.

6) There seems to be a bug in unit AI that sometimes sets unit to 'waiting for path' where it sits and waits forever (even though unit is not cut off). When some enemy unit engages it, it won't even return fire (sitting duck if you will). I noticed this problem every time I was watching Germany AI in Europe scenario.

Hopefully, all or at least some of this will prove to be useful to devs to make AI better and harder. :-)
User avatar
Legend
General
Posts: 2531
Joined: Sep 08 2002
Human: Yes
Location: Ancaster, Ontario - BattleGoat Studios
Contact:

Post by Legend »

These are all great posts... huge, but great!

Here is a new question about AI units:

How should they support their allies?
How would they know how to support them and in what force size?
tonystowe
Colonel
Posts: 462
Joined: Apr 10 2006
Location: Tennessee

Post by tonystowe »

Legend wrote:How should the AI decide on how to attack or defend against multiple fronts?
As I scramble brain my ideas I hope to answer some portion of your questions.

The AI needs the ability to assess its available intel and determine the necessary amount of force needed to defend itself. The AI needs to understand that a combined force and training will add the necessary combat mulitpliers to allow it to defend itself as well.

As I have mentioned in another threat concerning intel related options for this game, the AI should utilize its available intel capable assets in determining the threats against it and use these assets continuously. In my non-programming thinking, if the AI would build and deploy its intel capable assets and collect on the enemy activity and types of units the enemy is moving, it then could analyze the amount of force projection being pushed against its border(s) and begin building up its forces to counter the threat(s). In addition to the military moves, the AI could also begin diplomatic actions to counter possible enemy buildup. The diplomatic actions would be with the aggressor region(s) as well as neighboring regions to gain sympathy and support in dealing with the buildup, and the WM.

In my games I develop and deploy my intel assets and while I am exhaustingly collecting the information from their passes along the border I am building my combined arms elements to counter possible threats.

These elements, refered to DIV's from now on, are designed with either offense or defense in mind. The AI should be able to distinguish between a defensive or offensive posture as well as deploy units in that fashion. In a defensive posture the AI might position in its 7x stack DIV: 1x Tank, 2x INF, 1x ENG, 1x AD, 2x Arty. In the AI's offensive posture it might deploy: 3x Tank, 2x IFV, 1x AD, 1x Arty. See the difference?

Currently the AI deploys a few Infantry BN's along its borders but nothing to support them to hold the line. The AI's use of aircraft and air defense assets in defending its soveriegnty its poor at best.

In my last game as I built up forces against Georgia from Tennessee I never observed an increase in the AI's defensive posture. In so much I ran it over to the point of owning all of Northern Georgia without getting a scratch. Granted the AI sent forces piecemeal to meet my moving units but it never stood a chance with my combined arms stacks and air support.
Legend wrote:What kind of rules should the AI make use of?
A question that I may not be qualified to answer, however in my quest. . .

At Game Start does the AI:
1. understand the makeup of its beginning forces in terms of offensive/ defensive force projection?
2. understand the concept of a defense in depth for its air defenses and ground force structure (structure term used loosely here)?
3. Realize that it should pre-position forces that can reach potential trouble spots yet not appear threatening to its neighbor?
4. Take into consideration the beginning force structure and build units to satisfy its intentions whether offensive or defensive?
Draken
General
Posts: 1168
Joined: Jul 14 2004
Human: Yes
Location: Space Coast, FL

Post by Draken »

One thing I have notice when doing amphibious or airborne assaults against the AI, is that it doesn't react with enough strenght to repel the invading forces, it just send a few units allowing me the time to land reinforcements and gain local numeric superiority. And that is the begining of the end of that AI region...

What the AI should do after it detects a landing, is to launch a coordinated counter attack with at least with a 3 to 1 numeric advantage to "close the door"
tonystowe
Colonel
Posts: 462
Joined: Apr 10 2006
Location: Tennessee

Post by tonystowe »

Draken wrote:One thing I have notice when doing amphibious or airborne assaults against the AI, is that it doesn't react with enough strenght to repel the invading forces, it just send a few units allowing me the time to land reinforcements and gain local numeric superiority. And that is the begining of the end of that AI region...

What the AI should do after it detects a landing, is to launch a coordinated counter attack with at least with a 3 to 1 numeric advantage to "close the door"
I agree Draken. I recently conducted an air assault operation against the AI. I captured two bridges that were of no strategic importance, however at the tactical level they led to a power plant and three other industrial targets. I landed two INF BN's on each bridge and one INF BN on each industrial target and later moved one 7x Stack offensive element and an additional 2x AD units into that area. The helicopters had F-16 escort's for the trip to and from the targets and provided CAS/Air Superiority coverage until the ground force arrived.

The AI had no air defense established to counter this threat and it didn't appear that the AI had even considered me moving in that direction. The surprise was the fact that the AI had not considered the power plant a viable target - I at least expected it to be protected a little!

The deep insertion of these forces further complicated the AI's struggle and its ability to react accordingly. First the AI sent in a few aircraft that I believe were more concerned with the ground forces instead of countering the air threat (I may have been mistaken) which were dispatched quickly by the F-16's. Then the AI trickled in piecemeal units that simply could not break through the INF with CAS that I had holding the objectives. I also noticed that the AI did not deploy any serious AD to counter my air superiority. This action pulled alot of resources from the enemy's defense of my primary objective - the capitol and associated bases.

Tony
Post Reply

Return to “AI - Artificial Intelligence”