15 posts / 0 new
Last post
Wolffy.au
Offline
Joined: 24/06/2009
AI Unit Caching Demo - v2.3

I was introduced to the Coop Essentials Pack (http://www.armaholic.com/page.php?id=2010) by the author Myke a while back, and I've modified his Unit Caching script to support vehicles.


This mission is to demonstrate the use of AI unit caching when not within player or enemy range. The caching script works by reducing squads when they are outside a specified distance from the players, so that entire squads will reduce to a single unit to save on CPU when they are not near the players. The option to disable caching for particular groups is also available.


Testing:
Without AI Unit Caching
Start: 592 AI Units, FPS 26, 192MB
2 mins: 592 AI Units, FPS 17, 193MB



With AI Unit Caching
Start: 592 AI Units, FPS 30, 191MB
2 mins: 51 AI Units, FPS 33, 135MB



For the purpose of this demo, we are triggering at 100m but the suggested minimum would be 1000m. Use the radio commands to teleport and camera functions.



  • Will cache all groups at the start of the mission

  • Will cache dynamically created groups during the mission

  • Handles multiple sides

  • Will trigger squads of different sides when within range

  • Will ignore group if object variable set

  • Will ignore triggering by civilians

Created by: (AEF)Wolffy.au [CTB]


Usage:


Put the following in your INIT.SQF file:


0 = [1000] execVM "modules\CEP_Caching\main.sqf";


Where the parameter is the trigger radius where the units will reassemble.


Change Log:
v2.4 Wishlist
- Line Of Sight de-cache
v2.3
- Changed from SQF to FSM
- Removed initial 30 sec delay
- Added statistics to report log
- Wait 30s or 10% AI increase to refresh cache
v2.2
- Added: Ensure playable groups are not included in caching
- Changed: Increased default caching delay from 30s to 120s
- Changed: Updated Teleport script
- Changed: cachingDisabled test group disabled by default
v2.1
- Added group setVariable ["crB_disableCache", true]; to disable caching on groups
v2.0
- Added Completely restructed the init component to automatically add all groups and new ones as they are dynamically created
- Changed Trigger distance is now a centralised parameter
- Changed trigger activation code as inspired by RMM_Reducer
- Changed groups from all sides can be cached
- Changed groups will trigger when approached by groups from different sides or playable units
v1.3
- Added CEP Unit Caching and radio functions to demonstrate their use.


Thanks to:
    CEP Unit Caching by Myke
    RMM_Reducer by Rommel


Visit us a http://creoBellum.org


Developer notes:
Here is a list of nifty components to be found in this mission.


CEP Unit Caching by Myke
- This code is originally from Myke's ARMA I Coop Essentials Pack. I have heavily modified it and it now supports vehicle units and dynamic group creation.


Syndicated:


AttachmentSize
crB_UnitCaching_2-3.zip39.28 KB
rommel
Offline
Joined: 25/09/2009
http://forums.bistudio.com/sh

http://forums.bistudio.com/showthread.php?t=91232

 

You may enjoy that.
Heavy CPU improvements compared to the one you provided, more streamlined and easier to use.

Wolffy.au
Offline
Joined: 24/06/2009
Version 2 released.Now using

Version 2 released.


Now using a similar trigger activation method as found in RMM_Reducer. Have move to auto including all groups from all sides, including those dynamically created during the mission.


There are also some impressive test results shown above.

Wolffy.au
Offline
Joined: 24/06/2009
Version 2.1- Added group

Version 2.1
- Added group setVariable ["crB_disableCache", true]; to disable caching on groups

Wolffy.au
Offline
Joined: 24/06/2009
I can't take all the credit.

I can't take all the credit. Original code was by Myke, I added vehicle support and Rommel improved the detection trigger. All up, its turned out to be very nifty!

Wolffy.au
Offline
Joined: 24/06/2009
Updated to v2.2- Added:

Updated to v2.2
- Added: Ensure playable groups are not included in caching
- Changed: Increased default caching delay from 30s to 120s
- Changed: Updated Teleport script
- Changed: cachingDisabled test group disabled by default

Gazel
Offline
Joined: 30/10/2010
Any ideas to solve this!

hello, first I want to say how good the script and thank you.

I have a problem ... when used with the module cilvil add any civil or loss of any group he does spawn caused by civil.
Any civilian near a group, as well as OPFOR blufor makes the units is not reduced.

Any ideas to solve this!

do not know if I understood, because I have a bad English. Still thank you!

Wolffy.au
Offline
Joined: 24/06/2009
Hi Gazel - its by design to

Hi Gazel - its by design to allow ambient civilians around cached groups, without triggering the cached group unnecessarily.


The code is written to ignore civilians near cached groups or groups of the same side, that are not playable units. I think its one line change.


In the file cep_cache_units.sqf, change the following code, line 47 from:


if (side _x != civilian && side _cep_leader != civilian && side _x != side _cep_leader) then {


to


if (side _x != side _cep_leader) then {

Gazel
Offline
Joined: 30/10/2010
Thanks!

Thanks!

In a quick test seems to have solved my problem. I will now add back some civilians who used the mission as IED.

Thanks again! this script is really fantastic.

Wolffy.au
Offline
Joined: 24/06/2009
v2.3- Changed from SQF to

v2.3
- Changed from SQF to FSM
- Removed initial 30 sec delay
- Added statistics to report log
- Wait 30s or 10% AI increase to refresh cache


For version 2.4, I'm hoping to utilise a Line Of Sight funciton to decache the group if its visible from a player.

7th.Serf
Offline
Joined: 04/08/2010
how do I turn off the de-bug

how do I turn off the de-bug information?  I'm updating all my missions with this new and very much improved script and don't want the caching information to be displayed.

Oh, and excellent work!!!  My guys can never figure out how I have so many OPFOR on my maps without crashing the server and its because of these excellent scripts.

 
Original Design by Gary Storey