Jump to content
Sign in to follow this  
maturin

A command-based AI cover system

Recommended Posts

Before anyone gets excited, I'm not advocating Gear of Wars here.

BI did deliver on their promise of per-pixel movement, allowing the AI to take cover behind any object autonomously. You see soldiers leaning around poles and corners, bending their torsos on the edges of walls so only the right part of their upper body is exposed. Forget that they can do stuff like this, and you are going to die very surprised.

The problem? They know how to take cover, but only a fraction of a squad will exhibit this behavior a fraction of the time. Vastly more time is spent by your squadmates and your enemies lying down in the middle of a road waiting for the tanks to roll by. They can't decide whether to stay in formation or stay in cover, and end up doing neither.

To get the AI to show some sense of self-preservation, they need help from the team leader. However, giving them move order around a courtyard or, heaven forbid, a house, usually results in absolute chaos. Telling them to take a position behind a low wall will usually make them lie uselessly down on the wrong side of it.

My suggestion is to teach the AI the concept of picking a nearby object (rock, tree, building, wall) and putting it between themselves and a given threat. Make this sort of logic the basis of the Find Cover command, while leaving the extant behavior in place.

Since a complex battlefield will have more threats than it is geometrically possible to hide from, the Team Leader must tell the AI where the danger is. The threat is defined by the enemy the CO has designated via the target menu, his Watch There or Watch Direction heading, or when an AI rifleman sees an overpowering enemy such as an MBT.

The procedure would be to tell your squad to watch an enemy or enemy position, then hit the currently broken and useless Find Cover command. This would make them break formation and put object C in-between persons A and B.

In Danger or Combat mode, the AI could do their best to apply this principle when given Engage commands as well. When figuring out their approach, they could deviate slightly from the direct path to choose the one with more concealing and occluding objects. If this could be done, you would see soldiers closing with the enemy through vegetation and cluttered suburbs rather than dashing into the open like Picket until they feel good about the range.

This idea wouldn't improve gameplay dramatically unless AI Team Leaders could take advantage of it as well. Telling AI to Take Cover tends to mess up your formation and slow your progress, so the AI should only order it when there are no active waypoints requiring them to move. But if they are stationary and under fire, a Take Cover command should be SOP. That way, the next time you slap down a squad in a village and pull out your sniper rifle, they won't just stand there like paper cutouts on the range.

Edited by maturin

Share this post


Link to post
Share on other sites

great suggestion but i think comes up often. (don't come here often:o)

though you certainly have more detail:D (than the ones i have seen)

hope BI will do something about the cover system though:(

Share this post


Link to post
Share on other sites

best find cover scripts are actually made by SLX (Solus) or now WIP by SNKMAN for GL4.

Share this post


Link to post
Share on other sites
My suggestion is to teach the AI the concept of picking a nearby object (rock, tree, building, wall) and putting it between themselves and a given threat. Make this sort of logic the basis of the Find Cover command, while leaving the extant behavior in place.

This is exactly how it works now. However, it is a bit harder. First, you cannot only pick an object, you need to select one particular location. Second, the location you select needs to fulfill some criteria:

- it must provide a cover (or at least concealment) from danger

- it must be free of obstacles (the soldier must be able to stand there)

- it must not be occupied (two soldiers cannot use the same corner)

- it must reachable from current units position

- (optional, bonus) gives you firing opportunity at the target

- (optional, bonus) it is far from the route to the waypoint

Esp. the reachability is what makes it complicated. This means the cover selection needs to be connected to path planning (or use path planning to verify its selection). Path planning is quite costly operation.

Share this post


Link to post
Share on other sites

Esp. the reachability is what makes it complicated. This means the cover selection needs to be connected to path planning (or use path planning to verify its selection). Path planning is quite costly operation.

Sounds to me as if the AI has the right FSMs, but the environment is not easy enough to navigate. Maybe something like the paths inside of buildings would be needed for the outside walls too?

Share this post


Link to post
Share on other sites
Esp. the reachability is what makes it complicated. This means the cover selection needs to be connected to path planning (or use path planning to verify its selection). Path planning is quite costly operation.

It seems more and more (and is very understandable) that costly AI path planning is the culprit behind much of the observed strange AI behavior or shortcomings. Just out of curiosity, are you (the devs) working on ways to improve it in the near future?

---------- Post added at 11:24 AM ---------- Previous post was at 11:13 AM ----------

)rStrangelove;1833521']Sounds to me as if the AI has the right FSMs' date=' but the environment is not easy enough to navigate. Maybe something like the paths inside of buildings would be needed for the outside walls too?[/quote']

