Jump to content
Sign in to follow this  
tpw

TPWC AI suppression system

Recommended Posts

Hi,

I was using Suppression system in warfare this evening and it is awesome but I think I might have found a rare bug.

I bought a BMP-2 for my squad empty and drove it over to my troops, then a friendly AI squad leader jumped in the driver seat and tried to steal it, I quickly got back in and kicked him out and then after that when the vehicle would shoot any of its weapons the FPS would drop from 30 down to 5 and then regain back to 30 instantly.

So I bought another BMP and tried the weapons and the FPS stayed at 30.

This test was on a dedicated server.

When the AI squad leader got into the BMP, it made the vehicle local to the server, which the script would pick-up as a new vehicle and add the eventhandlers on the server causing a doubling of the handlers so when the vehicle would fire its weapons the scripts would run twice creating the extreme FPS drop, 2 script calls on the client, 2 on the server

I think I found the code that might be the problem


bdetect_fnc_eh_add =
{
   private ["_unit", "_vehicle", "_e", "_msg"];

   _unit = _this select 0;
   _vehicle = assignedVehicle _unit;

   if( isNull _vehicle && _unit != vehicle _unit ) then { _vehicle =  vehicle _unit };

if(  ( isNil { _unit getVariable "bdetect_fired_eh" }))  then
   {
       _e = _unit addEventHandler ["Fired", bdetect_fnc_fired];
       _unit setVariable ["bdetect_fired_eh", _e];

       _e = _unit addEventHandler ["Killed", bdetect_fnc_killed];
       _unit setVariable ["bdetect_killed_eh", _e]; 

       bdetect_units_count = bdetect_units_count + 1;

	if( bdetect_debug_enable ) then {
		_msg = format["bdetect_fnc_eh_add() - unit=%1, FIRED + KILLED EH assigned ", _unit];
		[ _msg, 3 ] call bdetect_fnc_debug;    
	};
   };

   // handling vehicles
   if( 
	!( isNull _vehicle ) 
	&& isNil { _vehicle getVariable "bdetect_fired_eh" } 
) then {  

	_e = _vehicle addEventHandler ["Fired", bdetect_fnc_fired];  
	_vehicle setVariable ["bdetect_fired_eh", _e, [color="#FF0000"]true[/color]]; [color="#FF0000"]<-- This variable should be broadcasted to the server[/color]

	_e = _vehicle addEventHandler ["Killed", bdetect_fnc_killed];        
	_vehicle setVariable ["bdetect_killed_eh", _e, [color="#FF0000"]true[/color]]; [color="#FF0000"]<-- This one should also be sent to the server[/color]

	bdetect_units_count = bdetect_units_count + 1;            

	if( bdetect_debug_enable ) then {
		_msg = format["bdetect_fnc_eh_add() - vehicle=%1, FIRED + KILLED EH assigned", _vehicle];
		[ _msg, 3 ] call bdetect_fnc_debug;    
	};
   };
};

With the variables sent to the server will stop the code from adding a second set of eventhandlers to the vehicle

Share this post


Link to post
Share on other sites
Hi,

I think I found the code that might be the problem

With the variables sent to the server will stop the code from adding a second set of eventhandlers to the vehicle

Thanks for your notification. I will look at it.

So if I understand well in a warfare game any vehicle bought will be first a players vehicle (so local to players pc first) and then become AI owned vehicle (and locality will be moved to server)?

If that is the case, I'm not sure what will happen to the EventHandler - I guess it should stay linked to the vehicle, and then the additional 'true' value may indeed solve the issue.

Share this post


Link to post
Share on other sites

So we can manually edit _this..or an upcoming 'special' version will precede ? :D

Share this post


Link to post
Share on other sites
So we can manually edit _this..or an upcoming 'special' version will precede ? :D

Sorry, not sure what you mean? Do you refer to userconfig file? In that case yes you may adjust values to your preference.

Share this post


Link to post
Share on other sites
Thanks for your notification. I will look at it.

So if I understand well in a warfare game any vehicle bought will be first a players vehicle (so local to players pc first) and then become AI owned vehicle (and locality will be moved to server)?

