Jump to content
zorrobyte

ZBE_Cache AI & Vehicle caching script/addon

Recommended Posts

So just to confirm it does function server-side only (addon) with some possible issues with empty vehicle caching?

As of now, units in vehicles cannot be cached due to A3 bug:

http://feedback.arma3.com/view.php?id=21702

Once this is fixed, all but the driver will be cached. When that time comes, I'll revisit to see if there would be benefit in the gunner(s) remaining uncached as well.

Interesting... A2 version of DAC used to cache all but the driver and I assumed this was the same in Arma 3 version but now I need to test :p

Share this post


Link to post
Share on other sites

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
So just to confirm it does function server-side only (addon) with some possible issues with empty vehicle caching?

Only difference is that running addon on dedicated server only (vs script) means that the empty vehicle caching won't work on clients. The empty vehicle caching does nothing for the server, it's for client's FPS as having hundreds of empty vehicles on the map greatly impacts performance. With 2000+ vehicles, client FPS was 7 and the mission took 5 minutes to load from editor without caching. With caching, client FPS was 47 with the same amount of vehicles.

This is of no concern for 99% of missions as most missions don't spawn 100s/1000s of empty vehicles. However if someone wanted to, they could use the script version in their mission. The whole point for me personally was to generate 1000s of vehicles at mission start so HETMAN AI can dynamically go out and find/use vehicles.

The main reason why I publish a script version is that mission makers can use ZBE_Cache in their missions so they don't have to recommend addons.

Interesting... A2 version of DAC used to cache all but the driver and I assumed this was the same in Arma 3 version but now I need to test

More than likely still does, DAC deletes and creates units instead of enablesimulation/hideobject. I went with the latter route so the caching module is lighter weight, it doesn't break other addons/scripts and most importantly less packets are sent to the clients by using enablesimulation vs delete/create unit.

Since the issue was fixed with enablesimulation, performance vs the two methods isn't that different: ZBE 144 Groups, 1145 Units, 17 NoCacheFPS, 51 CachedFPS, 59 DeletedFPS

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Thank you! This has the potential to make full scale war possible :)

Something I noticed and I think was caused by ZBE_cache. An AI pilot ejected from a hit A-10 and the plane then got stuck in the air. Probably physics got disabled on it.

Share this post


Link to post
Share on other sites

Ah yes, I didn't think about that use case. As a work around, go ahead and set vehicle caching distance to 500-1000 or so. I'll need to work out separate caching distance per air, boat, car. Thank you for letting me know!

Share this post


Link to post
Share on other sites

Sorry for this silly question but could ZBE_cache be useful even if I only play on editor?

Share this post


Link to post
Share on other sites
Sorry for this silly question but could ZBE_cache be useful even if I only play on editor?

