Jump to content
zorrobyte

ZBE_Cache AI & Vehicle caching script/addon

Recommended Posts

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites
because vehicles have have significantly longer engagement ranges than infantry. tank combat can happen from well outside 2000m in this game, so vehicle crews need to uncache then whereas most infantry engagements happen within 500 meters.

currently you either set everything to uncache at vehicle distance(bad for performance), or remove vehicle groups from caching(still bad for performance but not as much)

Actually that is a good point, well made.

Share this post


Link to post
Share on other sites
because vehicles have have significantly longer engagement ranges than infantry. tank combat can happen from well outside 2000m in this game, so vehicle crews need to uncache then whereas most infantry engagements happen within 500 meters.

currently you either set everything to uncache at vehicle distance(bad for performance), or remove vehicle groups from caching(still bad for performance but not as much)

Yep, good point.

We can approach this with 2 paths. Don't cache commanders and gunners in vehicles, like we are doing with drivers (drivers are never cached) or set an specific distance for them to cache uncache.

Thoughts? I don't use as many vehicles in my missions to have a signifcan drop for having 20 more or 20 less AIs enabled.

Share this post


Link to post
Share on other sites

A problem that I am still seeing is when an aircraft gets shot down and on its way to crashing disableanimation kicks in and it hangs in midair. Could a check be made to allow it to crash then cache it? If an object IS cached but would be scheduled for normal garbage collection does it still delete ?

Share this post


Link to post
Share on other sites
A problem that I am still seeing is when an aircraft gets shot down and on its way to crashing disableanimation kicks in and it hangs in midair. Could a check be made to allow it to crash then cache it? If an object IS cached but would be scheduled for normal garbage collection does it still delete ?

Garbage collection should still work as the object is deleted.What you could do is set the air empty vehicle caching param to something higher with little performance impact as I doubt you have 100s of empty aircraft hanging about ;)

Yep, good point.

We can approach this with 2 paths. Don't cache commanders and gunners in vehicles, like we are doing with drivers (drivers are never cached) or set an specific distance for them to cache uncache.

Thoughts? I don't use as many vehicles in my missions to have a signifcan drop for having 20 more or 20 less AIs enabled.

Wouldn't be hard to do, I had plans for this but the old "AI were not cached in vehicles" bug made me lazy. Consider it on my to-do.

Share this post


Link to post
Share on other sites

Anyway to make ai uncache itself whenever it encounters an enemy ai? Ie, no player around. Simulate battles not happening around the player

Share this post


Link to post
Share on other sites

I'm assuming this doesnt interfere with the other entries in the init field of editor placed units? If so, great job :)

Update: Just tried it. Either Im not applying it correctly or it isnt working for units with execvm's for UPS and UPS Respawn (AIvcl_respawn_UPS) in Editor inits.

For infantry group leader this is the init:

(group this) setVariable ["zbe_cacheDisabled",false]; nul = [this,"Molos"] execVM "ups.sqf";

For air unit group leader this is the init:

(group this) setVariable ["zbe_cacheDisabled",false]; nul = [this, 4, 180, "MolosVS1","Molos"] execVM "AIvcl_respawn_UPS\AIvcl_respawn_UPS_init.sqf";

And this is the air unit group member's init:

nul = [this, 4, 180, "MolosVS1","Molos"] execVM "AIvcl_respawn_UPS\AIvcl_respawn_UPS_init.sqf";

Edited by zyg0tic

Share this post


Link to post
Share on other sites

Running this on dedicated server, seeing this message:

18:07:13 "241 ZBE_Cache (Error: No vehicle) --- Groups: 27 # All/Cached Units: 60/43 # All/Cached Vehicles: 5/2 # FPS: 49 # ObjectDrawDistance: 0"

That error is something i should be aware of or i can safely ignore it?

Share this post


Link to post
Share on other sites

Can we get an official word on rather or not this is compatible with mission frameworks that already have caching scripts, such as alive?

Share this post


Link to post
Share on other sites
I'm assuming this doesnt interfere with the other entries in the init field of editor placed units? If so, great job :)

Update: Just tried it. Either Im not applying it correctly or it isnt working for units with execvm's for UPS and UPS Respawn (AIvcl_respawn_UPS) in Editor inits.

For infantry group leader this is the init:

(group this) setVariable ["zbe_cacheDisabled",false]; nul = [this,"Molos"] execVM "ups.sqf";

For air unit group leader this is the init:

(group this) setVariable ["zbe_cacheDisabled",false]; nul = [this, 4, 180, "MolosVS1","Molos"] execVM "AIvcl_respawn_UPS\AIvcl_respawn_UPS_init.sqf";

And this is the air unit group member's init:

nul = [this, 4, 180, "MolosVS1","Molos"] execVM "AIvcl_respawn_UPS\AIvcl_respawn_UPS_init.sqf";

Does UPSmon retain variables of groups when respawning AI?

---------- Post added at 00:58 ---------- Previous post was at 00:56 ----------

It is compatible with ALIVE, and even I've been using in a mission with it, for caching manually generated AI.

If you plan to only use ALIVE AI though, it makes little sense probably. ALIVE already is quite resource hungry.

Share this post


Link to post
Share on other sites
Does UPSmon retain variables of groups when respawning AI?

---------- Post added at 00:58 ---------- Previous post was at 00:56 ----------

It is compatible with ALIVE, and even I've been using in a mission with it, for caching manually generated AI.

If you plan to only use ALIVE AI though, it makes little sense probably. ALIVE already is quite resource hungry.

My thinking behind this was for the vehicle caching more than the AI caching, I'm not sure if Alive caches empty vehicles properly.

Share this post


Link to post
Share on other sites

I just had a quick test on our server running CTI with an HC connected. After a while the game becomes unplayable and the server responds slower and slower. According to ASM the cps (calculations per second) start dropping as soon as some AIs get spawned on the HC. If i disable your script everything goes back to normal.

Share this post


Link to post
Share on other sites
I just had a quick test on our server running CTI with an HC connected. After a while the game becomes unplayable and the server responds slower and slower. According to ASM the cps (calculations per second) start dropping as soon as some AIs get spawned on the HC. If i disable your script everything goes back to normal.

Currently I'm not using this script anymore, as the potential gains of it usually don¡t comeback for the loss of performance I get. Skills in scripting develop and with a better mission planning and the use of an HC (at least in my case) I do not need to use this.

Also, probably things could be better scripted and made in this mod, and maybe with recent patches things have been changed in the core of ArmA engine.

Zorrobyte may have some opinions on this, though I believe he is a bit "on vacations" from ArmA scripting. I just helped him polishing some things.

Share this post


Link to post
Share on other sites
Does UPSmon retain variables of groups when respawning AI?

great script. i seem to get a fps increase when using it. but a question, do the ai groups retain setvariables placed in them?

Share this post


Link to post
Share on other sites

It does not delete any group, so it should work perfectly

Share this post


Link to post
Share on other sites

I'm still around, just lurking about :cool:

I've gotten time to start playing with my clan and we are using ZBE_Cache often. I will continue improving it as I can!

Share this post


Link to post
Share on other sites

I call this (script resides there) simply via debug console:

[1000,-1,true,100,1000,1000] execvm "\scripts\zbe_cache\init.sqf";

Then place troops with some AI spawning script, teleport to other end of Altis - and your debug monitor tells me about 100 units, 0 cached. Can also see them in MCC. So, your script does never cache a unit for me...

Any idea? Addon version works for me.

TIA

Edited by tortuosit

Share this post


Link to post
Share on other sites

@tortuosit

Placing the execution code in mission's .init as normal-script works flawlessly for me and the team.

@zorrobyte

Hey man.

I really wish to know a way i can change the desired caching distances for ground/air etc.

There are cases where default values will be less-than-desired

Excellent script btw :)

Edited by GiorgyGR

Share this post


Link to post
Share on other sites

http://feedback.arma3.com/view.php?id=21746 - RESOLVED!

Now we wait until Dev releases stable for dynamic Object Draw Distance, should have great effect on clientside FPS. Ah totally forgot but can also do AI caching range based upon this so players should never see AI uncache in SP. In MP, a horribly complex idea would be to average all player's ObjectDrawDistance and set AI uncache to that.. hmm.

Share this post


Link to post
Share on other sites

I want to use HAL with DAC or EOS. Since these addons wont spawn units directly via editor, so I wont be able to put anything in their init manually. How can I make your caching work on these ai spawned through DAC or EOS? Or is it that your script automatically finds them at spawn like HAL? Thank you. :)

Share this post


Link to post
Share on other sites

Hey Khan,

 

AFAIK zbe_cache will pick up all units spawned by any means.  Works perfectly from all my testing (and is great with HAL) - if a unit is close to another one they will come out of cache so they can fight :)

  • Like 1

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

×