This is something I also thought about. Using more precomputed/preplanned pathing in some places may improve the AI significantly. If we had the ability via script and/or world editor to define paths similar to those used for navigating buildings, it would also be useful for getting AI to travel where they never could before (ex: complex structures built up from multiple objects). Furthermore if they could be created and destroyed/modified in real time it would still allow for some degree of adaptation to changing environments (objects being destroyed).

From a mission editing standpoint, god knows how many times I've wished for a way to give AI low level waypoints like this. Even if it's just a simple set of linearly linked nodes that guide the AI's pathing.

Share this post


Link to post
Share on other sites
It seems more and more (and is very understandable) that costly AI path planning is the culprit behind much of the observed strange AI behavior or shortcomings. Just out of curiosity, are you (the devs) working on ways to improve it in the near future?

.

This to me would be Holy Grailish and any news upon something like this is almost the sole reason I frequent these forums (also pretty cool people here).

Share this post


Link to post
Share on other sites

awesome idea and to see real feedback.

perhaps the AI solution doesn't have to 100% perfect right away.

when people take cover they have immediate criteria (being out of direct fire is good enough for major instinct) and then self-adjust as needed (crap there's another guy taking cover here i'll move, or it's hard to shoot back maybe there's a better spot, etc).

perhaps that kind of looser thinking can be used to get the AI places at a lower computational cost and then if it isn't right position they'd self adjust by moving to another nearby piece of cover.

would make them seem a bit more human to.

just a suggestion.

Share this post


Link to post
Share on other sites
This is exactly how it works now. However, it is a bit harder. First, you cannot only pick an object, you need to select one particular location. Second, the location you select needs to fulfill some criteria:

- it must provide a cover (or at least concealment) from danger

- it must be free of obstacles (the soldier must be able to stand there)

- it must not be occupied (two soldiers cannot use the same corner)

- it must reachable from current units position

- (optional, bonus) gives you firing opportunity at the target

- (optional, bonus) it is far from the route to the waypoint

Esp. the reachability is what makes it complicated. This means the cover selection needs to be connected to path planning (or use path planning to verify its selection). Path planning is quite costly operation.

I see.

Perhaps use of the Find Cover command could disable Bounding Overwath (if it doesn't already), so AI subordinates think only of their own safety and not of formation?

And most importantly, wouldn't it be useful for the player to define the exact threat to hide from, rather than leaving it to the imperfect AI? How are your men supposed to know that you want them hidden from the Tunguska at 400m, not the T-72 at 300m?

Left to their own devices, AI often take cover in front of a wall rather than behind it. And they often don't take its height into account, going prone instead of kneeling to shoot back.

And if all else fails, perhaps tell to the AI to 'adhere' to objects regardless of whether it provides them with cover, so they will stay out of the street and gain on average a better chance of concealment and shot obstruction.

Edited by maturin

Share this post


Link to post
Share on other sites

This is something I also thought about. Using more precomputed/preplanned pathing in some places may improve the AI significantly. If we had the ability via script and/or world editor to define paths similar to those used for navigating buildings, it would also be useful for getting AI to travel where they never could before (ex: complex structures built up from multiple objects). Furthermore if they could be created and destroyed/modified in real time it would still allow for some degree of adaptation to changing environments (objects being destroyed).

From a mission editing standpoint, god knows how many times I've wished for a way to give AI low level waypoints like this. Even if it's just a simple set of linearly linked nodes that guide the AI's pathing.

This either means

1. all buildings (not only enterable ones) would needed to be remodelled to add these 'outside' path nodes

or

2. somebody models invisible addons which consist of only a pathlod with 2 nodes. a script would be needed to place those around buildings in a way these nodes lead around the any building on a map. and finally the AI needs to be redone in order to understand how to use those outside nodes.

Either way, very complicated imo.

Share this post


Link to post
Share on other sites

Im sure im not the only one, but i find AI utterly fascinating, and while they are great at the moment, i will always welcome improvements!

Share this post


Link to post
Share on other sites
)rStrangelove;1834290']2. somebody models invisible addons which consist of only a pathlod with 2 nodes. a script would be needed to place those around buildings in a way these nodes lead around the any building on a map. and finally the AI needs to be redone in order to understand how to use those outside nodes.