If you like to spawn a shitload of units, yes, definitely (why wouldn't it?)!

Share this post


Link to post
Share on other sites
Sorry for this silly question but could ZBE_cache be useful even if I only play on editor?

Im using it with editor placed units,and gaia/upsmon(testing both) and for scenarios that stretch the AO far and wide,with patrolls set all over its extremely useful.

Also the AI uncache when they meet,so its mission friendly.In a word,this script...well theres absolutely NO reason not to have it.Even if you have decent rig.

Share this post


Link to post
Share on other sites

Changelog:

v4.2

Removed _orgSpeedMode (cleanup)

SetPosATL to SetPos for RPT spam fix (Client: Object 14:32 (type Type_89) not found.)

Resolved disableAI issue (did nothing) as was not implemented properly for dedicated server

zbe_vehicleCaching.fsm now uses 500ms delay between checking conditions for less load

Script version no longer uses enableSimulationGlobal/hideObjectGlobal to save packets as it is assumed it will be running on all localities. (Addon version still uses global commands so only the server can run addon, addon still doesn't do empty vehicle caching unless clients run addon as well)

Updated empty vehicle caching to 1000m until per vehicletype distance is added

Consumed 3 more cups of Earl Grey tea this version vs v4.1

Edited by zorrobyte

Share this post


Link to post
Share on other sites

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

Zorrobyte, Is it possile with script version to only apply caching to certain groups spawned by script rather than allGroups. EOS is already handle caching for units it spawns, but I have groups spawning in side missions that I would like to cache with your script.

Share this post


Link to post
Share on other sites

Zorrobyte,

im experiencing stutters when using this cache system.

Even on an empty map.quite odd.Im farmiliar that uncaching will cause stutters normally.But as said,nothing is being cached or checked as far as i know.

Seems this may be relating to TPW Air.

Which spawns random aircraft and sends them on a flyover of the map before despawning them.Will check again with TPW air off

Edited by redarmy

Share this post


Link to post
Share on other sites

Nice work, using this with some of our public missions and its doing wonders of keeping the server FPS right up close to 50 when we aren't in Combat. Works well with Patrol Ops 3 as well. Congrats on the release and keep up the good work!

Share this post


Link to post
Share on other sites
Zorrobyte,

im experiencing stutters when using this cache system.

Even on an empty map.quite odd.Im farmiliar that uncaching will cause stutters normally.But as said,nothing is being cached or checked as far as i know.

Seems this may be relating to TPW Air.

Which spawns random aircraft and sends them on a flyover of the map before despawning them.Will check again with TPW air off

Ah, I wasn't sure it was caused by the cache system but I experienced this too. Note that I wasn't using any addons, but it happened on a mission where I spawn and delete units depending on their distance from the player.

Might be related to what you experienced with TPW air?

Share this post


Link to post
Share on other sites

I recently received a PM asking about the licence of ZBE_Cache. I replied with this to further explain the license:

I appreciate you taking the time to reach out regarding ZBE_Cache. ZBE_Cache is released under a Creative Commons Attribution-ShareAlike 4.0 International License. You are free to utilize ZBE_Cache into your mission files, modify it and redistribute the module part or in whole in another project under the following terms:

1. Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

2. ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

3. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

As ZBE_Cache is a "module"/script that I intend for others to include into their missions, ShakeAlike applies to the ZBE_Cache module itself meaning that your finished mission can be released under any licence you prefer (as a whole work) as long as the source code including any modifications to ZBE_Cache is provided under a Creative Commons Attribution-ShareAlike 4.0 International License.

Allowing the public at large to:

1. Download ZBE_Cache with or without your modifications by a specific link or method you provide OR by extracting the mission's PBO file to access ZBE_Cache or a derivative of source code and use it under the Creative Commons Attribution-ShareAlike 4.0 International License.

Basically put, feel free to use, modify and redistribute (in part or full in another project) ZBE_Cache with attribution and the modifications of such under the same licence so that improvements can be backported into the ZBE_Cache core source.

The GIT repo is located at: https://bitbucket.org/zorrobyte/zbe_cache

Please report any bugs, feature requests or any other concerns at: https://bitbucket.org/zorrobyte/zbe_cache/issues

Although not required, I'd be interested to know how it works out for you! At some point I would appreciate feedback to include as a "testimonial" of sorts in the forum post and Armaholic page. Feel free to link your project and it will be included, helping get the word out.

---------- Post added at 06:33 PM ---------- Previous post was at 06:29 PM ----------

Zorrobyte, Is it possile with script version to only apply caching to certain groups spawned by script rather than allGroups. EOS is already handle caching for units it spawns, but I have groups spawning in side missions that I would like to cache with your script.

Yes, of course! I didn't test this but should work (it may spawn 2x the units, didn't test but gives you an idea):

In the eos\functions\infantry_fnc.sqf file of EOS, put

(group _unit) setVariable ["zbe_cacheDisabled",true]; under line 22 so the file looks like this:

if (!isServer) exitWith {};

// SINGLE INFANTRY GROUP

private ["_grp","_unit","_pool","_pos","_faction"];

_pos=(_this select 0);

_grpSize=(_this select 1);

_faction=(_this select 2);

_side=(_this select 3);

_grpMin=_grpSize select 0;

_grpMax=_grpSize select 1;

_d=_grpMax-_grpMin;

_r=floor(random _d);

_grpSize=_r+_grpMin;

if (surfaceiswater _pos) then {_pool=[_faction,1] call eos_fnc_getunitpool;}else{_pool=[_faction,0] call eos_fnc_getunitpool;};

_grp=createGroup _side;

for "_x" from 1 to _grpSize do {

_unitType=_pool select (floor(random(count _pool)));

_unit = _grp createUnit [_unitType, _pos, [], 6, "FORM"];

(group _unit) setVariable ["zbe_cacheDisabled",true];

};

_grp

Ah, I wasn't sure it was caused by the cache system but I experienced this too. Note that I wasn't using any addons, but it happened on a mission where I spawn and delete units depending on their distance from the player.

Might be related to what you experienced with TPW air?

Interesting. If someone could PM me a dropbox link(or somehow) of the mission so I can duplicate, it would be very helpful. When you say stutter, is the PC locking up or is the unit/vehicle stuttering itself?

I'll test with TPW air now.

What is your empty vehicle caching range set to?

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Well, my first testimonial XDD

I'm using it as part of my mission template for 35COOP missions for my community, and I must say It's the only system that is currently working (perfectly I must add) with the ZEN framework (which I'm using because it suits my needs, it's really well documented and it's updated regularly).

Also must say Zenophon has said he won't implement any caching system into his framework for now, after I told him about yours, as he saw yours was doing pretty well.

http://forums.bistudio.com/showthread.php?180196-Zenophon-s-ArmA-3-Co-op-Mission-Making-Framework&p=2823098&viewfull=1#post2823098

Share this post


Link to post
Share on other sites

Does someone elese have the problem that you cant use the Arsenal Module for AI as Zeus when using this mod?

Share this post


Link to post
Share on other sites

So I found a pretty big bug, FSMs apparently hate OR conditions (||) in condition blocks and the FSM was not exiting per group and would loop forever greatly impacting performance over longer missions. This would cause some errors such as setpos expected 3 elements error as there was no TL to setPOS to as group was null.

I fixed it and added RPT debug output if you have debugging on:

MHiVoSU.png

I'll likely add this to player sidechat for those without baretail or know how to tail RPTs to watch debug if wanted.

v4.3 coming soonish, I'll see if I can make the setpos "resolution" into this version as well.

Any idea what the "No owner" RPT spam is?

Share this post


Link to post
Share on other sites

I'll give the update a try and see if the framerate drop still occurs - if so, I'll send you a repro mission ASAP!

Share this post


Link to post
Share on other sites

Changelog

v4.3

*Critical* FSM would not exit due to FSM condition states hating OR (||) and would loop forever causing poor performance over time and setPOS errors

Added debug switches for cache start/stop/unit died while cached/synced TL. Baretail Arma's RPT file in \AppData\Local\Arma 3\*.rpt

Download

---------- Post added at 11:07 PM ---------- Previous post was at 10:55 PM ----------

Just now reuploaded as file was corrupted during upload.

This may fix the stuttering issue as you won't have "OVER_9000.gif" FSM loops running over time, let me know.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Very nice, script solution is working great. Thank you zorrobyte!

Share this post


Link to post
Share on other sites

zorrobyte

regarding TPW air, and cache veihicle distant,mine was left at default values.

Havent had time since to load up arma and try new update.

However i did want to pose a question....

Is it ok while using this cache system to also manually via 2D editor show/hide units?Will it even work correctly?

Issue is,if i have AI armour in an area,and jets in mission,i dont want the jet to spot that armour with the driver in,and engage as that armour has a wp for later in said mission

Share this post


Link to post
Share on other sites
Is it ok while using this cache system to also manually via 2D editor show/hide units?Will it even work correctly?

Issue is,if i have AI armour in an area,and jets in mission,i dont want the jet to spot that armour with the driver in,and engage as that armour has a wp for later in said mission

Of course! All you need to do is put this in one unit of each group's init line and ZBE_Cache will ignore it:

(group this) setVariable ["zbe_cacheDisabled",true];

Then you can run any hide/show commands you like on those units, just as if you weren't running ZBE_Cache

Very nice, script solution is working great. Thank you zorrobyte!

I'm humbled, thank you Jigsor!

Share this post


Link to post
Share on other sites

Hi Zorro, your Mod looks and work great for our coop missions, thank you for your work.

I have a little question about the "disableSimulation" feature from empty vehicles: it is possible to do this on "empty" Objects like tables and chair (etc), too? Our main Base on Celle2 have about 300 Objects for ambient object placement and the server performance in some small maneuvers is pretty poor because of that. What do you think about it?

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

×