Jump to content
nkenny

LAMBS Improved Danger.fsm

Recommended Posts

@froggyluv
In testing the feature worked on implementation, perhaps things have shifted as features have been added and the complexity of the battle space has increased. That said it makes for a good case study of how the next iteration of the mod handles this feature. 

In practice both versions utilize the same function that is called on reacting to enemy contact and certain panic states: lambs_danger_fnc_hideInside. This function creates makes an imperative to either hide inside nearby buildings or try to find cover in a direction away from the threat. Hiding inside buildings is given a priority movement order, while "hiding in bushes" is lower on the food chain-- which may be overruled by squad leader commands or certain waypoints. Only foot infantry are affected. 

In the currently released version this behavior is purely reactive, and purely individual.  Soldiers will enter a hiding state if greatly outnumbered or facing tanks and airplanes, without the weapons to deal with them. At the moment the function only registers the current threat-- which does not necessarily pick out the most dangerous one. Future versions may improve this. 

As for the next version:  There are three new additions: (1) The Coward state is checked in a more broad set of events (thus may trigger more reliably). (2) If triggered, it will feed a danger state to the groups decision matrix-- which will be evaluated by the squad leader on his next free cycle. This may in turn trigger a group wide hiding response. (3) Soldiers in a cowardly mode will also suffer added suppression levels, which in turn reduces accuracy and reaction times. Tank and tank like vehicles therefore have a suppressing effect on enemy infantry. 

-k 

  • Like 7

Share this post


Link to post
Share on other sites

@nkenny Awesome! Incidentally, will a soldier's quality (inexperienced/experienced/veteran/special forces) be considered when calculating the possibility and/or length of "discretion's the better part of valour" state?

Share this post


Link to post
Share on other sites

@domokun
Yes and no. I decided against heavily involving the various skill settings for a couple of reasons. (1) It makes the initial implementation and proofs of concept easier to achieve. (2) I find that the skill settings are erratically configured in Arma3. The four grades of soldier you've outlined would be superbly useful-- but these do not correspond with any consistently presented values.  (3) Finally, it is my experience from my work on AI accuracy (LINK) that communities configure their AI (both server and on a mission basis) in sometimes drastically different ways.  Add my own mixture to this would do anything but offer standardization. There is also another concern. 

 

On a more fundamental level the delays and chances I introduce to the danger.fsm are arbitrary. While products of many, many repeated test runs and internal game play concerns and finally with commentary and advice from real world experience, the numbers I add are inventions. Stacking arbitrary numbers on top of other arbitrary numbers may give the appearance of simulation-iz-teh-realz-2k, while in reality being grounded on nothing, and potentially clouding the actual gameplay effect. For these reasons I have avoided tying skill settings too closely to the danger.fsm.  That accounts for the No of the answer.  The Yes comes now. 

All of this said: The AI is very much affected by skill settings.  Vanilla AI accuracy, information gathering, speed of reaction and suppression resistance is greatly enhanced by skill (LINK). Many of these are tied directly to the danger.fsm by virtue of being vanilla expressions of AI behaviour. There are two particular settings, which are consistent,  which I have linked some of the fundamental new features to.  One of these is Suppression  (getSuppression, setSuppression).  The other is soldier Rank.  Soldier rank will directly tie into the distance which information is propagated and will conceivably be expanded to cover other aspects of supporting fire. 

A rather lengthy answer to a reasonable suggestion. hashtag philosopher. 

Kind regards, 

Ken 

  • Like 5

Share this post


Link to post
Share on other sites
On 9/24/2019 at 12:57 AM, nkenny said:

@beagle23
I will look into it at a later stage of development. I agree. It would be super useful.  For now, if your Zeus interface has some sort of execution line interface (most do!)-- then it is possible to run the scripts directly as demonstrated above. 🙂


Thank you! I'll try this out for now, I have console on my server as well.

I'm very interested in this initiative, I think the AI in Arma is disturbingly ineffective and it brings the whole PvE experience down time after time. Do you mind if I ask, what's some of your ideal goals for the AI with this initiative? How interested are you in feedback?

Share this post


Link to post
Share on other sites

@beagle23
Feedback is very welcome.  The stated design goal for the Danger.fsm mod is twofold: (1) Make buildings part of the AI's tactical landscape. (2) Add elements of feedback and which creates more clearly defined AI states. Principally, I want to explore options which will fit within the scope of FSM level modifications. Actual examples of this are things such as: Infantry clearing buildings and turreted, tracked, vehicles dismantling and reducing buildings garrisoned by enemies, and more clearly recognizable responses to enemy fire. 

 

