Jump to content
Sign in to follow this  
tpw

TPWC AI suppression system

Recommended Posts

tpw and crew,

Great job, enjoyed this a lot when I replayed "Delaying the bear" from the A2 campaign last night. Cooper was suppressing the enemy with my AK w/45 rnd. RPK mags while sending another Razor guy to do first-aid :)

Only one thing bothered me: the machinegunners and snipers seem to be forced too often to get up to crouch or standing to shoot, overriding ASR_AI which makes them go prone while not on the move and in the open. Had a closer look and I think it's caused by this bit of code:

			//IF UNIT STANCE IS UNSUPPRESSED   
		if ( time >= _stanceregain) then        
			{ 
			_unit setunitpos "auto";                     

I'm not sure what's the best way to fix this, don't think I can do anything to prevent it on my end, maybe set up some helper variables if you will add the extra check.

Some notes about my setup: ACE2, ASR_AI (ongoing dev version), TPWC_AIS 3.0 beta. Userconfig:

tpwcas_minskill = 0.1;

tpwcas_reveal = 0; // current ASR_AI already handles this, revealing shooters dynamically based on weapon's sound, ammo and distance from shooter to units hearing it

Edited by Robalo

Share this post


Link to post
Share on other sites
Userconfig:

tpwcas_minskill = 0.1;

tpwcas_reveal = 0;

Thanks for the feedback about the userconfig

Share this post


Link to post
Share on other sites

@tpw:I believe tpwcas-fnc-debug should now also only run for 'if local _x' in Allunits due to changrd MP code. Can't verify now. (And can't pm) but I'm quite sure debug balls will now be created by each player which isn't needed and may even create bad side effects. Right Fabrizio? (Tpwcas_fnc_kient_debug is okay as is).

In tpwcas.sqf CBA_fnc_addEventHandler is only needed on client, so could be ( tpwcas_multiplayer && !(IsDedicated)). Color is a local feature and server has no diplay so no need to chnage it there too...

Share this post


Link to post
Share on other sites
tpw and crew,

Great job, enjoyed this a lot when I replayed "Delaying the bear" from the A2 campaign last night. Cooper was suppressing the enemy with my AK w/45 rnd. RPK mags while sending another Razor guy to do first-aid :)