Not exactly what I was thinking. I'd prefer to see BI implement a new command that places linked nodes that behave like building paths (would require no/little modification to the AI itself). Even something simple like:

// [linked to node, position, is end point]
_n1 = createPathNode [objNull,(getMarkerPos "Node1"),true];
_n2 = createPathNode [_n1,(getMarkerPos "Node2"),false];
_n3 = createPathNode [_n1,(getMarkerPos "Node3"),true];
_n4 = createPathNode [_n2,(getMarkerPos "Node4"),true];

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites

I have thought, for a long time, that a new "layer" of objects that can be seen by the ai as cover points or nodes would be most beneficial. All building models could have "corner" and "wall" node types on the corners and the ai would have some "pre baked" automation to use those corners as cover in the proper way. All islands would have an entire layer of nodes and objects that the ai can check for and use appropriately based on area type and type of ambush.

I think the of the whole cover equation goes like this:

(this is the human player reaction that I want the ai to simulate so they also appear human)

1) unit realizes that it is under fire - 90% of the time its an ambush where a patrol is walking along and all of the sudden bullets start landing near the patrol.

2) unit determines direction of fire to the best of ability.

3) unit then scans the immediate area for anything solid that can be between itself and the angle of incoming fire

4) unit moves to the position behind that object in the quickest way possible.

THEN there is an entire new logic to work out for what to do next which is a whole other post worth of thoughts I wont go into here. But this above part covers at least the job of getting the ai's ass out of the killbox and behind a cover object.

I know this is common sense stuff but this logical layout is exactly the problem the ai needs to solve and do it fast with as little hesitation as possible. If you are ambushed would you stay in the initial spot and start prone and fire? I think most people would displace first and then decide a fire back tactic based on further parameters. If a tank jumps out in the ambush is there any point for a rifleman or medic to start strafing out from cover to fire back? I think its time for those units to retreat or call for anti tank support of some type. The game does not seem to handle this logic very well. All the time people complain about units trying to hold their ground at the wrong time.

If this cover class of objects was set up properly, the ai would be able to determine if they are in an intersection and be able to find appropriate cover quickly. There could be general guidelines that would work in most suppression scenarios such as "stay out of the road if you want to grow old" since theres really no good reason to prone in the middle of a street (EVER).

There could be different find cover routines based on area type.

Urban cover mode - use building corners and other facets to use as cover

Forest cover mode - use trees and rocks as cover

field cover mode - use rocks or topografic countours for cover

freestyle mode - find destroyed vehicles, spawned objects and even dead bodies for cover if out in the open flat? RUN AWAY + SERPENTINE!!! :D

Whats the point of checking for building cover if you are in the countryside? If the ai knows the type of area it is being assaulted in then it can only worry about appropriate calculations and exclude innapropriate ones. If things are made modular from the foundation then there should be less complexity to implement on the top levels of this system as the ai have the right guidelines for cover finding based on area. Keep things as simple as possible at the core so the complexity at the top level is minimized.

