Jump to content
Sign in to follow this  
wolffy.au

Cached Units with Vehicle Support - v2.0

Recommended Posts

Download:

http://creobellum.org/node/21

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 player. 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

sMPTest2c.jpg

With AI Unit Caching

Start: 592 AI Units, FPS 30, 191MB

2 mins: 51 AI Units, FPS 33, 135MB

sMPTest1c.jpg

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 ambient 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.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

Version 2.1

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

Version 2.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

Version 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.

Edited by Wolffy.au

Share this post


Link to post
Share on other sites

That's a great forum! I love example missions!

I was wondering about this the other day. I loved this feature in A1's DAC by Silola. It's great for mission makers like me that love making mission packed with AI.

Thanks, I'll give this a try.

Share this post


Link to post
Share on other sites
this is cool, i like your reinforcement script best, just wish it would work with addon units:) hint

Send me a PM with exactly what the issue is? If its automatically using groups from ACE units, then I think its already fixed and I'll just need to re-release it.

Share this post


Link to post
Share on other sites

oh i didnt know you could call on addon groups with bisfnc spawn group unless you specify the unit,,

yea so thats exactly what i wanna do is use ace units..

i would even like to use any addon unit but that may be a bit much, so being able to use ace groups

would make me a happy camper:)

Edited by {Op4}Bsilenced

Share this post


Link to post
Share on other sites

Yeah, that all works - by default, if you don't specify any particular faction, it will choose a random EAST side faction group for you.

Haven't tried using RESISTANCE (Guerilla) side yet, but it should be pretty much the same.

I'll see if I can release something over the Easter break.

Share this post


Link to post
Share on other sites
Send me a PM with exactly what the issue is? If its automatically using groups from ACE units, then I think its already fixed and I'll just need to re-release it.

I'd like this exactly. Good to hear you already got it in there.

Share this post


Link to post
Share on other sites

This is very nice indeed. Quick question however. How does this work for AI going into battle with eachother .... do they expand or stay as single units ?

Share this post


Link to post
Share on other sites

hello,

just some creative input here:

did you account for artillery units that will be further away from the player to be excluded from the caching?

because if they get removed and cached aswell then that might break any artillery addon (mine :P) or even the BIS arty module alone since the unit doesn't exist on the playing ground.

Share this post


Link to post
Share on other sites
This is very nice indeed. Quick question however. How does this work for AI going into battle with eachother .... do

they expand or stay as single units ?

When two different side groups come within range of each other, they will expand out into full groups.

did you account for artillery units that will be further away from the player to be excluded from the caching?

It has already been suggested I add a method to exclude groups from caching. I'll be using a setVariable function on the group, and those groups will not be cached. Look out for it in the next release.

Share this post


Link to post
Share on other sites

@Wolffy

Just read the last post and that was exactly what I was going to ask for. Looking forward to the next version.

Nomadd

Share this post


Link to post
Share on other sites

Oh this is great, just what I need right now because the mission im making has 140 groups lol ;)

Thanks

Share this post


Link to post
Share on other sites

There you go boys!

Version 2.1

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

Share this post


Link to post
Share on other sites

Updated 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

Share this post


Link to post
Share on other sites

can you please provide an XEH addon version which allows to load this script as an addon and being self-initializing it would affect all missions?

Like Mando Missile XEH for example.

Share this post


Link to post
Share on other sites
can you please provide an XEH addon version which allows to load this script as an addon and being self-initializing it would affect all missions?

Like Mando Missile XEH for example.

Personally, I don't know how to do it, but I'm happy to assist anyone who wants to contribute making it.

Share this post


Link to post
Share on other sites

HI

I am using this excellent script with Jw Custom USPS When CEP is ran from the init any Ai soliders spawned do nothing just stand there, but vehicles work and patrol as aware as set in the USPS command.

Init from mission sqm for Soldier:

init="nul = [this, 100, ""patrol7"", ""patrol7"", 100, ""AWARE"", 100, ""LIMITED"", ""FILE"", 0, 0] execVM ""USPS.sqf""; ";

Init for t72

init="nul = [this, 100, ""patrol8"", ""patrol8"", 100, ""AWARE"", 100, ""LIMITED"", ""FILE"", 0, 0] execVM ""USPS.sqf""; ";

T72 is a killing machine but the solider and his squad do nothing just stand around. Removing CEP from init.sqf and it works but as the mission is on Fallujah it hammers the server out of it. :confused:

is there any known reason for this? Really would like to use CEP and USPS together if possible.

thanks

Share this post


Link to post
Share on other sites

@Wolffy

Not sure if you are still working on this or not.

I have noticed something strange when I use this script. I will try and explain the best I can. Units blink , one sec they are there. The next they are gone. Then they come back, usually in a different place if they were moving at the time they disappeared. Sometimes they disappear once , sometimes 2-3 times.

I did some tests, hopefully you can reproduce this. Using just plain ole vanilla Arma2 CO v1.57, no mods, no betas...edit ... BAF lite and PMC lite running also

I set up a map on the desert , easier to see..

1 bluefor player, set damage false;

1 opfor squad.

I put the cache distance at 500m and time at 30. This way I know it is not because I am getting out of range. I make sure the bluefor is not near the opfor at the beginning, more than 500m away.

Start it up, I wait 30-40 secs , to make sure the units have been cached. then I teleport close enough to the opfor group to bring them back, but not close enough to engage. Again I wait 30-60 secs , to act like a real mission , where the distance would be 1000 to 1500 meters to bring the units back. Give the units time to start doing what ever they have been assigned to do.

Then I attack them , Random units will dissapear, then come back. Sometimes the whole squad, never the leader though, sometimes just a few.

This problem is worse when something is put in the init line of the leader. I was using BIN_Taskpatrol for this test. But it still happens if nothing is in the init line of the leader, just not as often.

Also, It only happens if you engage the opfor. If you do this a civilian everything seems fine.

If I remove this script no more disappearing units.

I hope I have explained this well enough. I have had to disable this in all my missons because of units blinking on and off like light bulbs when you first fight them.

Nomadd

Edited by Nomadd

Share this post


Link to post
Share on other sites
is there any known reason for this? Really would like to use CEP and USPS together if possible.
Not sure if you are still working on this or not.

I haven't worked on this script for ages. I probably have improved versions that I haven't published individually (but within missions).

What I'd suggest is, create a extremely simple reproducible mission and PM me a download. I won't spend a huge amount of time on it, but I will attempt to update with my latest version and see if it fixes the issue.

Don't give me the mission in its entirity - it will be too hard for me to ensure its the script and not something else.

Latest published version can be found here - http://creobellum.org/node/21

Share this post


Link to post
Share on other sites

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

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
Sign in to follow this  

×