Jump to content
ollem

TPWCAS - TPWC AI Suppression System

Recommended Posts

Description: Singleplayer, Multiplayer and Dedicated Server Compatible AI Suppression System

Authors: TPW && -Coulum- && fabrizio_T && Ollem

Latest Version: 4.5

Released: 22-02-2012

Mod Package: both addon and scripts

Requirements: CBA

Previous Releases and Discussion:: http://forums.bistudio.com/showthread.php?136304-TPWC-AI-suppression-system

Download Arma 3 Beta script version: TPWCAS_A3 bistudio forum thread

Download Arma 2 mod+script version: tpwcas5.51.zip (last update dec-2014)

Changes version 5.51:

- update: fixed error messages which appeared after latest A2 beta patch

- other

Change log version 4.5:

- New: fully automatic detection and support of HeadLess client

- New: 'find cover' function has been made FPS aware too: below configurable server FPS threshold (default 17 FPS) find cover function will be skipped to save some CPU for more important tasks

new usercondig file entry: // 19 AI SEARCH COVER REQUIRED MINIMAL SERVER FPS, ELSE PROCESS IS SKIPPED

tpwcas_getcover_minfps = 17;

- Update: updated bullet detection framework based on Fabrizio_T's latest bDetect v0.76 framework.

- Update: tpwcas_mode = 5 (forced disable of tpwcas) will become 'tpwcas_mode = 0' ('tpwcas_mode = 5' will be deprecated*)

- Update: embedded 'tpwlos' will be disabled by default and can be switched on by changing setting in userconfig file

- Fixed: all hint commands will be optional and by request have been replaced by hintsilent

- Fixed: other really minor changes

Introduction:

--------------

One of the things sorely missing from Arma2 is reaction to passing bullets. An AI unit will often stand quite happily whilst bullets whiz by. This makes effective suppression of AI enemies difficult - you basically always have to aim to kill them since you can't make them keep their heads down by shooting nearby.

This addon aims to address this problem by making AI units react to passing projectiles. If a bullet snaps by within around 10m of an AI unit, it will crouch/kneel (depending on movement), and if more than around 10 bullets pass by a unit in 5 seconds, the unit will drop/crawl. After 10 seconds without bullets, the unit will return to its previous stance.

Additionally, suppressive fire can alter the aiming shake, accuracy and courage of the suppressed unit. The more fire directed near a unit, the lower its skills will become. Nearby casualties will further decrease a unit's courage. After 5 or so seconds without bullets, the skills will gradually return to normal. Player units will optionally experience some visual effects if suppressed (camera shake, vision blur and darkening).

Currently there is no "suppressed" eventhandler in the game engine, so TPWCAS aims to mimic one by constantly monitoring whether any active bullet/shell projectile objects have units within a 10m radius. This allows TPWCAS to work for any opfor, blufor or independent on the map, whether editor-placed or spawned.

TPWCAS significantly changes gameplay, allowing for longer engagements and more thought required to survive them.

IMPORTANT NOTE:

TPWCAS is not an all-in-one AI behaviour modification mode. Its primary purpose at this time is to cause units to duck/drop and lose some shooting competence under suppressive fire. It's designed to play well with mods which DO alter AI behaviours under combat stress, and you are encouraged to use these if you require additional realism such as moving to cover.

Version 4.0 includes an optional feature to tigger a basic move to cover by AI in case of close by cover.

VERY IMPORTANT NOTE:

TPWCAS started life as an SP only mod, but a large amount of effort has gone into modifying the bullet detection, suppression and visual debugging framework to work for MP and dedicated server. While every effort has gone into testing in SP, MP and dedi, we simply cannot vouch for perfect operation under all circumstances.

Readme:

---------

Please read this for full details of TPWCAS, including features, installation, configuration, caveats, credits and the full changelog:

readme_tpwcasv4.5.txt

Please note: The format of tpwcas_v2.hpp introduced with v4.1 is different than previous versions.

Script Mode:

--------------

Syntax: nul = [<tpwcas_mode>] execvm "tpwcas\tpwcas_script_init.sqf";

e.g. to run script mode in tpwcas_mode 2, call from mission init:

nul = [2] execVm "tpwcas\tpwcas_script_init.sqf";

