Jump to content
zorrobyte

ZBE_Cache AI & Vehicle caching script/addon

Recommended Posts

So this script works with MCC/Zeus and AI Script/mods like ASR_AI / Gaja / Upsmon?

It should work with any script/mod as the units are "frozen" and hidden instead of deleted/respawned. Scripts/mods will still issue waypoints, commands and so on for the cached units. What sets this caching script apart from others is that one unit from the group (the TL) stays uncached and continues on his merry way so with HETMAN/Gaja/Upsmon,etc the group continues to follow waypoints leading to a seamless experience.

Here is a (lower quality, sorry) video showing just how it works.

http://youtu.be/ZF8RLjSl_tU

Thanks zorrobyte for this script!

Anything that can help performances is more than welcome.

I gave it a try last night and it seems to be working flawlessly!

EDIT : One small advice though, you could make your loops run even faster by using "pushback" whenever you need to add a new element to an array.

According to the wiki, the speed gain is up to 11843% (!) ;D

Thank you for the feedback, I'm happy you are enjoying the script! I've been away from Arma for some time, was waiting for HC and COOP performance to come back. I'm really impressed with the progress BIS has made over the past year and it's great they are/will be focusing on clientside/COOP performance.

I didn't know about pushback command, I appreciate you mentioning it! Anything that can keep the script lightweight is awesome as I want it to be as quick as it can for those heavy load missions.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Thank you for continually improving this useful script, could we have an addon version in the future?

Share this post


Link to post
Share on other sites

Eventually, yes. I want to be sure it's completely optimized and bug free before compiling another addon. A week or so?

I'd like to migrate the SQF allGroups check to per group FSM for performance and so it will further avoid impact on SQF execution (not that it is an issue now).

As for the next uncached TL teleporting around issue, I just figured it out. I believe what I'll do is force the group to uncache if the TL receives damage, this will put the group back in formation instead of uncaching the next TL (and group) wherever the group cached on last cycle. Although I think rare to occur, would be useful of a cached group's TL gets killed in an arbitrary manner such as artillery fire, sniper fire received from outside cache range, etc.

EDIT

Well that's sweet! FSMs is much snappier and with the TL damage check, the group uncaches (I set to 30 seconds) which is enough time for the group medic to heal the TL.

Edited by zorrobyte

Share this post


Link to post
Share on other sites
Eventually, yes. I want to be sure it's completely optimized and bug free before compiling another addon. A week or so?

I'd like to migrate the SQF allGroups check to per group FSM for performance and so it will further avoid impact on SQF execution (not that it is an issue now).

As for the next uncached TL teleporting around issue, I just figured it out. I believe what I'll do is force the group to uncache if the TL receives damage, this will put the group back in formation instead of uncaching the next TL (and group) wherever the group cached on last cycle. Although I think rare to occur, would be useful of a cached group's TL gets killed in an arbitrary manner such as artillery fire, sniper fire received from outside cache range, etc.

EDIT

Well that's sweet! FSMs is much snappier and with the TL damage check, the group uncaches (I set to 30 seconds) which is enough time for the group medic to heal the TL.

It's still not bugfree I'm afraid. It's still teleporting Ai units randomly.

Edit: It seems to only teleport AI units which are using BIS_fnc_ambientAnimCombat & BIS_fnc_ambientAnim,although, I'm not 100% sure about that. Would it perhaps be possible to add an option,which allows us to choose, whether AI units or empty vehicles or both should be cached.

Edited by R3vo

Share this post


Link to post
Share on other sites

Please zip the mission you are using and Pm me a dropbox link or the like, this could be due to script load and delay. Unsure as of yet, would be very helpful! This goes for anyone who is experiencing the *random* unit teleport issue as I have been unable to duplicate.

The codewhich moves the units back to the TL:

_x setPosATL (formationPosition _x);

Wow thanks R3vo! I saw that the animations were going nuts when one goes outside and back into cache range. While I'm working on the FSM port, replace the main.sqf with this for a fix:

http://pastebin.com/U4qbrQjJ

As for the "rubber banding" when the AI group members uncache and setPos back into formation (in certain behaviors it seems), I'm afraid there isn't a fix for that. As typical caching distance is 1000M and the rubber band effect is only for a few milliseconds (and the AI quickly get back into formation), it shouldn't be a huge deal. Aware behavior don't seem to rubber band as much or if at all.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Looking forward to an updated addon version ... looks like this may be a real winner. Good work ZB !

Share this post


Link to post
Share on other sites

is it normal that AI when meeting other ai in cache state,ONLY have squad leader at position,and the rest of squad still further away.

Let me explain:

A squad ran from molos town,to molos airport,cache distance 20meters for test.so when leaving molos town,the group except leader got cached,when the leader reached the airport,and engaged another cached enemy group,only squad leader was there.Rest of squad were still at molos townand then the next leader in the group started waypoint towards molos airport(airfield),he died,and process repeated untill all group members were dead.

Is it meant to be like that?I was expecting the entire group to uncache when engaged with enemy.

Share this post