As mentioned in the original post, the mod explicitly aims to settle tactical and not strategic concerns. It is no replacement for waypoints and clever mission design. 

  • Like 3

Share this post


Link to post
Share on other sites

@nkenny Great!

danger.fsm is definitely an improvement. I'm definitely curious how far you want to go with improving the AI's reaction to contact and being an active player. I think we're all familiar with the feel of fighting AI in Arma/OFP; they don't present a credible threat and they're very easy to exploit.

One of the most fundamental parts of this is their bad habits... things like not understanding what makes good cover or making the wrong tactical decisions are understandable and I wouldn't complain about as much, but one of the biggest problems with the AI compared to players or even other games is they just stop all the time. Arma AI hesitates and gets interrupted constantly. They don't like to shoot on the move much, and they'll often interrupt whatever they're doing to stand or take a knee in the open and start shooting as soon as they spot a target. On the attack, they'll often stall out as they go prone and fail to move forward much, and again, as soon as they spot an enemy they'll sit still and slowly potshot at them. All of this makes it trivially easy to exploit them as a player.

To both present a more credible threat and to better replicate player behaviour, it'd be great if the AI could stop doing these bad habits. When they react to contact, they should either sprint straight for cover or lay rapid fire at the enemy while moving to cover at a jog. When they get stuck into a fight, they should move more instead of hesitating and sitting still all the time. And when they do decide to move, they shouldn't stop in the middle of that movement because they spotted a target - that's how a lot of AI get themselves killed, hillariously easy as they try to cross an open area or street and stop in the middle of it with a 'kill me' sign.

And when they do fire, it would help if they did so more snappily - the 'pop pop pop' slow potshotting by the AI is rarely a concern compared to how much faster a player will fire at you. If they're going to snipe from cover, it'd be better for them if they'd pop out for a second, fire a few shots and then pop back into cover - again, the AI just loves to be slow and hesitant, sitting still and peeking out for an hour while slowly shooting, making them ludicrously easy targets.

Curious to know what your thoughts are on these behaviours and if they fall within your scope or not! These bad habits make Arma AI probably some of the worst I've seen in gaming - they're worse than even the worst human FPS players I've seen. They don't move, they hesitate, they don't get anything done and they're so easily outsmarted, and they don't understand the basic fundamental of all FPS games which is you often have to combine movement and shooting, not just use one or the other. If all their pauses and interrupts were removed or dialed down, I think it'd go a long way towards fixing that - it's not that the AI never does anything good, its just that the good is so often diluted by all the hesitating and bad they do in between.

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

LOL that was the better articulated version of what I call "the Chicken Dance". I usually use the term " lacking proper orientation" but the above is really what im saying by this, I just lack the finger fortitude to spell it out as such. Cant remember who, but one of the old AI modders from OFP came out against Arma 3's AI as worse as they 'try to do too much'. At the time i was shocked because i really liked the fact that the AI had improved in terms of using corners to lean, micropathfinding (much more accurate placement than OFP) and the more trivial ducking under fences (still cool, but we need more). But after time, I got what he was saying -this AI is constantly making unnecessary movements, turning away from imminent threats to do whos knows what, and Benny Hill level movement shenanigans. Its almost as if the AI are only partially sharing the same dimension as us, taking notice and reacting only to drift back into their Frodo world in which we just dont really seem to matter.

 

In short, I think its engine level as any feedback from official BI devs has always been more of a "we dont know what or why the hell they do that -wait for Arma 4.."

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

😂 Yeah, they definitely act like they're in their own little world. It'd be a shame if if truly is unfixable.

Share this post


Link to post
Share on other sites

So the next update is around 99% finished. The final percent being concerned with tweaking timing variables and settings to a vision of gameplay. Some technical issues combined with a lack of time meant that the larger scale testing I had meant to do will be delayed until the weekend. Full public release is approaching soon.tm 

@beagle23
@froggyluv 

Thank you for your analysis. Indeed, I quite agree with many of the considerations you put forth. I hope to enhance the existing features to create better flowing gameplay-- though my task is not to explicitly make the AI better. The goal is to make the AI more interesting and capable. Interesting in that the AI will communicate, through gestures and stance, more clearly what state the AI is in. More capable in that the AI will have an expanded tactical repertoire. The mod is therefore aimed more towards COOP communities  and single players than it is warfare players. (An AI suitable for strategic play like that would require different design I think!).  I intend to make a few videos where I showcase some of the new features and responses and put these in the perspective of the vanilla AI. 

