Jump to content
Sign in to follow this  
tpw

TPWC AI suppression system

Recommended Posts

Thanks for the additional visual debug stuff Fabrizio. Unfortunately the changing of the coloured ball textures is very unreliable. Ollem and I originally tried this some time ago and that's the reason why I went for the 3 balls approach.

---------- Post added at 19:52 ---------- Previous post was at 19:07 ----------

On a related note, I've spent a bit of time trying to "modularise" the whole TPWCAS system. Each function is now compiled from its own script. It probably makes little difference in terms of performance but it makes it a hell of a lot easier to change a particular function or write a replacement.

2.06b scripts http://filesonly.com/download.php?file=832tpwcas206_scripts.zip

This is not an addon yet.

Share this post


Link to post
Share on other sites
Thanks for the additional visual debug stuff Fabrizio. Unfortunately the changing of the coloured ball textures is very unreliable. Ollem and I originally tried this some time ago and that's the reason why I went for the 3 balls approach.

Strange, it's working fine for me, but i tested only SP.

Edited by fabrizio_T

Share this post


Link to post
Share on other sites
Strange, it's working fine for me, but i tested only SP.

I tried it and the vast majority of the time suppressed units only showed green balls. Additionally, balls don't disappear from injured units, but that's just a matter of some additional code.

Share this post


Link to post
Share on other sites
I tried it and the vast majority of the time suppressed units only showed green balls. Additionally, balls don't disappear from injured units, but that's just a matter of some additional code.

Did you tried SP or MP? In SP i'm seeing the full range of colours up to black

Share this post


Link to post
Share on other sites

SP only. I'll have another try since you're so adamant!

EDIT: So what do you know?! It's working. Sorry about that Fabrizio!

Interesting how many units end up with black balls, and don't respond to further suppression....

FURTHER EDIT: Wow, just added _unit setfleeing 0 into the main loop, and that's the end of units standing up and firing at enemies when when they are suppressed.

Here's the code with additional code to remove balls from injured units.