Changes version 4.x:

---------------------------

4.1:

- New: Merger of TPWC_AI_SUPPRESS and TPWCAS_DSC version

- New: Same mod can be used for SinglePlayer, Dedicated Server, and Client-Server setup (config parameter "tpwcas_mode")

- Auto detection of SinglePlayer setup (tpwcas_mode = 1)

- Auto detection of MultiPlayer Dedicated Server setup (tpwcas_mode = 3)

- Auto disable of client if Server started in Dedicated Server mode (server tpwcas_mode = 3/client tpwcas_mode = 5)

- Manual config option to configure client/server setup (tpwcas_mode = 2)

- Manual config option to disable TPWCAS (tpwcas_mode = 5)

- Experimental config mode specifically for 'Headless Clients' (tpwcas_mode = 4)

- Update: Performance improvements and code optimizations

- Update: Bullet detection frequency (==server load) will always automatically reduce if server or SP FPS drops

- Fixed: all files names to lowercase for Linux Server compliance

- Fixed: tpwcas will work after respawn

- Fixed: Vehicle EventHandlers for vehicles will not be duplicated in case of locality change

- New: basic take cover functionality: can be disabled/enabled in config file

- New: config parameter to set radius to search for cover (recommended to keep low number)

- New: Embedded TPW LOS (Line Of Sight - slightly modified version): can be disabled/enabled in config file

- New: Embedded TPW LOS will automatically pause when (server) FPS is below (configurable) threshold value

- New: Civilians will run in random directions when bullets are close to them

- New: Handgrenades and AT/RPG will cause suppression too

- New: TPWCAS Logic Modules (F7 in editor) to allow Missionmakers to overrule (server) config file parameter settings to:

- Disable TPWCAS (if enabled in userconfig file)

- Enable TPWCAS (if disabled in userconfig file)

- Disable TPWCAS embedded TPW LOS (if enabled in userconfig file)

- Enable TPWCAS embedded TPW LOS (if disabled in userconfig file)

- Disable TPWCAS embedded Find Cover (if enabled in userconfig file)

- Enable TPWCAS embedded Find Cover (if disabled in userconfig file)

4.5:

- New: fully automatic detection and support of HeadLess client

- New: 'find cover' function has been made FPS aware too: below configurable server FPS threshold (default 17 FPS) find cover function will be skipped to save some CPU for more important tasks

new usercondig file entry: // 19 AI SEARCH COVER REQUIRED MINIMAL SERVER FPS, ELSE PROCESS IS SKIPPED

tpwcas_getcover_minfps = 17;

- Update: updated bullet detection framework based on Fabrizio_T's latest bDetect v0.76 framework.

- Update: tpwcas_mode = 5 (forced disable of tpwcas) will become 'tpwcas_mode = 0' ('tpwcas_mode = 5' will be deprecated*)

- Update: embedded 'tpwlos' will be disabled by default and can be switched on by changing setting in userconfig file

- Fixed: all hint commands will be optional and by request have been replaced by hintsilent

- Fixed: other really minor changes

Features:

----------

TPWCAS enables stance and skill modification under fire.

* Units react to bullets passing within 10m.

* Units on foot or operating vehicle or static guns are affected.

* Units driving are unaffected.

* Only uninjured units are affected.

* Bullets fired from less than 25m away are ignored.

* Bullets from small calibre pistols and SMG are ignored.

* Units react differently according to the side of the shooter.

* Friendly shooter: > 0 bullets --> kneel/crouch.

* Enemy shooter: 1 - 10 bullets --> kneel/crouch, > 10 bullets -->drop/crawl.

* Units regain previous stance after 10 or so seconds without nearby bullets.

* Friendly shooter: no skill reduction.

* Enemy shooter: skills reduced according to number of bullets.

* Units gradually regain skills after 5 or so seconds without bullets.

* Shooter may be "revealed" to the suppressed unit.

* Units are more easily suppressed if there are nearby friendly casualties.

* Player experiences visual effects if suppressed.

Visual Debugging:

------------------

Coloured debug balls can be enabled to assist to visualize TPWCAS suppression functionality:

* No ball - unsuppressed.

* Green ball - close friendly fire detected - going crouched

* Yellow ball - sporadic enemy fire detected - going crouched