I have wanted a line of site check command for ages and I know other people want it to. I feel if I had the ability to check line of sight between two points and have it return an array of all intersecting objects (so I can check what they are and maybe decide to shoot anyway) I could make my own cover system with scripts. Would it not be nice if the community could make its own complex cover routines with the proper set of commands from BIS so BIS does not have to deal with so much complexity? This would add value to the game and also allow BIS team to focus on other aspects of AI like proper movement under fire. I would love it if CBA added a core AI functions module or something since CBA seems to be a universal addon. That way we wouldnt need to rely on huge AI mods for four different versions of force movement overide methods but would have one core AI movement methods and those AI mods would now focus on better things like tactics and stylistic tweaks. The ai mods have gotten a bit out of controll IMO with people merging Zues with GL4 with SLX and so on...

Another point is how this relates to ai movement. If Suma programs the ai to stick in place and fight on enemy contact and ignore everything else then what is the point of telling them to move anywhere?! The ai have to finally move when they are told to move by their squad leader or a script, period. Move NOW soldier! No combat mode, no fsm loops overidding everything including disableai commands JUST MOVE! Otherwise this debate is pointless.

Share this post


Link to post
Share on other sites

I first thought you meant something a lot simpler, which is to say a way for the squad leader to order your units to take cover by doing exactly what you suggested - telling them to go to the corner of a building or next to a low wall. Since each cover object clearly already has information attached to it that the AI uses to make decisions (is the cover occupied, does it actually provide cover etc), why not simply make that information visible/useable by the player squadleader - in the same way the "house position" information already is! Placing your soldiers in windows or on top of balconies is child's play - why not implement a similar system for ordering your units to take cover manually? They already do this by default, of course, but as Suma says, this is contingent on processing power. By letting the player do all the thinking, I'd say that should simplify things quite a bit, no?

...maybe make it so Command View slows the game down as well for real tactical positioning...

Regards,

Wolfrug

Share this post


Link to post
Share on other sites

Hmm. well IMO all buildings should have at least 8 navigation nodes, two per corner. Then perhaps a "snap-to" function that means units that get close will use that node in preference to their own AI generated one. You'd see AI using building walls, corners and streets as cover where available while moving.

Share this post


Link to post
Share on other sites

Buildings or structures in general could certainly need some more functional LODs or points in there, giving them "meaning", so AI could use them way better. For now there is the path-LOD with a node-network consisting of entry points and building positions. There are also some for doors/ladders/buttons/actions if you wanna count these too (so AI will open doors all by themself for example).

The question is what really could yield great improvements. And such "meaningful" points in the objects LOD are only half of the coin. Without algorithms using them in an effective way, they are of little use. And since object's LOD information goes hand in hand with such algorithms, this question becomes quite complex.

For example I could see use for points in such a LOD, defining different levels of shelter. Shelter vs. gunfire? Shelter vs. artillery? These could be queried by units (nearestObjects) to react to different levels of threats.

One could for sure come up with lots of such ideas, but they all have to work together. And it's all a question of design, best left to the developers I guess.

Edited by ruebe
some grammar :/

Share this post


Link to post
Share on other sites

Of course I would love it if the Dev's made this a high priority -that being both more and enhanced nodes as well as proper algorithms to utilize them. But even if just the nodes were implemented, AI modders could do so much more in terms of new coding behaviours.

I think back to the last time I tried the OA Campaign -the mission were your part (or lead?) a tank squadron and take fire from an occupied village. It was pretty disappointing to see the enemy AI At guys and various Infantry just running around in plain view getting shot to pieces. In the face of such a powerful attacking force (US), the enemy should have a collective threat awareness (whether Land/Air) and react in a more believable manner (take deep cover/use houses to be ratted out).

Share this post


Link to post
Share on other sites

Assigning (manually) more information to world objects about possible pathing/cover for AI would definately improve both immersion and mission posibilities, but it would also add a lot more work to all of the artists who have to create the objects and the environments.

But other decision making aside, far too often I still see limitations in the AI's pathfinding in terms of just moving (explicitly ordered to via script or command interface) to specific destinations or (not) using specific paths even at very short distances. Pathing LODs help a tremendous amount in terms of allowing AI to navigate buildings and such, but often these are ill constructed or lacking, and they still only work on isolated structures. Even just expanding the use of these would probably be significant.