Onwards to timings and micro-AI. Lets first point out that the AI is a complicated beast. Especially because the behaviour of the AI is spread across so many places. Some of which are not immediately accessible. Those that are accessible include: 
- Weapon configurations* 
- Danger.fsm 
- Formation.fsm  (which is actually a config file!) 

The timing perspective I have done some work with. When the AI enters close combat you will see much faster cycles with the new AI.  The vanilla AI will on a shooting event stop and remain static either until the target is dead or 4 to 8 seconds has passed.  This is one reason why the AI sometimes will stop in the middle of crossing the street. A behaviour which is also curtailed. in the new FSM-- not by design, but a happy incidence. The new FSM will trigger a significantly faster, updating targeting and movement every  1 to 4 seconds in CQB and at longer ranges the AI will only stop 1 out of 3 times. Creating a significantly more dynamic AI. 

In regards to micro-AI: that is exploiting micro-terrain and preconfigured cover positions.  This level of behaviour is actually managed in the formation.fsm.  The functions called are somewhat arcane (to say the least!), but I am exploring various enhancements.  Try my ORK AI to see an AI with the micro-AI removed. For now I am still exploring options. I would like to modify the formation.fsm, but I've run into some questions.  
  1) Currently the formation.fsm is actually a config file.  Is this done for performance reasons?   
  2) Whenever I make my own formation.fsm I loose the micro-terrain interaction. I think it is, sometimes quite good and I am not willing to sacrifice it.  If I can call the existing functions (or better yet, modify them!) I would like to explore various options here. 
  3) Pathfinding. I wonder if it is possible to make improvements or additions to pathfinding engines.  This would probably, definitely be beyond my coding skills, but would be a good start for higher order enhancements. 

  • Like 10

Share this post


Link to post
Share on other sites

mkenny. Looks very well done congrats! Just one question/ Is there anyway to turn it off for certain units. Example. I have a surrender script running, when I see the morale of certain groups break, and they go to surrender when  vastly outgunned and pretty much no hope. They start to drop their weapons, buttt lol they go into what looks like a healing animation state and then pick back up there weapons and go back to fighting. Yes Its your mod. 😉 With AISS and FOA I put in a setvariable so that mission makers can turn off the AI scripts when needed. I was wondering if you have added something like this into LAMBS Improved Danger.fsm? Other than that. The AI look and respond very well. 🙂

Share this post


Link to post
Share on other sites

@mikey74

That's not good! The panic script is updated in the next version. Are you using ACE variables by any chance? 

 

My goal is full support with only _optional_ variables to extend functionality. 

 

-k

  • Like 2

Share this post


Link to post
Share on other sites

@Mohsin666
Yes, that is my understanding. These other mods work on a different tactical scales. 🙂


edit: 

Here is a video showing off some of the core behaviours of the FSM.  My voice sometimes drowns out a bit, but it is factual and and shows the decision making progress
 

 

  • Like 1

Share this post


Link to post
Share on other sites

Barring any critical bugs Version 1.4 is ready and set to be released on Sunday. Prefacing the release I thought I would write a couple of paragraphs detailing the application and thinking behind the implementation. 


Introducing Group variables
Version 1.4 begins with a full rewrite of the FSM and a streamlining of the unit variables.  This is done to facilitate a group intelligence. The group leader will periodically assess known threats and may implement group responses. The first group response is Reacting to contact.  The initial shock of combat makes the unit drop down and seek cover (indoor if possible).  When the group leader has a free moment-- he will rally troops and  communicate the groups situation to allied elements. From this point on the group leader will periodically, around every 60 seconds,  assess the situation and seek to match capability to enemies. Killing or suppressing group leaders greatly diminishes the ability of the group to properly rally and respond. 

 

The groups behaviour and memory nexus is handled in the local group variable DangerMode. It consists of a series of arrays which contain information about the groups current threats and situation. Specifically the break down is: 

  0, Threat type, a list of numbers which indicate priority and triggered events. [ARRAY]
  1, location of threat, a list of objects or positions which have triggered tactical events. [ARRAY]
  2, Reaction status, a true-false value which indicates if the group has seen combat. [BOOL]
  3, Time out,  a time out for when reaction status needs to reset (6 minutes without combat) and the cycle of leadership assessments. [NUMBER]

 