* Red ball - threshold value of enemy fire detected - going prone

* Black ball - unit is fleeing (fleeing does not mean the unit is running away, but will not be able to be suppressed).

* Purple ball - indicates LOS (Line Of sight) was triggered

Smoke and flagpoles are related to take cover and civilian runaway trigger:

Enemy AI:

* Yellow smoke + flag pole - selected cover position

* Blue smoke - unit reached cover

* Green smoke - unit stayed a few random seconds in/close to cover position and default AI behavior will take over again

* Red smoke - unit went (too far) to wrong direction or took too long to reach cover and default AI behavior will take over again

* Cyan smoke - unit is already in cover (or at least no Line of Sight to shooter)

Civilians:

* Yellow smoke + flag pole - runaway destination position

* Blue smoke - unit reached selected destination and should go prone

* Green smoke - unit stayed a few random (20 to 40 seconds) at position and default AI behavior will take over again

* Red smoke - unit went (too far) to wrong direction or took too long to reach cover and default AI behavior will take over again

Demo video's:

---------------

Here's what TPWCAS looks like in action. Many thanks to McLupo for this video.

WBJ-nKXsfEY

Development version 1.02, with coloured balls showing suppression state (green = unsuppressed, yellow = suppressed, red = fully suppressed)

wVG_HEVSwRc

Edited by Ollem

Share this post


Link to post
Share on other sites

Thanks for your work on this Ollem, much appreciated, and that suppression effect has grown on me :)

Share this post


Link to post
Share on other sites

Hi.

I have placed the tpwcas_v2.cpp in c./Bohemia Interactive/ArmA 2/userconfig/tpwcas/... and adjusted a few parameters, but they id not seem to work. SO i decided to adjust the very first one,

// 0 STARTUP HINT (TPWCAS & BDETECT). 0 = NO HINT, 1 = HINT.

tpwcas_hint = 0;

but still, after 5 seconds of so, the game gives me the hint that bulletdetect-somthign has been started. Also, the delay was set to 20 seconds, stil it works already after 5.

Could it be that the addon does not read the userconfig, and if so, are there any possibilites what i could do to adjust it?

Other than this, it's a great addon, but it's kinda sad if i cannot adjust the numerours variables, since that's what i liked most about tpwcas - the customisation possibilities.

Share this post


Link to post
Share on other sites

Are you using the mod or the script version?

For the script version you need to adjust parameters in the 'tpwcas_init.sqf' file in stead.

double check: you are referring to tpwcas_v2.cpp - the file name should be tpwcas_v2.hpp

Share this post


Link to post
Share on other sites

i'm using the addon version. and yep, it's tpwcas_v2.hpp, my bad here. Also, its in the correct section, and i'm using the addon version only, in a clear mission without the script version in addition, so this won't override it.

Share this post


Link to post
Share on other sites

Please try to change tpwcas_debug from 0 to 2 or the vice versa:

0 - no visual debug info should be seen

2 - visual debug info as well as messages in armaoa.rpt file should appear.

Do you see difference when changing this setting?

If you do see debug info, please check the log file (in directory "%APPDATA%\..\local\ArmA 2 OA").

Share this post


Link to post
Share on other sites

Having the same issues, Im no scripting professional but to enter the userconfig values Id like to have I edited the sqf's in the pbo file and checked the scripts a little. I couldnt find any reference to the userconfig file just values to check but no path where to find those. Maybe you should check on this?

Anyway, great to see this awsome mod is still developing.

EDIT: As I said, i dont know how this whole userconfig thing works but it definitly doesnt work in this case. But furthermore, even changing the values in the scripts doesnt seem to change anything. The hint still pops up every time.

EDIT 2: I figured out that all the userconfig values seem to work actually but just the hint "bdetect active" still appears. You should try to add an option to disable this too.

Edited by Dar

Share this post


Link to post
Share on other sites

Hi,