Perhaps one of the best examples of these limitations are the terrace/foundation objects (as best as I can describe them; built up ground objects with level surfaces) used in many of the villages on Takistan. These are pretty much unnavigatable for AI; especially because of the often chaotic way in which they overlap with eachother and the fact that other objects (buildings) are placed on top of them. To go and manually manipulate the paths of each and every one of these villages would take forever, thus smarter pathing algorithms are needed.

Share this post


Link to post
Share on other sites
- it must not be occupied (two soldiers cannot use the same corner)

In actuality this would work and should be implemented in use of MOUT.

Theres various tactics that can be implemented in a squad environment:

1. Ai soldier could move to a corner, when he moves, another replaces his position and covers the guy that just moved.

2. Ai watch certain directions when the previous AI is watching another, as also seen in the vid

3. Ai should use a more a bound and overwatch type tactics, or shoot and move coordation manover, they somewhat do this already but I think it needs to be refind.

the types here would be forward movements when bounding and overwatch, and when retreating can be a peel manuover or a center peal. The Navy Seals use this alot but general infantry may use a bound and overwatch tactic but because of the size of a squad tactics mayube use differently for their size.

I think tactics should be based on size specifics, which spacing beteween soldiers is larger in a larger squad, smaller in a smaller squad.

4. AI when they cover and under immediate fire or thread shoot seek the nearest form of cover and disperse more rapidly, they somewhat do this already but again i think this can be refined to where they are not actually looking as if they are searching. The nearest form of cover is the shortest route and usually the safest.

5. CQB type tactics can be implemented as well, if in an urban situation AI can perform manovers like the one man standing and shooting while the 2nd man behind would crouch.

or AI squad enter an are urban and in a formation they would disperse, for example AI 1 would move left, AI 2 would go right, AI 3 would go left, AI 4 would go right, ect.,

As seen here:

6. I'd like to see AI use their pistol if and when they get in pistol range, that would be a cool, tactical, situation to see.

I think quite a few things can be implemented as they AI already cover at corners which is a good start, and very immersive to see,

makes you think your going againsted a player who has some tactical MOUT, or CQB knowhow.

Share this post


Link to post
Share on other sites

Assigning (manually) more information to world objects about possible pathing/cover for AI would definately improve both immersion and mission posibilities, but it would also add a lot more work to all of the artists who have to create the objects and the environments.

Its a worthy effort for them to undertake. These buildings and other objects only matter to the ai as cover and collision obstacles so this nodal idea seems to fit the job perfectly. The island terrain is more than just a pretty spectacle and obstacle course for the AI to get stuck in. It needs the abstraction/node layer to help the AI actually perform as real live players would. We cant give them "eyes" but we can give them a kind of cane to tap with and a really good map to help them feel their way around somehow and save their high end calculations for better things.

Once an Island is made its just a matter of time to survey all the areas and their attributes. I admit this would be a tedious job but each and every island out there could have it done and simply adds to the data as its new layer. I had an idea to survey all the good vantage points of an island and simply store them in an array (or an array of arrays). I could just spend an hour on any island in the editor mode. Survey the landscape and create logics at each relevant place. Then in the mission.sqm in notepad just copy out the position arrays of all the logics and paste them into another array. Then I have my crude layer of high points and the AI can search the array for the closest one of these locations pretty easily. This way I could make sure snipers have a dynamic way of finding the high ground anywhere on the island. This is a simple example but it could be expanded and changed for different things. Choppers could have an array of all suitable LZ areas so they are assisted in avoiding things like power lines or landing on to much gradient and then rolling away. Vehicles could have areas that tell them if they are on a bridge or not so they have help in actually crossing the bridge or their formation does not miss the bridge and drive under it into a river.

I admit this would be tedious to set up but its worth it since the data could be shared out to the community so they dont have to spend the same time doing the same thing. I think we are all expecting the dynamic AI routines to figure out too much "on the fly" without enough help such as this system would provide. I think we are onto something here as recognizing a need for more data layers (call them nodes or whatever) to help the ai use cover and find the best paths to take and alot of other mundane things. I like the ai to be dynamic and able to determine their paths on the fly but I like the idea of helping them along to increase their performance and also possibly take back some resources and optimize the game.