// Some visual debug
tpwcas_fnc_debug_visual = 
{
   private ["_handle"];

   _handle = [] spawn 
   {
       private ["_ball", "_marker", "_level", "_x", "_nul", "_color"];

       while { true } do
       {
           {
               if( isNil { _x getVariable "tpwcas_debug_ball" } ) then
               {
                   _ball = "Sign_sphere25cm_EP1" createvehicle getposatl _x;  
                   _ball setObjectTexture [0,"#(argb,8,8,3)color(0.99,0.99,0.99,0.7,ca)"];  // white
                   _ball attachTo [_x,[0,0,2]];   
                   _ball hideobject true;  

                   if( (side _x) getFriend WEST < 0.6 ) then { _color = "ColorRed"; } else { _color = "ColorBlue"; };

                   _marker = createMarker[ format["tpwcas_markers_%1", _x], position _x];
                   _marker setMarkerShape "ICON";
                   _marker setMarkerType "mil_triangle";
                   _marker setMarkerColor _color;

                   _x setVariable ["tpwcas_debug_ball", _ball ];
                   _x setVariable ["tpwcas_debug_marker", _marker ];
               }
               else
               {
                   _ball = _x getVariable "tpwcas_debug_ball";
                   _marker = _x getVariable "tpwcas_debug_marker";
               };

               _marker setMarkerPos (position _x);

               if( fleeing _x) then 
               {
                   _marker setMarkerType "mil_dot";
               }
               else
               {
                   _marker setMarkerType "mil_triangle";
                   _marker setMarkerDir (getDir _x);
               };

               if( !( isNull _x ) && alive _x) then // better to double check for unit being alive ...
               {
                   _level = _x  getvariable ["tpwcas_supstate", 0];

                   switch ( true ) do
                   {
                       case ( fleeing _x ): {  
                           _ball hideobject false;  
                           _ball setObjectTexture [0,"#(argb,8,8,3)color(0.0,0.0,0.0,0.9,ca)"];  // black
                       };

                       case ( _level == 0 ): {  
                           _ball hideobject true;  
                       };

                       case ( _level == 1 ): {  
                           _ball hideobject false; 
                           _ball setObjectTexture [0,"#(argb,8,8,3)color(0.1,0.9,0.1,0.7,ca)"];  // green
                       };

                       case ( _level == 2): {  
                           _ball hideobject false; 
                           _ball setObjectTexture [0,"#(argb,8,8,3)color(0.9,0.9,0.1,0.7,ca)"]; //yellow
                       };

                       case ( _level == 3 ): {  
                           _ball hideobject false; 
                           _ball setObjectTexture [0,"#(argb,8,8,3)color(0.9,0.1,0.1,0.7,ca)"]; //red  
                       };
                   };
               };
		if (lifestate _x != "ALIVE") then
			{  
				_ball hideobject true;  
               };

           } foreach allUnits;

           {
               if( ! ( isNil { _x getVariable "tpwcas_debug_ball" } ) ) then
               {
                   deleteVehicle ( _x getVariable "tpwcas_debug_ball" );
                   deleteMarker( _x getVariable "tpwcas_debug_marker" );
               };

           } foreach allDead;

           sleep 1;
       };
   };

Edited by tpw

Share this post


Link to post
Share on other sites
SP only. I'll have another try since you're so adamant!

EDIT: So what do you know?! It's working. Sorry about that Fabrizio!

Interesting how many units end up with black balls, and don't respond to further suppression....

FURTHER EDIT: Wow, just added _unit setfleeing 0 into the main loop, and that's the end of units standing up when they are suppressed.

I saw something interesting while testing:

* Units use to flee more often than you may think;

* Sometimes the "flee" for just a few seconds and then come back to fight;

* Often, when fleeing, they do strange things. Most common: they just stand back and scan the horizon, no movement till a bullet end their agony. Sometimes they move around slowly. Other times they just move into small circles ( This looks a ArmA2 bug to me, i think they are trying to flee while keeping "in formation");

Yes, _unit setfleeing 0 makes unit refuse to flee.

The problem is that without being able to flee usually units tend to stay in place, waiting to be killed.

It would be useful to be able to command them into some cover, but i found no reliable way to make them doing so, while in combat.

See, for reference:

https://dev-heaven.net/issues/28311

https://dev-heaven.net/issues/28319

Edited by fabrizio_T

Share this post


Link to post
Share on other sites
I saw something interesting while testing:

* Units use to flee more often than you may think;

* Sometimes the "flee" for just a few seconds and then come back to fight;

* Often, when fleeing, they do strange things. Most common: they just stand back and scan the horizon, no movement till a bullet end their agony. Sometimes they move around slowly. Other times they just move into small circles ( This looks a ArmA2 bug to me, i think they are trying to flee while keeping "in formation");

Yes, _unit setfleeing 0 makes unit refuse to flee.

Well what I am seeing is that units with a black ball don't actually flee at all, they just stand up and keep shooting, impervious to further suppression. That might be an ASR AI thing though. With setfleeing 0 they always crouch or drop under suppression.

Share this post


Link to post
Share on other sites
Well what I am seeing is that units with a black ball don't actually flee at all, they just stand up and keep shooting, impervious to further suppression. That might be an ASR AI thing though. With setfleeing 0 they always crouch or drop under suppression.

Fleeing units always ignore stance (setUnitPos) and scripted fire / move orders.

They decide on their own what to do. Sometimes they take a few shots, other times they try to flee.

Sadly they haven't any clue on how to flee nor withdraw properly ...

Share this post


Link to post
Share on other sites

Yes.

I'm assuming that fleeing is tied in with a unit's courage? In which case dropping courage under suppression is actually having the opposite effect to intended, namely, units stop keeping their bloody heads down.

Well even putting _unit setfleeing = 0.5 in the main loop helps things enormously. Some units flee, but seriously, without it, nearly all units end up with a black ball and do nothing useful.

Share this post


Link to post
Share on other sites
Yes.

I'm assuming that fleeing is tied in with a unit's courage? In which case dropping courage under suppression is actually having the opposite effect to intended, namely, units stop keeping their bloody heads down.

Well even putting _unit setfleeing = 0.5 in the main loop helps things enormously. Some units flee, but seriously, without it, nearly all units end up with a black ball and do nothing useful.

Courage does matter, probably also general skill itself. There's also morale (http://community.bistudio.com/wiki/morale).

No idea on how morale is handled though, i saw pretty strange readings when trying to figure it out.

By the way, "morale" is not writeable.

Regarding fleeing units i usually try helping them running right away (which would be the only clever thing to do) with:

if (fleeing _unit) then
{
_unit forcespeed -1;
_unit disableAI "target";
_unit disableAI "autotarget";

if ( attackEnabled _unit ) then
{
	_unit enableattack false;
};
}
else
{
_unit enableAI "target";
_unit enableAI "autotarget";

if ( !( attackEnabled _unit) ) then
{
	_unit enableattack true;
};
}

It only works to some extent though.

Edited by fabrizio_T

Share this post


Link to post
Share on other sites

I find with COSLX (ai functions only) they run for cover very well, unfortunately ASR AI breaks that from what I've seen.

Share this post


Link to post
Share on other sites
I find with COSLX (ai functions only) they run for cover very well, unfortunately ASR AI breaks that from what I've seen.

Know those functions, i remember having checked them in SLX, quite some time ago.

Problem is they're not much reliable, due to some ArmA2 bugs.

See ticket link i posted before.

Share this post


Link to post
Share on other sites

Just tried disabling courage reduction under suppression, and that got rid of the black ball problem too. A few units still flee, when either the engine or ASR AI decides it's in their best interests...

EDIT: refined it further, just got courage to drop at 1/2 the rate of the other skills. Far fewer black ball morons.

Edited by tpw

Share this post


Link to post
Share on other sites

Thanks Ollem and Fabrizio. I have to say that I'm not really keen, as stated previously, in making this another all purpose AI behaviour mod. I really just want units to duck under fire and lose their general shooting competence.

I'm pretty sure that GL4, ASR, UPSMON, SLX and even the vanilla engine have their own routines for what behaviours to assign to AI under combat stress. If we keep trying to add our own, eventually it's going to be a mess of mod conflicts.

Well at least that's my take on this.

Share this post


Link to post
Share on other sites
With UPSMON and ASR_AI AI seems to take cover behind trees/bushes, have morale etc.

Not sure if either is triggered by ASR or UPSMON, but you may want to have a look at the scripts:

UPSMON: https://dev-heaven.net/projects/upsmon/wiki

Yes i know both UPS and UPSMON (great pieces of code for the strategical layer), not fiddled much with ASR, i bet it's good too, but on the tactical side.

However the problem with moving into cover is that any scripting commands to move units (included low level moveTo) are eventually overridden by core combat logics.

That means that move orders are fulfilled only if core engine lets them pass by.

Sadly there's plenty of circumstances in which engine overrides any move command.

* For example danger.fsm stops units as soon as engine think they can fire on a target (this is solveable by modding danger.fsm itself).

* When an unit acquires a "close" target / threat it refuses making more than just a few steps towards the commanded destination.

* When an unit thinks some cover is nearby (even a useless bush), it usually refuses moving any further, or moves back and forth.

* Formation checking routine adds other problems (formation was softened quite some time ago, but was then somewhat hardened again).

Without these problems coding movement into cover would be almost trivial.

Morale is coded into many mods, most times by simply overriding skill and courage.

That's already coded into TPWC.

Edited by fabrizio_T

Share this post


Link to post
Share on other sites

I cant get the 2.05b version to work with ASR??

I have testet it three times with and 3 times without ASR.

I played it with the newest, beta, tpw_AI_LOS, CBA, JSRS and twp_supp_2.05b

I get the hint, but the debug balls don't appear, and tha ai don't change stance when i shot at them.

Share this post


Link to post
Share on other sites
I cant get the 2.05b version to work with ASR??

I have testet it three times with and 3 times without ASR.

I played it with the newest, beta, tpw_AI_LOS, CBA, JSRS and twp_supp_2.05b

I get the hint, but the debug balls don't appear, and tha ai don't change stance when i shot at them.

I'm having the same problem - the hint pops up, but debug balls don't appear.

Share this post


Link to post
Share on other sites
I cant get the 2.05b version to work with ASR??

I have testet it three times with and 3 times without ASR.

I played it with the newest, beta, tpw_AI_LOS, CBA, JSRS and twp_supp_2.05b

I get the hint, but the debug balls don't appear, and tha ai don't change stance when i shot at them.

ASR 1.15.1 is not fully compatible. Only test releases after that are (you're welcome to try). Anyway I'll upload ASR 1.16 very soon.

Share this post


Link to post
Share on other sites
Yes i know both UPS and UPSMON (great pieces of code for the strategical layer), not fiddled much with ASR, i bet it's good too, but on the tactical side.

However the problem with moving into cover is that any scripting commands to move units (included low level moveTo) are eventually overridden by core combat logics.

That means that move orders are fulfilled only if core engine lets them pass by.

Sadly there's plenty of circumstances in which engine overrides any move command.

* For example danger.fsm stops units as soon as engine think they can fire on a target (this is solveable by modding danger.fsm itself).

* When an unit acquires a "close" target / threat it refuses making more than just a few steps towards the commanded destination.

* When an unit thinks some cover is nearby (even a useless bush), it usually refuses moving any further, or moves back and forth.

* Formation checking routine adds other problems (formation was softened quite some time ago, but was then somewhat hardened again).

Without these problems coding movement into cover would be almost trivial.

Morale is coded into many mods, most times by simply overriding skill and courage.

That's already coded into TPWC.

I totally agree with tpw on that one: too much features in this is gonna cause more conflicts is all, and i remember that mod being designed to be used with ASR_AI.

Regarding the cover problem, i guess the only solution would be native fsm coding. Problem seems to be that to find cover , the cover postion needs a precise combination of parameters (number of positions, sufficient cover, being able to stand up (!), knowing from what enemy you want to be protected...). Would probably be doable, but a really hard piece of wqork (i remember ZEUS AI did that to some extent). Plus it would probably be even more difficult if you want it to work with custom objects.

Those are just guesses though, as i don't really have much knowledge regarding fsm.

Share this post


Link to post
Share on other sites

I think I had a break through with tpw/Asr ai/part coslx ......ok so I made a mission with Pmc as the enemy blufor and then I played by myself as the other blufor on a night mission and the Pmc had a hard time finding me the whole time and they had some nvgs too. Still testing but this was the first time in my arma playing this ever happened I made the Pmc enemy by creating a Pmc group and then taking a Russian squad leader as the high rank but made his existence 0 then I grouped him with the Pmc and it worked. So I set them up all around the villa on zagarbad patrolling. I made about 15 patrolling and made a moonless night and used silenced m4a1 with acog and took them all out...then I tried it with laser and they saw it,and made me pay for it.

Share this post


Link to post
Share on other sites
Thanks Ollem and Fabrizio. I have to say that I'm not really keen, as stated previously, in making this another all purpose AI behaviour mod. I really just want units to duck under fire and lose their general shooting competence.

I'm pretty sure that GL4, ASR, UPSMON, SLX and even the vanilla engine have their own routines for what behaviours to assign to AI under combat stress. If we keep trying to add our own, eventually it's going to be a mess of mod conflicts.

Well at least that's my take on this.

Great!

Share this post


Link to post
Share on other sites
Thanks Ollem and Fabrizio. I have to say that I'm not really keen, as stated previously, in making this another all purpose AI behaviour mod. I really just want units to duck under fire and lose their general shooting competence.

I'm pretty sure that GL4, ASR, UPSMON, SLX and even the vanilla engine have their own routines for what behaviours to assign to AI under combat stress. If we keep trying to add our own, eventually it's going to be a mess of mod conflicts.

Well at least that's my take on this.

I do agree we should try to keep this as lean and mean as possible - however I thought you were looking for some routines to add.

If the AI drops and gets scared (== not very efficient in returning fire for a small period of time) that's already a major step forward.

Share this post


Link to post
Share on other sites
ASR 1.15.1 is not fully compatible. Only test releases after that are (you're welcome to try). Anyway I'll upload ASR 1.16 very soon.

Works very well indeed with v1.15.1_test5 in the tests I've run.

Share this post


Link to post
Share on other sites

Since we're talking about AI mods right now, I've got a question.

What general AI mod or mods works best with TPWC_AI?

I really want AI to stop staring directly towards an enemy without shooting and I'd very much like to make them take cover behind stuff.

Any suggestions?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×