Im sorry, but can you please explain, what does the parameter of tpw_los "EMBEDDED TPWLOS MAXIMAL KNOWSABOUT VALUE: ABOVE WILL SKIP TPWLOS FOR THIS SPECIFIC SPOTTER-TARGET COMBI VALUES: SEE TPWCAS_REVEAL ABOVE" mean? Of course its a silly question, but even with google translator i cant understand the meaning of phrase(

Share this post


Link to post
Share on other sites

Thank you very much for the update and Merry Christmas to all of you!

PS: I have the same issue as Elena and Dar.

/KC

Share this post


Link to post
Share on other sites
Hi,

Im sorry, but can you please explain, what does the parameter of tpw_los "EMBEDDED TPWLOS MAXIMAL KNOWSABOUT VALUE: ABOVE WILL SKIP TPWLOS FOR THIS SPECIFIC SPOTTER-TARGET COMBI VALUES: SEE TPWCAS_REVEAL ABOVE" mean? Of course its a silly question, but even with google translator i cant understand the meaning of phrase(

There's no added value to make an AI unit aware of an enemy who's in Line Of Sight (and do all the not needed calculations) if the AI unit is already aware of the AI unit who's in Line of Sight.

The 'knowsabout' value is the value that describes how much an AI unit knows about another unit already.

So the 'tpwcas_los_knowsabout' parameter can be used to set the threshold above which tpwlos will skip further processing the specific unit while he is already aware of it and knows enough to leave it up to default AI behaviour to react.

'Reveal' command actually sets the knowsabout value of a unit.

So a value of e.g. 4 means everything up to exact location is already known, and a value of e.g. 2 means the AI unit knows there someone out there somewhere, but doesn't know exact position. For description of "reveal/knowsabout' values, see 'TPWCAS_REVEAL' description in de config file.

---------- Post added at 20:12 ---------- Previous post was at 19:56 ----------

PS: I have the same issue as Elena and Dar.

I've found the issue:

I believe the hint enable/disable feature works, but it's specifically for the messages "TPWCAS 4.1 Starting..." and "TPWCAS 4.1 Active".

However, the used magic 'bullet detection framework' known as 'bdetect' developed by fabrizio_T also has an hint option.

When running tpwcas in modes 1 or 2, the message "bDetect v4.1 has started" unfortunately still does pop-up.

In mode 3 (Dedicated server) the issue should not occur.

In next release I will make it dependent on the 'tpwcas_hint' parameter value.

For those who like to fix themselves:

For both script and mod version, look for file 'tpwcas_init.sqf' line 265:

add the following line:

bdetect_startup_hint = tpwcas_hint;

below this exsting line:

bdetect_bullet_max_lifespan = tpwcas_bulletlife;

Share this post


Link to post
Share on other sites

Thanks for this masterpiece to all involved. This is like ASR_AI, it changes compeletely the way how to play vs AI, in fact the feeling is more and more like u play vs humans.

PLUS its very customizable, has good documentation and präsentation, covers singleplayer, selfhosted, dedicated, was developed with ASI_AI in mind for best compatibility... what can u want more? Nothing i can think of, this is PERFECT !

Respect gentleman :notworthy:

Share this post


Link to post
Share on other sites
Hey mate, is this working ok with Zeus AI & ASR_AI? just wondering, thanks.

As mentioned above: it has been developed with ASR_AI in mind: if ASR_AI is active, some functionality will be skipped by TPWCAS and (thanks to Robalo) will only handled by ASR_AI.

I'm not very familiar with Zeus AI, but in the previous tpwcas thread there has been quite some discussion about it.

Your mileage may vary: Some reported it works great, others didn't see benefit of Zeus...

Please read e.g. http://forums.bistudio.com/showthread.php?136304-TPWC-AI-suppression-system&p=2229307&highlight=Zeus#post2229307

and http://forums.bistudio.com/showthread.php?136304-TPWC-AI-suppression-system&p=2230373&viewfull=1#post2230373

Anyway, please test and report your findings :)

(If you see strange behavior in combi with mods like Zeus, you may want to start with disabling tpwcas_find_cover and tpwcas_los first)

I dont mind the hint, but could you make it use hintSilent instead?

Request noted: next release all 'hint' will be 'hintsilent'

Edited by Ollem

Share this post


Link to post
Share on other sites

Great job Olleem, thank you for the hard work!

Have a Merry Christmas ;)

Share this post


Link to post
Share on other sites
As mentioned above: it has been developed with ASR_AI in mind: if ASR_AI is active, some functionality will be skipped by TPWCAS and (thanks to Robalo) will only handled by ASR_AI.

