Author: Naught
Author Website: http://www.unitedoperations.net

Requirements: Community Base addons

Version: 1.0.2.4

Short description: An SQF script designed to dynamically cache and distribute AI units across machines for maximum performance.

Date: 2014-01-28 08:13


Comments: (4)
Rating:



 



AI Caching and Distribution

by
Naught


Description:
An SQF script designed to dynamically cache and distribute AI units across machines for maximum performance.

This script will be my first fully-autonomous script, meaning no setup required! This script is completely plug-and-play, with no dirty work required. It will cache all AI units and spawn them when players get close to them, and will automatically distribute AI across multiple headless clients. And the best part is is that you can still use your current method of AI spawning, whether it's through the editor or via a script. The only requirement is making a headless client slot, which is very simple and shown below.

Now mission makers who have been too intimidated by the script knowledge needed to make headless client or cached/respawning AI missions can utilize all of the performance benefits that it brings with them! Even users who already have implemented headless client will benefit from the script immensely due to the pure efficiency of it's caching and distribution mechanisms, which are much better than most which are already implemented in missions.

Note: This script is in beta, so expect some possible flaws/errors/etc, they may even be game-breaking. Also it's only been tested in Arma 2 OA (although nothing should be broken in Arma 3). Remember to test first!


Features:
  • Fully plug-and-play, simply drag-and-drop the script into your mission and it autonomously works its magic.
  • Works with nearly all AI spawning scripts on any machine.
  • Caches AI units, meaning all units but a group's leader (configurable in config.sqf) are saved and deleted, and then respawned when players get close.
  • Dynamically allocates units to headless clients, meaning that if headless client(s) are available, it will transfer AI to them. If any HC's are open, the server won't process any AI. And it does all of this automatically.
  • Fully configurable caching settings in the config.sqf, including some experimental vehicle caching (not currently recommended).
  • Built using my new Object-Oriented-Programming (OOP) framework for high-performance OOP code.
  • Built for speed and performance.

Installation:
Drag and drop into your mission directory.

github:
- Github Page


Usage:
None, the script is fully autonomous! Options are available in the config.sqf file.


Media:
Example Headless Client Configuration:



Known Issues:
- AI unit caching may not be compatible with script which count AI, like end-scripts. An easy fix would be to end the mission on the absence of all AI, and not a percentage.
- AI unit caching doesn't work well with AI vs AI scenarios, and shouldn't be used unless players are always in close proximity to the action.
- Has a CBA dependency for the reliable CBA_fnc_players and the even better XEH.
- AI distribution may break scripts which modify AI behaviour (such as UPSMON). To fix this, an advanced user may use the "CACHE_UNIT_SPAWN_FNC" definition to define a function to load and process on every cached unit spawn, such as this (where "MY_fnc_unitSpawn" contains code with differentiates between vehicles and units and runs scripts accordingly):
{_this call MY_fnc_unitSpawn;} // _this == _spawnedObject

Issue tracker:
- Issue Tracker


Notes:
This is a full-release, but does not contain a guarantee of any type of support.
Bugs and other issues should have been found and patched through testing, but are still possible in the RC. If you find one, report it back in this thread or on the Github issues page.
This release candidate has been deemed stable enough to be used in production environments. Proceeding v1.0 updates should be sparse, should contain nothing major, and should not be mandatory.


Credits & Thanks:
XEH creators for making this possible!


Change log:
1.0.2.4
- [FIXED] Crewed vehicles retain their states over caching and distributions.
- [FIXED] Units now properly retain set positions if specified before caching/distribution.
- [FIXED] Vehicles are no longer distributed (needless operation).
- [FIXED] Setting of vehicleVarName should now propagate to all machines.
- [FIXED] Renamed array manipulation function to match syntax (minor edit).

1.0.2.2
- [FIXED] AI no longer flee when their group is cached (work-around).
- [FIXED] Library linkages now correctly handle others' exceptions.
- [FIXED] 'No entry in CfgMagazines ...' error has been fixed (due to currentMagazine command).
- [FIXED] Rewrote the caching functions to check for all exceptions at the correct points.

1.0.1.8
- [FIXED] 1.0.1.7 regression which caused caching checks to spin infinitely.

1.0.1.7
- [FIXED] Units' volatile shifts to leadership are now accounted for while caching.

v1.0.1.6
- [FIXED] Possible error in config.sqf with wrong types.
- [FIXED] Enabled CBA caching of static files for release version.

v1.0.1.5
- Initial Public Release

Forums Topic:
- United Operations Forums
- BI Forums



Arma 2 usage:
- Community Base addons

Arma 3 usage:
- Community Base addons A3




Enable javascript to be able to download from Armaholic please!



Tags: Ai,   Cache,   Distribution