Two additional group variables are checked. DangerFormation and DangerCodeThese are by default blank, but can be used by mission makers to create pseudo-eventhandlers which are triggered when a group leader calls the first Reaction to contact. CBA and ACE3 developers take note! The FSM is an excellent place to add triggers for more information like this. The dangerFormation is an easy way to trigger formation change on first contact. Perhaps changing to a LINE formation to better face the enemy, or a DIAMOND, to trigger more aggressive CQB checking of every building.  Unsurprisingly, dangerCode, runs code on the first contact.  This can be used in any myriad of scripted situations, limited only by the mission makers creativity. 

 

Full example wrapped within Spoiler tag. 

 

Spoiler

 


/*
    dangerFormation [STRING]
	  Used to change formation on first reaction to contact. 
*/

// Changing to LINE formation on first contact
group this setVariable ["dangerFormation","LINE"];   

/*
    dangerCode [CODE]
      Used to run code as first reaction to contact
    
      Arguments
      0, group leader [OBJECT]
      1, group members [ARRAY]
*/

// creating a flare on first reaction to contact
group this setVariable ["dangerCode",{
  params ["_unit","_units"]; 
  _flare = createVehicle ["F_20mm_Red", _unit modelToWorld [0,0,200], [], 25, "NONE"];
  _flare setVelocity [0,0,-0.1];
}]; 

// running some function on contact
_code = {(_this select 0) call nk_fnc_fancyScriptHere};
group this setVariable ["dangerCode",_code]; 

 

 

 

 

 

Group actions

As noted above, group leaders can call  tactical responses to certain events. I will give a brief description of these here. There are currently FIVE types added, these are listed in priority (smaller number adds greater priority).  These are all maintained as functions to make them easy to work with and modify. 

 

Reaction to contact, priority 1

Triggered by first contact. 

Response is : Rallies troops and communicates threat to nearby teams 

 

Hide, priority 2

 Triggered by, facing air or tracked threats. 

  Response is:  Troops without effective weapons seek cover inside buildings 

 

Manoeuvre, priority 3

  Triggered by, enemy infantry is in a position below own position. 

  Response is:  Half the group suppress target location while the rest rush quickly towards an overwatch position. (BIS_fnc_findOverwatch)

 

Check houses, priority 5

  Triggered by, enemy infantry is hiding in nearby buildings.  

  Response is: unit will search through nearby buildings

 

Call Artillery, priority 6

  Triggered by, artillery available and enemy is beyond 300 meters. 

  Response is: call artillery. Artillery module has been rewritten since last video and really deserves its own post. 

 

Future: 

Clever readers may have noticed the gap between 3 and 5.  This is because this system is meant to be easy to expand and modify. It strikes me that at the time of writing it is not possible to disable group actions, I may add a variable to that effect in version 1.41.  This is also where responses for factions and units which have particular needs. These will be optional enhancements configured by the mission maker. Examples that I might add in the future: 

- Untrained militia 

AI will disregard cover and concealment to simply rush the enemy position. 

 

- Reconnaissance troops 

AI will avoid being engaged at all costs. Preferring to withdraw and hide. 

 

- Insurgents

AI will  hide weapons, vests and backpacks in nearby buildings and pose as civilians when enemy forces come too close. 

 

 

FSM design

Spoiler


fn1WYSM.png

 

Shown is the infantry side of the danger fsm.  Follow the link for additional overview shots: 

Overview of FSM design <-- LINK

 

 

Wrapped in spoiler tag to save space. 

 

 

I will end this post with a video of tracked vehicle behaviour in version 1.4.  Thank you for reading. 

 

Ken 

 

 

--- 

~ Danger.fsm Tracked vehicle behaviour

  • Like 9

Share this post


Link to post
Share on other sites

Sounds excellent. Will there be a way to get around the unit leader death delaying their reactions? Such as speeding up how quickly a new leader is chosen and takes command, or allowing individuals to act on more initiative in the absence of leadership? I think the 'kill the leader to disorient them' idea is interesting in theory but in practice I expect it to not be super transparent to the player; most of the time, they won't realise they're specifically killing the leader when it happens, and either way the result will be the AI performing worse, so I think I'd prefer to run with that being less of a thing.

Share this post


Link to post
Share on other sites

@beagle23
Good question. In truth, I am just relying on vanilla group interaction.  In vanilla,  killing leaders  creates delays in calling of attack commands and so on. If a group leader dies next to a subordinate-- transfer of leadership is nearly instantaneous. There is no artificial inflation of command change, only the Group Actions outlined in my previous post are affected by suppression. Core features of the danger.fsm remain effective as these are individual in nature. 

In short: I wouldn't worry unless it proves a problem in larger scale testing. Good theory-crafting however! 