Only one thing bothered me: the machinegunners and snipers seem to be forced too often to get up to crouch or standing to shoot, overriding ASR_AI which makes them go prone while not on the move and in the open. Had a closer look and I think it's caused by this bit of code:

			//IF UNIT STANCE IS UNSUPPRESSED   
		if ( time >= _stanceregain) then        
			{ 
			_unit setunitpos "auto";                     

I'm not sure what's the best way to fix this, don't think I can do anything to prevent it on my end, maybe set up some helper variables if you will add the extra check.

Some notes about my setup: ACE2, ASR_AI (ongoing dev version), TPWC_AIS 3.0 beta. Userconfig:

tpwcas_minskill = 0.1;

tpwcas_reveal = 0; // current ASR_AI already handles this, revealing shooters dynamically based on weapon's sound, ammo and distance from shooter to units hearing it

Thanks very much for that Robalo. We already have a check to prevent prone units from kneeling under suppression, but if we stopped suppressed units from getting up again once unsuppressed, then we'd end up with everyone prone all the time. The best way I can think of is for you to set a variable on a unit when ASR AI changes their stance. Something like:

//IF UNIT STANCE IS UNSUPPRESSED   
if ( time >= _stanceregain) then        
{
if (asr_stance != "down" && asr_stance != "middle") then
 {
 _unit setunitpos "auto";

I once tried using setunitposweak, but it made units do nothing most of the time.

Also, good to know about ASR reveal. I will force tpwcas_reveal = 0 when ASR is running.

Share this post


Link to post
Share on other sites
Thanks very much for that Robalo. We already have a check to prevent prone units from kneeling under suppression, but if we stopped suppressed units from getting up again once unsuppressed, then we'd end up with everyone prone all the time. The best way I can think of is for you to set a variable on a unit when ASR AI changes their stance. Something like:

//IF UNIT STANCE IS UNSUPPRESSED   
if ( time >= _stanceregain) then        
{
if (asr_stance != "down" && asr_stance != "middle") then
 {
 _unit setunitpos "auto";

I once tried using setunitposweak, but it made units do nothing most of the time.

Also, good to know about ASR reveal. I will force tpwcas_reveal = 0 when ASR is running.

Thanks TPW, actually I already have a global variable you could use and is probably best because it takes user(config) choice into account as well:

asr_ai_sys_aiskill_stayLow which will is set to 1 meaning ASR AI will handle stance (while still allowing TPW to set stance for suppressed units).

So I think you could safely say something like:

// this in the init
if (isNil "asr_ai_sys_aiskill_stayLow") then {asr_ai_sys_aiskill_stayLow = 0};

// and this in main loop
if (asr_ai_sys_aiskill_stayLow != 1) then {_unit setunitpos "auto"};

Share this post


Link to post
Share on other sites
Thanks TPW, actually I already have a global variable you could use and is probably best because it takes user(config) choice into account as well:

asr_ai_sys_aiskill_stayLow which will is set to 1 meaning ASR AI will handle stance (while still allowing TPW to set stance for suppressed units).

So I think you could safely say something like:

// this in the init
if (isNil "asr_ai_sys_aiskill_stayLow") then {asr_ai_sys_aiskill_stayLow = 0};

// and this in main loop
if (asr_ai_sys_aiskill_stayLow != 1) then {_unit setunitpos "auto"};

Hmm, I'm not sure a global variable would necessarily do the trick. Imagine this scenario where I check for (asr_ai_sys_aiskill_stayLow != 1) and disable _unit setunitpos "auto"

1 - Unit is suppressed -> tpwcas uses setunitpos "down" and unit goes prone

2 - 10 seconds later unit is unsuppressed, and asr_ai attempts (and fails) to readjust unit stance with setunitposweak -> unit stays prone indefinitely

The problem is not setting stance for suppressed units, it's setting stance for unsuppressed units.

We ideally need a per unit variable as I suggested above, but I understand that it might entail a lot of work

Share this post


Link to post
Share on other sites

Hi Robalo

I thought about it a bit more and have come up with a sort of solution that requires no more work for you:

1 - Each unit is initially assigned a stance variable: _unit setvariable ["tpwcas_stance", "auto"];

2 - If a unit is suppressed then the variable is changed along with the stance eg _unit setvariable ["tpwcas_stance", "down"];

3 - When a unit is unsuppressed, then the unit is only returned to "auto" stance if tpwcas_stance is "middle" or "down"

//IF UNIT STANCE IS UNSUPPRESSED   
		if ( time >= _stanceregain) then        
			{ 

			_unit setvariable ["tpwcas_supstate",0];  
			_unit setvariable ["tpwcas_bulletcount",0];     
			_unit setvariable ["tpwcas_enemybulletcount",0]; 
			_unit setvariable ["tpwcas_stanceregain", time + 10]; 
			if (_unit getvariable "tpwcas_stance" in ["middle","down"]) then 
				{
				_unit setunitpos "auto"; 
				_unit setvariable ["tpwcas_stance", "auto"];
				};
			};

So this means that units will only go to "auto" stance if they were previously put into crouch or prone by tpwcas. If they are unsuppressed but crouched or prone due to ASR, then their stance will stay that way.

I hope this is what you were after

Edited by tpw

Share this post


Link to post
Share on other sites
Hmm, I'm not sure a global variable would necessarily do the trick. Imagine this scenario where I check for (asr_ai_sys_aiskill_stayLow != 1) and disable _unit setunitpos "auto"

1 - Unit is suppressed -> tpwcas uses setunitpos "down" and unit goes prone

2 - 10 seconds later unit is unsuppressed, and asr_ai attempts (and fails) to readjust unit stance with setunitposweak -> unit stays prone indefinitely

Ah you are right of course, because I'm using setunitposweak the unit remains down.

---------- Post added at 11:32 ---------- Previous post was at 11:27 ----------

Hi Robalo

I thought about it a bit more and have come up with a sort of solution that requires no more work for you:

1 - Each unit is initially assigned a stance variable: _unit setvariable ["tpwcas_stance", "auto"];

2 - If a unit is suppressed then the variable is changed along with the stance eg _unit setvariable ["tpwcas_stance", "down"];

3 - When a unit is unsuppressed, then the unit is only returned to "auto" stance if tpwcas_stance is "middle" or "down"

So this means that units will only go to "auto" stance if they were previously put into crouch or prone by tpwcas. If they are unsuppressed but crouched or prone due to ASR, then their stance will stay that way.

I hope this is what you were after

Hey TPW,

This sounds good, I think. I will try to test it and let you know.

Thanks!

EDIT: tried it, and it did not fix the issue, but I think the problem is somewhere else. As soon as the balls turn from red to yellow the AI gets up from prone to crouch all at once like in a synchronized dance. So it's not just about unsuppressed units, not sure what each color means but I guess they're in the lightly suppressed mode. Actually I think it's the ACE special bipod animation for AI which has an ace_ prefix and breaks the CBA_fnc_getUnitAnim function which is checking chars 5-8 for stance. Yeah the animation is ACE_AmovPpneMstpSrasWrflDnon_Supported.

Quick patch:

if ((_unit call CBA_fnc_getunitanim) select 0 != "prone" && animationState _unit != "ACE_AmovPpneMstpSrasWrflDnon_Supported") then

Edited by Robalo

Share this post


Link to post
Share on other sites
Ah you are right of course, because I'm using setunitposweak the unit remains down.

---------- Post added at 11:32 ---------- Previous post was at 11:27 ----------

Hey TPW,

This sounds good, I think. I will try to test it and let you know.

Thanks!

EDIT: tried it, and it did not fix the issue, but I think the problem is somewhere else. As soon as the balls turn from red to yellow the AI gets up from prone to crouch all at once like in a synchronized dance. So it's not just about unsuppressed units, not sure what each color means but I guess they're in the lightly suppressed mode. Actually I think it's the ACE special bipod animation for AI which has an ace_ prefix and breaks the CBA_fnc_getUnitAnim function which is checking chars 5-8 for stance. Yeah the animation is ACE_AmovPpneMstpSrasWrflDnon_Supported.

Quick patch:

if ((_unit call CBA_fnc_getunitanim) select 0 != "prone" && animationState _unit != "ACE_AmovPpneMstpSrasWrflDnon_Supported") then

Love ya work, quick patch is in! I'll leave the other stuff in since it actually applies to any other stance modifying mods, not just ASR_AI.

EDIT:

I have also fixed a slight bug in the visual debugging code, so map markers should now be blue and red again.

---------- Post added at 19:48 ---------- Previous post was at 19:26 ----------

@tpw:I believe tpwcas-fnc-debug should now also only run for 'if local _x' in Allunits due to changrd MP code. Can't verify now. (And can't pm) but I'm quite sure debug balls will now be created by each player which isn't needed and may even create bad side effects. Right Fabrizio? (Tpwcas_fnc_kient_debug is okay as is).

In tpwcas.sqf CBA_fnc_addEventHandler is only needed on client, so could be ( tpwcas_multiplayer && !(IsDedicated)). Color is a local feature and server has no diplay so no need to chnage it there too...

Roger that Ollem. I've added the requisite code and it hasn't affected SP (as expected). Can't check MP and dedi.

Edited by tpw

Share this post


Link to post
Share on other sites

How long are the AI suppressed? Is there a parameter in the userconfig? Because last night I gave it a quick spin Zipper5's Blood on the Sand campaign and the AI seemed stuck in suppressed mode?

Share this post


Link to post
Share on other sites

Here's the latest addon/script version, with a reasonable number of changes of varying significance.

TPWCAS 3.01 beta: http://filesonly.com/download.php?file=494TPWC_AI_SUPPRESS_301.zip

Changelog:

  • Fixed colour error with debugging map markers.
  • MP and dedicated server debug ball colour handling improved.
  • Units with stances set to crouch/prone by other AI mods will not be forced to "auto"" position when unsuppressed.
  • Fixed already prone units crouching under suppression, when using ACE (thanks Robalo).
  • Reveal shooter is disabled if using ASR_AI.
  • Highly skilled units will suffer lower courage reduction under fire.
  • bDetect logging off by default, may be toggled on.
  • bDetect 0.72

I think I might have also fixed the courage bug, please let me know if not. If this one largely passes muster then I'll update the 1st post.

---------- Post added at 21:00 ---------- Previous post was at 20:56 ----------

How long are the AI suppressed? Is there a parameter in the userconfig? Because last night I gave it a quick spin Zipper5's Blood on the Sand campaign and the AI seemed stuck in suppressed mode?

Units are suppressed for roughly 10 seconds from the last enemy bullet. If a unit has been suppressed with a single bullet, and 9 seconds later you suppress him with another bullet, he'll be suppressed for a further 10 seconds. It's possible to be suppressed for long periods of time if bullets keep passing a unit (just like real life I'd imagine). Units still keep moving whilst under suppression, so should eventually find cover and end up unsuppressed (or dead....).

Currently the suppression times are "hard coded" inasmuchas they are randomly assigned from 8-13 seconds.

Share this post


Link to post
Share on other sites
It's caused by ASR_AI, explained it on my thread here.

Sure. I remember that discussion. I also know that I tested TPWC_AIS with asr_ai after the v15.1.15_test5 update 15-20 times and the chopper never did more than hover just inland & a little E of the landing site while it zapped the truck, then landed. With 1.61 RC it heads much further inland to zap the truck them goes on a shoot'em'up flyaround (6/7 tries, in fact I've now given up testing on Trial by Fire). I reverted to TPWC v206 beta as a control, same problem. As it was still the same asr_ai version, I suspect something has changed between 1.60 & 1.61 RC.

@tpw: TPWCAS 3.01 beta downloaded, will test asap. Thanks!

Edited by Orcinus

Share this post


Link to post
Share on other sites
Sure. I remember that discussion. I also know that I tested TPWC_AIS with asr_ai after the v15.1.15_test5 update 15-20 times and the chopper never did more than hover just inland & a little E of the landing site while it zapped the truck, then landed. With 1.61 RC it heads much further inland to zap the truck them goes on a shoot'em'up flyaround (6/7 tries, in fact I've now given up testing on Trial by Fire). I reverted to TPWC v206 beta as a control, same problem. As it was still the same asr_ai version, I suspect something has changed between 1.60 & 1.61 RC.

@tpw: TPWCAS 3.01 beta downloaded, will test asap. Thanks!

In my tests the chopper keeps killing everything on the island. Tested on veteran only.

The 3.01 version works just great, thanks ! My only gripe now is that I can't use Fraps with it to record stuff, but may that be the worst issue :)

Share this post


Link to post
Share on other sites

@tpw: As Robalo said, 3.01 works just great! :D

No 'courage' errors any more. Still see a creep in the number of civs; I'll try to make some time to investigate that.

Many thanks to you, -Coulum-, fabrizio_t, Ollem, Robalo et al. for all the hard work developing another of the (IMHO) relatively few 'must-use' addons.

@Robalo - that's strange, are you using 1.61 RC or 1.60 with one of the most recent patches? Still, not too important.

PS I play on regular with tags, etc., turned off.

Share this post


Link to post
Share on other sites
@Robalo - that's strange, are you using 1.61 RC or 1.60 with one of the most recent patches? Still, not too important.

PS I play on regular with tags, etc., turned off.

Using a recent 1.60 beta. It could be the difficulty setting making the difference, if the pilot has slightly better spotting skills in Veteran vs. Regular, sees more targets and goes after them.

Share this post


Link to post
Share on other sites
@tpw:I believe tpwcas-fnc-debug should now also only run for 'if local _x' in Allunits due to changrd MP code. Can't verify now. (And can't pm) but I'm quite sure debug balls will now be created by each player which isn't needed and may even create bad side effects. Right Fabrizio? (Tpwcas_fnc_kient_debug is okay as is).

In tpwcas.sqf CBA_fnc_addEventHandler is only needed on client, so could be ( tpwcas_multiplayer && !(IsDedicated)). Color is a local feature and server has no diplay so no need to chnage it there too...

Right. Debug should be local only.

Share this post


Link to post
Share on other sites

No courage errors so far. Nice !

I use ASR_AI v15.1.15_test5 along with the newest 3.01beta and am still not seeing the suppressed troops hitting the dirt as quickly as they should. I even reduced the number of rounds close before they drop/crawl but not seeing that big an effect. With debug on they are getting 11-15 shots past them but still not going prone. Any ideas ? I'm doing my normal testing on a dedi windows box.

Share this post


Link to post
Share on other sites

SSG did a 15 player test today using the 'beta' dedicated script version (Ollum sent it). It worked like a charm! We got some desync issues but that could have been ALICE2 that spooked the server.

This is an awesome script! We were doing a group leader training session where the mission was to set up and execute an attack against a fortified Shilka nest. We did lots of suppression using the M2s on HMMWVs. The entire nest seemed to be taken out, the shilka got shot fast with an M3 (Carl Gustav). So a group advanced, everything was calm. When they get close to the sandbags they all just drop dead! So we move up with one of the HMMWVs only to see a single infantry man hiding prone near a sandbag. After a few seconds a second guy pops up! The were suppressed as hell!! But since they went prone we thought they were dead. Hence the calm. As we advanced we stopped firing (no enemies remember). So the suppression was over and the AI got back on their feet again.

So awesome!

In total

Players:

AI: 3x Groups of 4 units on UPSMON. 3 Static weapons. 3x Groups of 6 units on waypoints on standby waiting to support the nest.

+ Maybe 10 civilians + a few cars driving.

We will be doing a larger test, 20-30 people on Wednesday (no debug balls though). I'll make sure ALICE2 is off. That mission will most likely use dynamic spawn of enemies. Maximum 40 enemies on the map at any given time.

Our server specs are:

i7 2600K @3,40GHz and 4GB (or 8?) RAM. SSD and Windows Server 2008.

We are on 100/100 Mbit line using this server setting:

MinBandwidth=71457280;

MaxBandwidth=122428800;

MaxMsgSend=1024;

MaxSizeGuaranteed=1024;

MaxSizeNonguaranteed=512;

MinErrorToSend=0.0099999998;

MinErrorToSendNear=0.0099999998;

Enemies are on waypoints or UPSMON. We are not using any server AI mods.

We use the 1.60 official patch and ACE2.

Edited by Pellejones

Share this post


Link to post
Share on other sites

Yay, we are out of beta.

TPWCAS 3.01: http://filesonly.com/download.php?file=706TPWC_AI_SUPPRESS_301.zip

Changelog:

  • Fixed multiplayer debug locality issue

I will update the 1st post.

Thank you to -Coulum-, Fabrizio_T, Ollem! And to all of you for your valuable suggestions, input, testing and encouragement.

Edited by tpw

Share this post


Link to post
Share on other sites

Congratulations tpw, it's been good watching this addon emerge into it's current state :) a great example of how members can work together to make something great. And, I enjoy the emergent gameplay it produces.

Share this post


Link to post
Share on other sites
Congratulations tpw, it's been good watching this addon emerge into it's current state :) a great example of how members can work together to make something great. And, I enjoy the emergent gameplay it produces.

+1

Is this update on the Six-Updater network? (currently v1.01)

Congrats and thanks to all those working on this great addon!!

Share this post


Link to post
Share on other sites

I haven't tried this for a while (since 1.0x something) so posting to say that I like what you did to player suppression effect so far.

It's pretty smooth and not really intrusive - yet it still affects aim. Can't snipe a squad of AIs alone with M4A1 anymore. Forced to suppress back instead of taking the time to place a shot under fire.

Also AI LOS is pretty good. I never saw AI react so fast (like humans) before. No more "standing looking at the enemy 10m away for 2 secs"

Edited by metalcraze

Share this post


Link to post
Share on other sites

Bravo!

Works so well now, especially with asr_ai (1.15.1_test5) & TPW_LOS.

A real game changer :D

Share this post


Link to post
Share on other sites

^ yes I tried all three together last night (with DAC of course!) on an UNSUNG/VTE defend-the-base type mission and it completely changed the mission (for the better). Did get a few script errors but that is due to DAC + UNSUNG unit configs I believe.. certainly the courage errors are now gone although I found those hit-or-miss to begin with...

Share this post


Link to post
Share on other sites

Hi to all

... and congrats to all who are involved in this very smart project!

I´ve testet the script TPWCAS v3.01 in conjunction with the TPW_LOS v1.02 in my mission - the game turns into a realism that nobody has seen before, i guess...:cool:

You now have the ability to use it in a tactic way...and the KI reacts propper...it´s unbelievable - the mission changes into a new experience.

Thanks to all mates, who are involved to bring it out!!!

TPWC AI Suppression System (TPWCAS) v 3.01 by TPW && -Coulum- && fabrizio_T && Ollem



Frontpaged at ArmA2Base

http://www.arma2base.de/include.php?path=news&contentid=4820

Best regards

McLupo

Share this post


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

×