Jump to content
zorrobyte

ZBE_Cache AI & Vehicle caching script/addon

Recommended Posts

Thanks to you for your dedicated work and ideas. I think that you are the only one approaching the idea of caching using hideobjects instead of deleting units.

Which makes me think...why?

For now it's working quite well, so we will have to see in the future.

BTW, still dunno why my allied IA is not being cached.

  • Barely any performance drop (and this was for the unoptimized older version): "ZBE 144 Groups, 1145 Units, 17 NoCacheFPS, 51 CachedFPS, 59 DeletedFPS"
  • enableSimulation "saves" unit loadout, isn't spawned with default gear with full ammo when unit deleted/respawned
  • Much greater compatibility with other addons, scripts and missions. HETMAN for example would take a dump due to morale calculations if units were deleted/respawned as in DAC for example
  • Less netcode impact in MP (assumed)
  • Less stuttering on clients as unit models don't need to be reloaded when units spawned (assumed)
  • Provided opportunity to have A3 feedback resolved improving peformance for everyone http://feedback.arma3.com/view.php?id=18734 and http://feedback.arma3.com/view.php?id=18451

As for your allied AI not being cached, set your cache distance to 10 and spawn you and one group in the editor to test. Allied AI are uncached within cache distance of players as to provide immersion.

BTW2 Notepad++ it's quite a good editor, but when managing multifolder/files projects I feel it lacks of functionality compared to the BI editor /Poseidon Tools.

For example, it comes with a handy "search in folder", which made the change from SetPosASL to SetPos easy and fast.

I have both tools, thankfully Notepad++ also has a find in folder option. I've been using Notepad++ for so long that it's second nature but do enjoy Poseidon.

Hideobject isn't that relevant when it comes to caching, especially for MP, as it's the CPU-heavy tasks which will tank perfomance. Disabling simulation and AI or deleting/restoring AI are still the best options here.

You know, if cached and player sees the units wouldn't it be better if they saw the whole group and knew the force strength? Hideobject was helpful in old versions as the group's units were cached and not setPos to the leader until uncached and players could run across a "zombie" group of AI that are far from the leader. Now that units setPos to leader every second, I can remove the hideobject.

As cached AI can still take damage and the recommended cache distance is 1000m, sniping AI at 1001m shouldn't break immersion that much.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Well...then I dunno how to setup a folder/project in notepad XD

Share this post


Link to post
Share on other sites
Well...then I dunno how to setup a folder/project in notepad XD

I don't think the functionality is in by default, or at least not as extensively as it is in Sublime. But there's a ton of extensions for np++ which add all kinds of functionality, including a project/folder-tree

Share this post


Link to post
Share on other sites

Also, reading your post on arma3 feedback, and your reasons on using local commands only..

You could still go with two versions. Make server and clients disable simulation hide objects etc....

and make ONLY server to setPos of units when they uncache. Less network packets, and no discrepancies in position (should be?). Though, more complex too.

Share this post


Link to post
Share on other sites
Also, reading your post on arma3 feedback, and your reasons on using local commands only..

You could still go with two versions. Make server and clients disable simulation hide objects etc....

and make ONLY server to setPos of units when they uncache. Less network packets, and no discrepancies in position (should be?). Though, more complex too.

Could do that however would still have to account for the addon/script differences as the addon may or may not be ran on clients. Having it set to isServer using enablesimulation global simplifies code and end user experience and should end the confusion over the script vs addon version.

---------- Post added at 05:23 PM ---------- Previous post was at 05:06 PM ----------

v4.4b

Changelog

  • Changed setPosASL back to setPos so units don't uncache outside buildings unexpectedly thanks to Zriel
  • Improved debug readability thanks to whiztler
  • Changed debug loop condition thanks to Pepe Hal
  • Removed "Dedicated/Client" FSM segementation and now only using a single FSM for all as setPOS ran from multiple machines causes mayhem thanks to Zriel
  • Stopped calling for map center's POS every loop thanks to Pepe Hal
  • Empty vehicle caching is now called from isServer using enableSimulationGlobal
  • Removed hideObject as no longer needed as units setPos to leader when cached
  • Changed zbe_centerPOS function to one time call instead of function
  • ZBE_Caching to ZBE_Cache for consistency
  • There is now no difference between the addon vs script version and addon only needs to be ran on server
  • CBA is no longer required, ever

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Better than a spawned if for everyone and then checking inside for:

if (isServer) then { [zbe_aiCacheDist, _x, zbe_minFrameRate, zbe_debug] execFSM "zbe_cache\zbe_aiCaching.fsm";};

Should be better an initial

if !(isServer) exitwith {};

which makes clients exit, less code run for them, less conditions checked in the main.sqf

Aaaand, looking in the code of F3, a clever idea.

if (!isNil "zbe_runonce" || {zbe_runonce}) exitWith {};
zbe_runonce = true;

Which would made the script only execute once.

Edited by Zriel

Share this post


Link to post
Share on other sites
Better than a spawned if for everyone and then checking inside for:

if (isServer) then { [zbe_aiCacheDist, _x, zbe_minFrameRate, zbe_debug] execFSM "zbe_cache\zbe_aiCaching.fsm";};

Should be better an initial

if !(isServer) exitwith {};

which makes clients exit, less code run for them, less conditions checked in the main.sqf

Aaaand, looking in the code of F3, a clever idea.

if (!isNil "zbe_runonce" || {zbe_runonce}) exitWith {};
zbe_runonce = true;

Which would made the script only execute once.

http://media.giphy.com/media/1hcQCVmnMDkQM/giphy.gif