I'm not very familiar with Zeus AI, but in the previous tpwcas thread there has been quite some discussion about it.

Your mileage may vary: Some reported it works great, others didn't see benefit of Zeus...

Please read e.g. http://forums.bistudio.com/showthread.php?136304-TPWC-AI-suppression-system&p=2229307&highlight=Zeus#post2229307

and http://forums.bistudio.com/showthread.php?136304-TPWC-AI-suppression-system&p=2230373&viewfull=1#post2230373

Anyway, please test and report your findings :)

(If you see strange behavior in combi with mods like Zeus, you may want to start with disabling tpwcas_find_cover and tpwcas_los first)

Thanks alot mate for the reply, ive been using all 3 together for ages and not came across any problems as of yet, if I did then yeah ill report my findings here, thanks.

Share this post


Link to post
Share on other sites

Hi Ollem,

i see you're very active on this.

I thought it was useful to commit some bDetect changes/fixes made back in november.

Most prominent changes in bDetect v.0.76:

* Use of new native "onEachFrame" ArmA2 OA scripting command. Available since v.1.62.98866 BETA, it's now the default bullet detection function. You may still set "bdetect_mp_per_frame_native_163beta" = false in order to keep using "cba_fnc_addPerFrameHandler" as detection handler.

* More aggressive detection settings. Till v.074 settings were almost conservative as a BETA policy.

v0.76 did undergo some internal testing, but i'd suggest to make some more thorough testing, even if no new major issues arose in my actual knowledge.

bDetect v0.76 SP/MP

https://github.com/fabrizioT/bDetect/blob/master/bdetect.sqf

Share this post


Link to post
Share on other sites

* Use of new native "onEachFrame" ArmA2 OA scripting command. Available since v.1.62.98866 BETA, it's now the default bullet detection function.

I guess you are aware that onEachFrame is not stackable ?

So if either a mission or another addon uses the event too, one will overwrite the other and depending on which onEachFrame is called as last one the bdetect script might not work at all.

See also https://dev-heaven.net/issues/54314

Xeno

Share this post


Link to post
Share on other sites
I guess you are aware that onEachFrame is not stackable ?

So if either a mission or another addon uses the event too, one will overwrite the other and depending on which onEachFrame is called as last one the bdetect script might not work at all.

See also https://dev-heaven.net/issues/54314

Xeno

Thx Xeno,

no, i was not aware of this (and seriously wonder why it was done this way, making the command pretty useless).

So, when running bDetect v0.76 please explicitly set:

bdetect_mp_per_frame_native_163beta = false;

before invoking:

call bdetect_fnc_init;

That unless you're pretty sure no other addon is using "onEachFrame" calls.

Edited by fabrizio_T

Share this post


Link to post
Share on other sites

fabrizio_T/Xeno, Thanks for the update and info!

I'll take a look at it and shall merge it with my own adjustments in future release.

Share this post


Link to post
Share on other sites

Hi

Firstly, thank you all for this excellent script! Now I use it in every single mission. :cool:

A question: I am making a mission in which a five-member Bluefor team has to rescue a hostage (independent) in Fallujah. The problem is that when the hostage joins a player unit and there is a firefight, the hostage goes prone and stays prone for a relatively long time but this way makes the rescue a bit clumsy (i.e I cannot figure out how to force him to run across a street for example). Is there a way to make only the hostage "unsuppressable"?

I haven't really tested the mission with other human players yet but I don't want my friends watch the hostage crawl for 15 minutes when we finally test the mission... :D

Edited by b1944

Share this post


Link to post
Share on other sites

If a unit is being suppressed or under fire it is difficult to get them to follow orders (there needs to be an override "MOVE HERE NOW OR YOU WILL DIE" command).. not sure if there is a variable which excludes a unit from suppression (but great idea!!).

Your other option is to have the mod running on the server only or in dedicated server COOP mode - this means the suppression will only affect server-controlled AI units... any AI units under player command will not be affected by suppression.

Share this post


Link to post
Share on other sites

If I'm not mistaken, it may have been told that getting your men in tight formation (close column or diamon) helps to make them reactive again, maybe because it would boost their morale.

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

×