Jump to content
Sign in to follow this  
plugger

Smart AI

Recommended Posts

Goodaye,

note: I'm new to ARMA although a modding veteran elsewhere so please excuse my ignorance. And yes, I have already searched the forums for answers to the below questions to no avail.

1.The basic query I have is how to get one AI squad/unit to pass on spotting info to other AI units. Eg. There is a player controlled team infiltrating an area which contains three enemy AI groups. One enemy AI group spots the player team and I'd like it to pass the location information onto the other AI groups so they can react intelligently.

I realise that this is basic stuff but I'm buggered if I can figure out how to do it.

2.To refine the situation further there are a couple of AI sniper teams in elevated areas. I'd like them to be able to change the direction they are watching towards the general direction of the player team that has been spotted (but is currently unseen by the snipers) using the passed on location info. How to do this?

3.I'm assuming that everybody runs around with a radio enabling communications between teams/groups/units. Is this correct or do only leaders have radios and hence group that lost it's leader would loose it's ability to communicate?

4.Finally I'd like the AI to execute flanking  manouevres. Say one AI group spots the player team 'there'. The other two AI groups (without visual contact) move to positions that aren't the automatic 'directly towards the player team's last known position', eg. they move to a flank or a blocking position after making an intelligent guess as to the direction the player group is heading.

I'm thinking along the lines of two successive position reports of a player team by the AI group in visual contact enabling a rough sort of script-driven geometrical logic to be enabled. If anyone has any thoughts on this I'd be very interested.

Any assistance would be appreciated.

Cheers,

Plugger

Share this post


Link to post
Share on other sites

I'm a rookie here, but I assure you most, if not all of those things can be implemented with no major hassle if your a modding/coding veteran.

However I don't know how it is actually done I'm guessing some "BluFor Detected" trigger and then the use of some getpos(player) code snippet and some waypoints for the flanking squad etc.

The "Sniperteam watch player" should be really easy. When the "BluFor Detected" trigger is activated, it must be possible to make the sniper team watch getpos(player) or something.

Someone skilled in here can certainly help your out with the specifics.

Share this post


Link to post
Share on other sites

hiho smile_o.gif

well the detected by triggers coupled with synced waypoints can archive (at least gamewise) was you are looking for... just set different triggers for different approachroutes, and use switch smile_o.gif

about that info sharing between units... on the one hand you could try to script it... which might be a tad complicated if you are just beginning (or alternatively wait for grouplink, infoshare scripts, which were available for good old opf)...

keywords would be (best too look on em up on the community wiki, or the opf editing center): REVEAL, KNOWSABOUT and well some ARRAY handling could be handy too wink_o.gif

on a more practical note...

units using the GUARD waypoint already share info about enemies troops spotted, and try (at least to some extent) to push adequate troops against enemy targets...

additionally you could use GUARDED BY triggers... put some on the flanks of your approach route and you might be surprised where some of those enemy troops might show up...

basically i would advocate a mixed use of guard waypoints and synced stuff coupled with detected by... might be the easiest route ...

hope that helps...

Share this post


Link to post
Share on other sites

1 - The most basic way the script would work is to check if one team group knowsAbout any enemy/unknown units. If they do, use the reveal command to pass knowledge to the other groups. You may wish to check additional conditions such as distance between groups passing info, or add delays to simulate communication delay.

There was a very popular and successful script engine for OFP called groupLink (versions 1,2,3?). Either have a look at how it works or wait for some nice person to release an ArmA version.

2 - Use doWatch to get them to look towards a suspected enemy position based on the knowledge groups have above. Update it every now and then. Or use reveal as mentioned above.

3 - A group uses a single knowledge base. If one unit of a group sees you, that entire group know where you are no matter where they are. Unit types or leaders do not matter, only distances (AI does not consider anything beyond viewDistance range). AFAIK, groups do not share any information between each other. I seem to remember reading this was to be improved as it was a major weakness in the default AI.

4 - AI will flank player in the demo co-op mission. Not sure how adaptable or capable their behaviour is. You could try to calculate the players group facing and direction of travel to use trig to create a path to a position behind the player's group. You may need to disable or control aspects of the AI behaviour to force them to flank rather than engage. In concept it will be easy enough, creating an adaptable and efficient script is not. It would be best to first investigate default AI behaviour.

Share this post


Link to post
Share on other sites

Goodaye,

Yep, that's what I'm after. Many thanks, particulary fasad with the direct links to the relevant wiki entries.

Cheers,

Plugger

Share this post


Link to post
Share on other sites

I tested it myself : the "best" way to have snipers aware of ennemy position is as follows :

put a trigger that encompass the combat area, let's say the group to be detected is BLUEFOR and the guards are OPFOR

Put your trigger as : BLUEFOR, detected by East, repeatedly

on activation field, let's say your snipers are grouped in a array named sniperList, put :<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x reveal (thislist select 0)} forEach sniperList

What it will do is that the first unit detected in the group of detected BLUEFOR is kind of "passed" to all snipers. "kind of", because what reveal does is force the knowsAbout factor of the snier about BLUEFOR unit to 1. As described in Wiki, KnowsAbout shows how much a unit knows about another. It scales from 0 to 4. Passed a certain level (was around 0.1 in OFP), the unit can fire on the other one. If you have no LoS on target, your knowsAbout will slowly decrease to zero. It'll raise up to 4 if you have LoS, or even other knowledge mean, like hearing the unit.

With what I've described above, you simulate radio-com between the spotter and snipers : as long as spotter as unit detected, it gives info to snipers. If snipers have LoS, their knowsAbout will raise, and they can shoot immediatly. If they don't, and spotter loses sight, sniper knowsAbout is not updated anymore artificially and slowly decrease to zero (no one is giving anymore information about unit position to snipers).

Tested, it works fine with snipers on "HOLD" WP. But I guess it could very well work with other unit types and other WP types, leading to several different reaction scheme. Try it with groups on guard or sentry WPs, for example.

Share this post


Link to post
Share on other sites

Bremmer made an Imrpoved AI script a while ago for OFP. The script was amazing in what it allowed the AI to do. When the AI ran into an enemy unit, it could pop smoke or fire up a flare, then go into advanced tactics/formations and do things like flank. If the AI was outnumbered, it would call reinforcements from specified units in the area, if it hit armor, then it would call for specified air support and so on.

I've been trying to get someone to convert the script or make a new one, but no-one seems to want to do it.

http://www.flashpoint1985.com/cgi-bin....t=59001

Share this post


Link to post
Share on other sites

Well just two words: Group Link inlove.gifinlove.gifinlove.gif

Im really really waiting for this!! inlove.gif

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  

×