If that is the case, I'm not sure what will happen to the EventHandler - I guess it should stay linked to the vehicle, and then the additional 'true' value may indeed solve the issue.

That is Correct, as I can tell it could happen with multiple players playing in the same game and riding along with each others vehicles, that any player that boards the vehicle makes it local to the player which in turn reruns the add eventhandler code because the vehicle is not initialized on the other players system.

It is a very rare bug that seems to happen when vehicles are created by scripts, It does not happen to editor placed vehicles because they are local to the server.

Share this post


Link to post
Share on other sites

Hi, first of all thanks for keeping on updating these amazing addons :)

I found a little bug in tpwlos_dsc.sqf @ line 131:

//Check whether unit stands, kneels or lies'
_upos = 1.55; // standing
_GetNeckPos= _unit selectionPosition "Neck" select 2;
if ((_GetNeckPos < 1.39) && (_GetNeckPos >= 0.5)) then {_upos = [color="#FF0000"]"kneel"[/color];};  // kneel [color="#FF0000"]<--- should be number[/color]
if (_GetNeckPos < 0.5) then {_upos = 0.10;};	 // lying

_cover = (_camo * _camo * _upos);

Server RPT below:

2012/11/21,  7:39:11 Error in expression <os = 0.10;};	 

_cover = (_camo * _camo * _upos);