I need to find an end user GIT update utility that can automatically pull from GIT with minimal GUI directly to the addon directory. Wouldn't that be sweet?

In all seriousness, thank you! I will implement the changes sometime soon.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

XDD I have started coding SQFs like a month ago just for fun and profit of my community, and working on an IT support service leaves long waiting timespawns to check things. F3 framework has some good ideas (like the nametags script or spectator script, late one really difficult to found a good working one).

Also, reading the documentation from Zen Framework has teached some good things on how to make things (he is focusing on a framework that works serverside only, and documentation is...well, best one I've ever seen, at least for a usermade project (out of Linux "man or Microsoft technet)).

And of course lots of forums posts, other missions, BIS wiki....

Share this post


Link to post
Share on other sites

Thank you for this BIG CHANCE in running Requirements!!! Using it now with "performance binary V3" and the Server rolls like a Charm! Just simply LOVE IT!!!

Hows your progress with "empty Objects" ? :P ( just a joke ;-) Do your thing )

Share this post


Link to post
Share on other sites
Hows your progress with "empty Objects" ? :P ( just a joke ;-) Do your thing )

Should be next after I change the vehicle caching FSM condition over to the performance variant :cool:

Share this post


Link to post
Share on other sites

Thanks for informing us about the updated version :cool:

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

Changelog

V4.4c

  • Added per vehicle type caching distance setting (Car,Air,Boat)
  • Fixed missing }; for script version
  • Don't forget to update userconfig if using addon!

I've asked armaholic to redirect download link to the https://bitbucket.org/zorrobyte/zbe_cache/downloads for always the latest version and less work on their end ;)

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Just wondering if there is a way to determine the size of the Island used so the script only needs to scan an exact area. In case of Stratis for example, 25000 is overkill. Perhaps init the island size at start?

Share this post


Link to post
Share on other sites
I've asked armaholic to redirect download link to the https://bitbucket.org/zorrobyte/zbe_cache/downloads for always the latest version and less work on their end ;)

Wish granted....yet as explained adding a downloadlink is like no work at all.....I need to update pages (news/download) with each release anyway. But I just saved me 5 seconds so I go to bed early tonight :yay:

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

Bugfix

zbe_allVehicles = count (_assetsboat + _assetsair + _assetscar);

for

sleep 15;zbe_allVehicles = count _assets;

Go to bed! XD

Share this post


Link to post
Share on other sites
Bugfix

zbe_allVehicles = count (_assetsboat + _assetsair + _assetscar);

for

sleep 15;zbe_allVehicles = count _assets;

Go to bed! XD

There are now 3 variables; _assetscar, _assetsair, _assetsboat. One for each type of vehicle.

What you DID help point out is that I'm still using zbe_allVehicles = count _assets; and _assets is nothing. Thankfully it's not erroring out and just causing All Vehicles to report 0 in debug which is so minor it isn't worth doing an update for by itself.

I'm going to take a break for a short while to work on another project to let this one simmer for a bit. Also the holidays are around the corner.

Just wondering if there is a way to determine the size of the Island used so the script only needs to scan an exact area. In case of Stratis for example, 25000 is overkill. Perhaps init the island size at start?

CPS (script load) is damn near native to FPS in my testing. nearEntities is also quite fast. There may be a better way to write the check, I'll put it on the backburner.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Sorry bro...XD

Original. main.sqf line 6

zbe_vehicleCacheCar = _this select 3;
zbe_vehicleCacheAir = _this select 4;
zbe_vehicleCacheBoat = _this select 5;

Should be (the ones being called in reality)

zbe_vehicleCacheDistCar = _this select 3;
zbe_vehicleCacheDistAir = _this select 4;
zbe_vehicleCacheDistBoat = _this select 5;

Share this post


Link to post
Share on other sites
Sorry bro...XD

Original. main.sqf line 6

zbe_vehicleCacheCar = _this select 3;
zbe_vehicleCacheAir = _this select 4;
zbe_vehicleCacheBoat = _this select 5;

Should be (the ones being called in reality)

zbe_vehicleCacheDistCar = _this select 3;
zbe_vehicleCacheDistAir = _this select 4;
zbe_vehicleCacheDistBoat = _this select 5;

Fixed, on the download link, was critical. From now on, I'm going to break out a BETA branch on GIT and only release once tested. Anyone who wants bleeding edge, follow the commit trail HERE and download the latest version from the download page. I will try to keep from spamming changelogs here and do batches.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Changelog

v4.5b

Readded hideobjectglobal as if not when hits FPS limiter then cached units will glitch around

Fixed empty vehicle arrays, now FSM only runs one time per vehicle instead of spamming FSM loops constantly

Tabbed files

Fixed allVehicle count

Slight debug hint change

unrelated.jpeg

Share this post


Link to post
Share on other sites

On main.sqf

you should delete the

if (is server) then [....

statements in caching. They are unecesary with the initial

if (!isServer) exitwith.

Nothing apart from the server should be executing those, so the comprobation is an extra overhead.

---------- Post added at 11:27 ---------- Previous post was at 10:45 ----------

Wtf....???

There's a strange issue. If I set up aiCache on 1000 m, allied forces do not cache. never.(or at least not in indicated distance)

If I setup 100m, they cache and never uncache. even at 5 meters.

Only happens with allied, enemy forces work correctly.

---------- Post added at 11:30 ---------- Previous post was at 11:27 ----------

Also, count vehicles also counts objetcs like toilets or cones...never thought a toilet was a vehicle XDD

You should count your assets, should be better reflection.

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

×