Someone could make a cover nodes addon that adds invisible objects the the game that matter only to the ai. Another person could actually add them to the islands and release them as a script that can run at mission start and add all the node objects at that time. Just brainstorming here....

In the meantime island makers could incorporate these nodes into their island building. Vehicles could have these node objects attached as well as they are usually great for cover. Of course building nodes are allready well covered in earlier posts.

Share this post


Link to post
Share on other sites
Assigning (manually) more information to world objects about possible pathing/cover for AI would definately improve both immersion and mission posibilities, but it would also add a lot more work to all of the artists who have to create the objects and the environments...

... especially because of the often chaotic way in which they overlap with eachother and the fact that other objects (buildings) are placed on top of them. To go and manually manipulate the paths of each and every one of these villages would take forever, thus smarter pathing algorithms are needed.

Hmm overlapping objects would be a problem if those 'outer cover-nodes' would be part of all buildings. AI wouldnt be able to use some nodes in those villages in Takistan, some would end up trying to get to a cover node inside of another object (as you said already).

IMO the model should only provide the coords for _potential_ nodes, but whether they can be used or not needs to be calculated ingame.

This could be precalculated as a datafile and shipped together with the island by the island maker or anybody else.

How many 'cover-providing-structures' are on a typical island? Multiply by at least 4 (i guess 4 nodes per structure would be minimum?) and you end up with a lot of data.

Also, the AI would need to be rescripted imo. There needs to be a combat mode outside of villages using the normal routines they do now and a new CQB mode when near a location ( village, wreckage field, airfield, whatever).

Share this post


Link to post
Share on other sites

It would be fairly easy to draw lines between nodes and then analyze whether the line has been interrupted by another object. It could be a compile process when the map is completed.

Share this post


Link to post
Share on other sites

Personally i dont like this talk about nodes. The way its currently done is (IMO) very impressive, however it has some flaws. The biggest being the AI not always being on the right side of cover, and no decent 'pop up->Shoot->go down->repeat' behaviour. However would nodes really change that? Wether you use nodes or not, choosing what side of cover is the best wouldnt really change, and nodes wouldnt change their behaviour once in cover at all. I dont really see how nodes would be an advantage for this.

Where it could help would be inside buildings, since the AI seems to mostly ignore pathway lods in combat mode. This behaviour makes sense since we dont want the AI to neatly follow roads when they are under fire, however it has a drawback: Pathways in buildings are almost completely ignored and buildings are mostly handled as impenetrable blocks. However we already have 'nodes' inside buildings, namely the buildingpos's, all neatly connected to pathway lods.

IMO the solution should be found here: Either building pathway lods should be handled like roads are in aware mode; used if its not too much of a hassle, or, buildingpos's should be taken into account when looking for cover. However determining which buildingpos would be the best is quite hard (Cant be sure if the/a target is visible from the buildingpos), and it would still require some pop up/down behaviour to make it more useful than running around outside.

I recently tried to do the buildingpos thing(Since the other thing cannot be modded), however i found the .fsm's to be.. Not very accessible, and i couldnt be bothered (yet) to just run it as another script on top of the default AI, since after messing with zombies in ArmA2 i found it too much of a hassle to reliably override the AI this way.

EDIT: 1 building pos. 2 buildingposses? Pos's? Pos'? I dont know.

Edited by NeMeSiS

Share this post


Link to post
Share on other sites
Pathways in buildings are almost completely ignored and buildings are mostly handled as impenetrable blocks.

Most of the time AI will take building pathways into account for any kind of pathfinding, but they don't actively seek cover inside of buildings. Since buildings already have paths that are usable by the AI it would be more cost effective (in terms of performance) to place preplanned cover destinations on buildings than to calculate it in realtime.

However, letting them seek cover in buildings is still useless when many times they cannot even reach certain buildings due to unnavigatable compositions of objects (either overlapping or unconnected). So again I think that cover-finding can't really get much better until fundemental pathfinding on non-terrain surfaces significantly improves.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×