-k 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@nkenny

This is very impressive, especially suppressing fire carried by the vehicle, this is something new in the Arma they usually only shot if you were in their sight. Thank you, great work!

Share this post


Link to post
Share on other sites

Did that Update go thru - says it was updated on Steam last nite but noticed a comment sayin nothing had changed. Also had heard time hearing you in some of those videos but other than that - cant wait to try

Share this post


Link to post
Share on other sites

* A special Close Quarter Battle mode when DELTA or FILE formation are used (formation can be configured) 

 

 

Just to make sure that I understand this correctly. If my friendly team AI is in Danger mode + Diamond or File formation than special CQB close quarter actions wwill be executed? 

 

Share this post


Link to post
Share on other sites

@froggyluv

It did. That comment is aimed some other unknown issue.

 

@rainbow47

That is correct. Though it just struck me that this will not be the case for player led groups.  That would need some additional interface. Hmm

 

edit: Testing has shown that player led groups set to FILE or DIAMOND (Sometimes called DELTA) trigger the advanced CQC mode. If they are slow to initiate it, it can help to order one or more units to move (somewhere, anywhere). One limitation is that the units will take charge of their own destinies and continuously clear buildings around the player until satisfied. I may look into adding additional interface in the future, though this is strictly speaking outside the scope of the mod. 

Share this post


Link to post
Share on other sites

LAMBS Danger.fsm 

New release: Current version 1.4

 

As advertised the latest version was released on Steam Workshop early this morning. I  delayed updating this thread in case any urgent hotfixes proved necessary.  The big change in the new version is a fully rewritten FSM and a group leader--group action  functionality.  The changes have been described in a post earlier in the thread. 

 

Changelog 

- Rewritten FSM 
- Added group Actions: Rally, Hide, Manoeuvre, check buildings. 
- Added 'dangerMode', 'dangerFormation', and 'dangerCode' group variables
- Added utilising available static weapons 
- Added vehicle danger avoidance routines
- Added 'first shot' Reaction state for infantry 
- Added tactical dismounts and investigation state for vehicles 
- Added more state visualisation through gestures
- Improved infantry panic state -- cleaner implementation 
- Improved vehicle rotation routines 
- Improved CQC combat mode in DELTA and FILE formations 
- Improved Vehicle and infantry suppression 
- Improved dynamic artillery module 
- Improved debug feedback 
- Improved ACE3 support 
- Minor fixes to danger Waypoints
- Minor improvements to civilian danger.fsm 
- Minor performance enhancements to core scripts

 

Special thanks

This version would not have been possible without discussions, bug and feature testing, suggestions and technical expertise. I would like to extend particular thanks to: 

Nopryl of Norway, for testing and feedback

- Alex2k, for having a devious mind in regards to AI scenario design
- Diwako, for beating my head with CBA and good advice

- AnAngrySalad of UKSF, for consultation on realism and practical implementation* 

- The kind words and suggestions from commentators at Steam Workshop and YouTube. 
 

Next releases

There is a small list of tweaks and performance enhancements for a version 1.41. I will very happily take suggestions or bug reports.  After the release of 1.41  the mod will move in a direction to support extended CBA functionality.  I have been fortunate in being approached by some very experienced developers that have provided very succinct suggestions and feedback. Some of these changes will make their way into 1.41  🙂

 

Thank you for reading, 

Ken 

 

LINKS

Steam Workshop

GitHub

 

 

-- 

*Every time you are hit by dynamic artillery you should curse his name. 

  • Like 4
  • Thanks 3

Share this post


Link to post
Share on other sites

@nkenny No ACE. Just your mod, a few islands, unit mods like CUP, JSRS, CBA, and my surrender script. 🙂 Thanks for the reply.

Share this post


Link to post
Share on other sites

@Jason Dotson
I have not tested it, but from my research there should be no conflict. Group Link X (and like) operate on a higher level-- whereas the danger.fsm is reactionary.  Easiest way to test is simply to load both and enable one of the debug variables (lambs_danger_debug_FSM = true).  If you see debug information  while a unit is in combat-- it is working. 


The reason why I haven't tested GLX fully, is (1) I've been busy. (2) couldn't get the damned  dastardly RAR file to open. haha. 
 

@mikey74

I aim to be fully compatible with anything vanilla does and scripted extensions/mods, within reason.  Anything particular this surrender script does?  Enable or disable any AI features or play certain animations? 

Incidentally, I have looked at the videos of your AISS/FOA and SAMO mods. Very impressive stuff!

- k

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

×