Date: 2020-09-06 12:02
Gives more control to AI drivers.
Script uses nearEntities to find vehicles/men, calculates relative angles to nearest one and applies forceSpeed depending on situation.
Use "STEALTH" behaviour to temporarily bypass the script.
AI will brake and speed up for vehicles ahead.
AI gives way to vehicles approaching from the right.
Pedestrians have priority over vehicles.
Pedestrians are overtaken or followed if directly in front of vehicle.
Works on and offroad.
Have less (not avoid) crashes.
Engines turn off on idle if at final waypoint.
Vehicles on "STEALTH" behaviour bypass code until behaviour changes (setBehaviour, etc.).
Bypass script entirely on a vehicle's init with "this setVariable ["NOAIDRIVINGCONTROL", true, true]".
For a convoy use "(object) limitSpeed (km/h)" on lead vehicle.
Gates ("Land_BarGate_F", "Land_BarGate_01_open_F" and "Land_RoadBarrier_01_F") are detected when closed. Note: place gates BEFORE AI driver gets in vehicle/spawn/zeus/etc. i.e. not scanned in realtime.
As a bonus, gates are made indestructible (by tanks as well unfortunately).
To install AI Driving Control you should use modfolders to keep it seperate from the official game content to prevent issues.
With Arma 3 you can use different ways to set up your modfolders to use custom content you have downloaded.
Please visit the Arma 3 Mod install instructions page for more information about using custom mods and addons in Arma 3.
For usage instructions and information of how to use AI Driving Control please refer to the included documentation and/or example mission.
Works with placed and spawned vehicles, single player and dedicated server.
Clients with AI drivers must be running the addon.
For Zeus, the player being Zeus must be running the addon.
<vehicle> setVariable ["AIDCBBOXWIDTHCOEF", <coefficient>];
Defines "bounding box" width, per vehicle, which detects men around and stops the vehicle. Where 1 = vehicle's width; 1.5 = default; 2 = default for tanks.
Smaller values improve overtaking men but run them over more often, higher values will be safer but will halt more often. More than default should not be necessary.
<vehicle> setVariable ["AIDCBBOXLENGTHCOEF", <coefficient>];
Defines "bounding box" length, per vehicle, which detects men around and stops the vehicle. Where 1 = vehicle's length; 1.5 = default.
<vehicle> setVariable ["AIDCCONVOYSEPARATION", <distance>];
Defines setConvoySeparation for each vehicle on AI led groups only. AIDC overwrites that command by default so if it is to be used it must be defined here.
Armaholic.com has its own Youtube channel where we will cover the Community made releases.
Subscribe to the Armaholic.com Youtube channel
When confronted with large groups of pedestrians, vehicles occasionally stall.
Does not work on ALiVE vehicles.
Incompatible with TPW SANITY (uses forceSpeed as well).
Any forceSpeed command (on affected land vehicles) will be overwritten by script.
Does not cause dependency on missions.
Credits & Thanks:
BI Arma Forum Contributors
BI Wiki Code Optimisation author(s) https://community.bistudio.com/wiki/Code_Optimisation
3 1 A Measure of Relative Direction https://www.youtube.com/watch?v=uDwP4T7bPSY
mondkalb and the Global Mobilization CDLC team for copy/paste of their EULA from https://steamcommunity.com/sharedfiles/filedetails/?id=1284731930
Kremator for testing with tanks
rubberkite for reporting issues and continuous support.
License / Disclaimer:
No Re-upload - You may not re-upload the content of this addon as a whole or any part of this addon, including Steam Workshop.
Non Military - You may not use the content of this addon as a whole or any part of this addon for military purposes.
No Monetization - You may not use this addon as a whole or any part of this addon on monetized servers.
Armaholic Only - The author grants permission to Armaholic (www.armaholic.com) moderators to upload and update the content of this addon.
Attribution - You must attribute the material in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the material).
Noncommercial - You may not use this material for any commercial purposes.
Arma Only - You may not convert or adapt this material to be used in other games than Arma.
Share Alike - If you adapt, or build upon this material, you may distribute the resulting material only under the same license.
Arma Public License Share Alike (APL-SA)
Fixed: Addon and script versions were initializing twice per vehicle! (Init EH and GetIn EH). Sorry about that. Script version also changed initPlayerLocal.sqf.
Added: "Motorcycle" class to addon version.
Added: CUP patch for some APC's not initializing on addon version ("CUP_LAV25_Base","CUP_BTR80_Base","CUP_BTR80A_Base","CUP_BTR90_Base","CUP_AAV_Base").
Fixed: Detect quadbikes.
Tweaked: "Bounding box" length default coefficient reduced from 2 to 1.5.
Tweaked: Following distance is dynamically calculated from followed car speed.
Fixed: Vehicle would halt/lose formation when too close to group leader. Fix #4.
Changed: Script version Zeus initialization to BIS_fnc_addScriptedEventHandler.
Tweaked: Minor tweaks and optimizations.
Fixed: problem moving after loading cargo, stuck on "bounding box" loop.
Fixed: Vehicle would halt/lose formation when too close to group leader. Fix #3. AI led groups only.
Fixed: Player led AI would return to formation after reaching destination since 188.8.131.52.
Added: Tanks now stop when men enter vehicle's "bounding box": setFuel workaround.
Added: Bypass enemy vehicles.
Added: Optional vehicle variable "AIDCBBOXLENGTHCOEF" to define "bounding box" length.
Added: Optional vehicle variable "AIDCCONVOYSEPARATION". AI led groups only.
Tweaked: Minor optimizations and tweaks.
Hotfix: Vehicle would halt/lose formation when too close to group leader. Fix #2.
Fixed: Vehicle would halt/lose formation when too close to group leader.
Added: Bypass pedestrians when on "STEALTH".
Tweaked: Minor optimizations.
Changed: License to APL-SA.
Changed: New key and key name (you may delete RCA3.bikey).
Fixed: Script version: wrong function passed to cfgremoteexec.hpp.
Removed: Script exit on vehicle damage (as long as driver is alive keep running).
Added: Close gaps to ~20 meters when vehicle ahead is stopped.
Added: Discriminate between friend or foe pedestrians (i.e. ignore foes).
Fixed: "Bounding box" loop would not exit for driver disembark, death or vehicle damaged.
[Warning] Changed: Script version makes use of remoteExec on zeus and optional spawns. Meaning client's AI will have controlled driving on non-locally created vehicles (same as in addon version). Read INSTALLATION.txt for new instructions.
Changed: Renamed functions main class.
- Tweaked: Oncoming traffic vehicle rotation is now < 30º, more is considered crossing. Gives vehicles more time to cross.
Tweaked: Followed vehicle's angle and rotation is combined to find following angle. It should reduce number of overtaking occurrences.
Tweaked: Smoothed slow down/speed up when following vehicles.
Tweaked: Minor tweak to vehicle versus men speed.
Tweaked: Scan radius.
Changed: Passed a few math operations to pre-processor #define.
Added: Optional vehicle variable "AIDCBBOXWIDTHCOEF" to define "bounding box" width.
Added: Detection of all three military gates "Land_BarGate_F", "Land_BarGate_01_open_F" and "Land_RoadBarrier_01_F".
Fixed: Animals were still being evaluated.
Tweaked: Minimum scan radius reduced from 50m to 25m.
Tweaked: Minor tweak to "bounding box" search.
Changed: Vehicle versus pedestrians speed is now dynamically calculated.
Removed: Pedestrians's military/civilian discrimination.
Removed: Pedestrians's on/off road discrimination.
Added: New server key.
Added: A 360 degrees "bounding box" around vehicle which detects pedestrians and stops the vehicle.
Tweaked: Increased/improved pedestrians overtake speed.
Tweaked: Minor tweak to scan radius.
Fixed: Gates being detected outside of range.
Fixed: Animals were being evaluated as men.
Changed: Script version installation and respective notes.
2.4 - Added: New timeout system which starts only if crossing vehicle ahead is not moving. Results in much smoother traffic.
Fixed: Oncoming traffic was being evaluated as crossing (delaying traffic). Oncoming traffic vehicle rotation is now <45º, more is considered crossing.
Released: Script version.
Added: New server key.
- Hotfix: FSM was running on every vehicle's passenger.
Changed: Passed main function and parts of code to CfgFunctions.
Changed: Code optimized when vehicle is stopped by vehicle/man ahead to ~0.19ms (benchmark) no matter how many vehicles/men around.
Changed: Optimized vehicles array sorting.
Changed: Vehicles stop on initialization while scanning for bargates.
Changed: Engine off on idle moved to separate FSM resulting on optimization to ~0.37ms (benchmark) for 10x men/cars scan.
Tweaked: Optimized main branch.
Fixed: On road vehicles were evaluating offroad vehicles.
Removed: Unnecessary BIS_fnc_getAngleDelta call removed.
Removed: Duplicated getDir removed.
Tweaked: Front buffer increased by 5 meters.
Tweaked: Give way right traffic timeout decreased back to 10 seconds.
Added: New server key.
- Hotfix: Vehicles weren't resuming after opening gates.
- Fixed: Vehicles relative position was being wrongfully checked according to their internal direction. Improves overall traffic and convoy behaviour.
Tweaked: Added one more distance check increasing pedestrians safety.
Tweaked: Give way right traffic timeout increased from 10 to 30 seconds.
Tweaked: Minimum scan radius increased to 50 meters.
- Changed: Reverted to civilian vehicle convoys offroad being possible as of v1.01. 15 meters width (overtake) buffer for all vehicles.
- Fixed: Minor fix where offroad vehicles could be following without proper angle.
- Fixed: On road vehicles were following offroad vehicles.
- Tweaked: Applied Pythagorean theorem to civilians buffer. It's a safer distance.
- Changed: AI tries to bypass civilians up until the last moment. Infantry are (still) followed at a more respectable distance.
Tweaked: Buffer width offroad is now 10 meters instead of 15 meters for infantry.
- Changed: Addon name changed from Road Control AI Addon to AI Driving Control.
- [Warning] Changed: Variable to disable script is now "NOAIDRIVINGCONTROL".
- Added: Scan radius is now dynamic with vehicle speed. Should increase performance.
- Fixed: Maintain speed of front.
- Wider offroad buffer now affected by military personnel only.
- BI forums