Link to post
Share on other sites

No, the uncached group members are supposed to uncache in formation with the TL as seen in the video. I'm working on a FSM rewrite now that should address the problem.

Share this post


Link to post
Share on other sites

It's working *zoinks*

e4VWfW0.png

I'll have a configuration option for at what FPS the caching module starts working. Having everything uncached and working vanilla until FPS drops below X for zorrobyte to kick your PC in the pants sounds pretty awesome right? Also, only as many AI that are needed to be cached will at any given time. I could use this as a "performance metric" and spam it somewhere so if you see 100% of your AI getting cached at a 20FPS target on dedicated, you know your mission needs optimization.

Edited by zorrobyte

Share this post


Link to post
Share on other sites
I'll have a configuration option for at what FPS the caching module starts working. Having everything uncached and working vanilla until FPS drops below X for zorrobyte to kick your PC in the pants sounds pretty awesome right?

Sounds fab!

Share this post


Link to post
Share on other sites

v4 WIP showing that groups can be cached/uncached using setvariable and that cached units can still take damage (useful for arty in the AO, etc)

This is running on FSM.

http://youtu.be/kq-7tolEB3w

Please PM me if you'd like to test the WIP v4.

What's not in the WIP (currently working on):

Optional clientside objectviewdistance based on client FPS with a max set to caching distance (so players don't see AI uncache) and to help client FPS

Possible auto cache distance for AI depending on server FPS (maybe..)

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Currently working on:

Optional clientside objectviewdistance based on client FPS with a max set to caching distance (so players don't see AI uncache) and to help client FPS (done - tweaking now and yes, FSM)

Optional auto cache distance for AI depending on server FPS (if feasible.) - would need to PVAR zbe_aiCacheDist for clients to adjust auto objectviewdistance FSM. Maybe in a future version, would need tested.

Done spamming updates for now, it's 2am and time to sleep.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

My test failed, used: addon version

Like mentioned i tried to use it in WholeLottaAltis, Enemy AI started to teleport after a couple of minutes, movement of them looked like hard desync.

:(

Share this post


Link to post
Share on other sites
Guest

Thank you very much for sending us 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

Zarrobyte

cached groups which move,ignore full speed movement orders,walking with weapons up only,until uncached.If they re cache again,the resume weapons up slow slow pace.

Tested using MCC,and viewing units through PIP via mcc console

Share this post


Link to post
Share on other sites
My test failed, used: addon version

Like mentioned i tried to use it in WholeLottaAltis, Enemy AI started to teleport after a couple of minutes, movement of them looked like hard desync.

I have failed to duplicate this behavior. What is your cache range? Does this happen on the edge of cache range or constantly? Was this on a dedicated server or running on your own PC? What was your PC's FPS when this happened? Are you using any other mods? What happens if you set your object draw distance to a bit lower than the cache distance?

If possible, a video of the behavior would be great!

Zarrobyte

cached groups which move,ignore full speed movement orders,walking with weapons up only,until uncached.If they re cache again,the resume weapons up slow slow pace.

Tested using MCC,and viewing units through PIP via mcc console

Ah yes, forgot about the _x setspeed full tweak. Will fix today.

Share this post


Link to post
Share on other sites

thanks Zorrobyte.works really well otherwise.How about crewed veihicles?Are the crew cached?

Share this post


Link to post
Share on other sites

Changelog:

v4.1

ZBE_Cache no longer uses setSpeedMode, the AI in your missions will proceed as your waypoints intend.

Changed setPos to setPos formationposition so group leaders move full speed (if speedMode "Normal"/"Full").

Changed zbe_setPos to zbe_setPosLight and zbe_SetPosFull. Light setPos formationPosition, Full setPos formationPosition with 3 second allowdamage false so units don't die on inclines when uncached.

zbe_aiCachingDedicated.fsm now uses disableai commands for additional performance savings. Client/Listen server does not as disableai can break animations

As a note if ran as an addon on server only, client's won't use empty vehicle caching. If your mission intends to have more then 100 empty vehicles, I strongly recommend using the script version

Download

thanks Zorrobyte.works really well otherwise.How about crewed veihicles?Are the crew cached?

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.

Edited by zorrobyte

Share this post


Link to post
Share on other sites
Changelog:

v4.1

ZBE_Cache no longer uses setSpeedMode, the AI in your missions will proceed as your waypoints intend.

Changed setPos to setPos formationposition so group leaders move full speed (if speedMode "Normal"/"Full").

Changed zbe_setPos to zbe_setPosLight and zbe_SetPosFull. Light setPos formationPosition, Full setPos formationPosition with 3 second allowdamage false so units don't die on inclines when uncached.

zbe_aiCachingDedicated.fsm now uses disableai commands for additional performance savings. Client/Listen server does not as disableai can break animations

As a note if ran as an addon on server only, client's won't use empty vehicle caching. If your mission intends to have more then 100 empty vehicles, I strongly recommend using the script version

Download

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.

Well done, zorrobyte. The teleporting issue seems to be fixed.

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

×