_tpwlos_cansee = (_vm * (tpw>
2012/11/21,  7:39:11   Error position: <* _upos);


_tpwlos_cansee = (_vm * (tpw>
2012/11/21,  7:39:11   Error *: Type String, expected Number
2012/11/21,  7:39:11 File tpwcas_dsc\tpwlos_dsc.sqf, line 134

Keep up the good work :)

Share this post


Link to post
Share on other sites

I found a little bug in tpwlos_dsc.sqf @ line 131:

Thanks for your notification. I will fix it in the next release.

Share this post


Link to post
Share on other sites
Thanks for your notification. I will fix it in the next release.

I can't for your next release as this mod, combined with the LoS and Robalo's ASR have revolutionised OA for us.

But as our clan can't afford a dedicated server, we're missing out on your latest fixes/optimisations/improvements.

Share this post


Link to post
Share on other sites

I need to buff up the heavy weapons a little bit (IE:m2 50 cal) because I feel they don't have an elevated fear factor like they do in RL compared to lets say a 556. I am trying to add a cracking sound and blur effect to the heavy hitters similar to

I would like to achieve this using this TPWC system however, this will be for A2:OA vani and TPWC script doesn't seem to work there. In addition, I would like to add a snapping sound file in the mission and more of a screen alteration effect as well. If anybody can assist myself with this, that would be great.

Share this post


Link to post
Share on other sites

I would like to achieve this using this TPWC system however, this will be for A2:OA vani and TPWC script doesn't seem to work there. In addition, I would like to add a snapping sound file in the mission

I believe most of community uses "external" sound mods-so this could be messing things up

..and also it is irrelevant with the purpose of this mod (i.e. strictly enhancing AI behavior)

and more of a screen alteration effect as well. If anybody can assist myself with this, that would be great.

There is already "visual" suppression effect on player in this mod.

I m just not so sure if it's enabled by default on userconfig

Share this post


Link to post
Share on other sites
I believe most of community uses "external" sound mods-so this could be messing things up

..and also it is irrelevant with the purpose of this mod (i.e. strictly enhancing AI behavior)

There is already "visual" suppression effect on player in this mod.

I m just not so sure if it's enabled by default on userconfig

I am not sure what you ment by strictly enhancing AI behavior. Yes there is a suppression effect on the player if you enable it and there are instructions in the readme how to do this. It changes the colors on the screen a little bit. If I can get this working on vani, I can simply change out the effects for something more dramatized.

Share this post


Link to post
Share on other sites
If I can get this working on vani, I can simply change out the effects for something more dramatized.

It should work at Vanilla ArmA2 OA, but you still need CBA for the mod version

I believe the latest script TPWCAS104 version (link in start post) should work on vanilla Single Player without anything else - though I've not tried it.

For TPWCAS_DSC all visual stuff has been removed while this requires code on each players system (and TPWCAS_DSC only runs on dedicated server)

If you still want visual effects in MultiPlayer, you need regular TPWCAS, both on server and each player's system, and then CBA is a must.

---------- Post added at 21:47 ---------- Previous post was at 21:40 ----------

I can't for your next release as this mod, combined with the LoS and Robalo's ASR have revolutionised OA for us.

But as our clan can't afford a dedicated server, we're missing out on your latest fixes/optimisations/improvements.

It's still my intention to implement all latest updates in regular TPWCAS too, but IRL is quite busy right now.

As a temporary workaround, you should be able to use the TPWCAS_DSC script version.

If you change line 24 in tpwcas_dsc.sqf

if ( isDedicated ) then 

to

if ( isServer ) then 

then at least all player shot bullets should suppress AI.

There won't be any visual suppression effects for players then..

Edited by Ollem

Share this post


Link to post
Share on other sites

Is it simple to disable suppresion effects (Shaking, hard breathing) for players, within TPWCAS_DCS (Script version) ?

Share this post


Link to post
Share on other sites
For TPWCAS_DSC all visual stuff has been removed while this requires code on each players system (and TPWCAS_DSC only runs on dedicated server)

If you still want visual effects in MultiPlayer, you need regular TPWCAS, both on server and each player's system, and then CBA is a must.

So there is no way to include this for MP for server without the players to be running CBA?

Share this post


Link to post
Share on other sites
So there is no way to include this for MP for server without the players to be running CBA?

TPWCAS is dependent on a CBA function: cba_fnc_addperframehandler

(for visual debug another CBA function is required too)

You might be able to embed the function yourself in the scripted version code, but that will not be done in our release.

For the mod (.pbo) version CBA is a must.

---------- Post added at 09:56 ---------- Previous post was at 09:54 ----------

Is it simple to disable suppresion effects (Shaking, hard breathing) for players, within TPWCAS_DCS (Script version) ?

Player suppression effects are not even present in the TPWCAS_DSC version.... that would require code on each players system and the whole concept of TPWCAS_DSC is that it's dedicated server side only code.

Share this post


Link to post
Share on other sites

I've made some good progress to merge tpwcas and tpwcas_dsc into one single version.

I've only briefly tested it, but instead of taking more time, I've decided to release it as public beta to ask for your help to test:

tpwcas_v4.0beta.zip

At this stage only the unsigned mod (.pbo) version.

Check the updated userconfig file for config options (don't forget to copy to <arma game dir>/userconfig/tpwcas dir)

New is tpwcas_mode:

  • tpwcas_mode 1: Both player and all available AI will be subject to suppression as well as TPW LOS, and be able to trigger suppression
    - Single Player mode - automatically set
  • tpwcas_mode 2: Multiplayer mode - All available AI and players will be subject to suppression as well as TPW LOS, and be able to trigger suppression.
    - Multiplayer mode - requires setting parameter in userconfig file
    - Requires tpwcas on both server and all players system (may include HC as well).
    - Bullet detection framework active on both server and client pc's, to allow suppression of player and AI local to each system.
    - Embedded TPW LOS will check Line of Sight for all AI and players
  • tpwcas_mode 3: Supposed to be used for AI suppression by player shot bullets only. TPW LOS is only active for players who are in Line Of Sight to enemy AI.
    - Multiplayer mode - default MP setting, does not require setting parameter in userconfig file
    - Recommended setting for MP coop versus enemy AI.
    - No client needed (if available at client tpwcas will be automatically deactivated on that client).
    - There will be no player suppression (i.E. no camshake and no visual blur)
    - Any friendly AI local to player (= member of players group) will not be subject to suppression, nor will trigger AI suppression
    - Friendly AI local to server (= not member of players group) will be subject to suppression, and will trigger AI suppression
    - Embedded TPW LOS will check only if enemy AI has Line of Sight to any player (so not for AI versus AI)
  • tpwcas_mode 4: Headless Client mode, and only to be used in conjunction with tpwcas_mode 3 Dedicated Server: this manual mode will activate suppression for any AI local to HC
    - Should be manually set via userconfig on HC client
    - Experimental - not fully tested yet
  • tpwcas_mode 5: Disable tpwcas mod
    - if TPWCAS is set to 5 (disabled) in userconfig, mission makers can overrule by placing a 'TPWCAS module' on the map to enable TPWCAS mode 2 or 3 for specific mission
    - if TPWCAS is set to enabled in userconfig, mission makers can overrule by placing a 'TPWCAS module' on the map to disable TPWCAS mode (set to 5) for specific mission

Additional Logic Modules are available to overrule userconfig file setting to disable/enable embedded tpwcas and/or find cover for specific missions

Feedback highly appreciated

Edited by Ollem

Share this post


Link to post
Share on other sites
:sorry: I removed the '@' but forgot I should remove at 2 places... I've updated the link now (which is same as LeChuckle guessed right)

Share this post


Link to post
Share on other sites

Great new version, thanks a lot for the effort you are putting into this!

Now I am not sure, whether this has been discussed before, or whether it makes sense due to the internal FSMs but:

Wouldn't it make sense to set any wounded AI to "suppressed" automatically?

I have always had the impression that AI units show too little reaction when they are wounded, unless they are forced to crawl by a leg wound.

So if the player gains a hit in the torso which is not lethal the AI simply seems to proceed with whatever it did before (more or less)...

Share this post


Link to post
Share on other sites
I've made some good progress to merge tpwcas and tpwcas_dsc into one single version.

I've only briefly tested it, but instead of taking more time, I've decided to release it as public beta to ask for your help to test:

tpwcas_v4.0beta.zip

At this stage only the unsigned mod (.pbo) version.

Check the updated userconfig file for config options (don't forget to copy to <arma game dir>/userconfig/tpwcas dir)

New is tpwcas_mode:

- Single Player - no config needed - default SP value (tpwcas_mode = 1)

- Server + clients: add tpwcas_mode = 2

- Dedicated server / no clients - no config needed default MP value (tpwcas_mode = 3)

- Disable tpwcas: tpwcas_mode = 5

(- tpwcas_mode = 4 is reserved for 'headless client - work in progress)

Special feature for mission makers and server admins:

Logic Modules to overrule userconfig file setting to disable/enable tpwcas (completely or just embedded tpwcas and find cover) for specific missions

Feedback highly appreciated

Just to be sure.

We now need to use TPWCAS instead of TPW_AI_Sup, right? Do we still need to use TPW_AI_LOS?

EDIT: Why do I get this Message when shooting an RPG-18 with Debug enabled? Or what does it mean?

NR: [true,"Rocketbase",2] -

Pro: 40 - Life: 20 - Dist: 7000

Edited by Tonci87

Share this post


Link to post
Share on other sites
Just to be sure.

We now need to use TPWCAS instead of TPW_AI_Sup, right? Do we still need to use TPW_AI_LOS?

EDIT: Why do I get this Message when shooting an RPG-18 with Debug enabled? Or what does it mean?

NR: [true,"Rocketbase",2] -

Pro: 40 - Life: 20 - Dist: 7000

TPWCAS is updated version TPW_AI_Sup.

A (somehow modified) version of TPWLOS has been embedded in TPWCAS now.

If you prefer to use the original TPW_AI_LOS, disable embedded TPWCAS_LOS in the userconfig file.

Don't use both at the same time.

RPG Debug message: I've added some experimental code to have grenades and AT also have a suppression effect.

So if you throw a grenade or shoot an AT, AI should hit the deck too.

Thanks for notification: I will remove the debug message asap.

I've also made a few other minor changes too (e.g. visual suppression effect didn't seem to work), so you can expect a new beta soon.

Share this post


Link to post
Share on other sites

Ollem

Can you please be more specific on:"A (somehow modified) version of TPWLOS"?

Every detail interests me a lot..

Share this post


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

×