Jump to content

Recommended Posts

uKUIl9G.jpg

AI drivers on Stratis with AI Driving Control.

 

AI Driving Control v2.5.1

Download:

Google Drive: https://drive.google.com/open?id=14DR37WdYtt5F-5Xvl_i-ax7EuQ3cgqa2

Armaholic: http://www.armaholic.com/page.php?id=35146

 

Author:
RCA3

 

Description:
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.

 

Features:
AI will brake and speed up for vehicles ahead.
AI gives way to vehicles approaching from the right.
Pedestrians have priority over vehicles.
Pedestrians on road are overtaken or followed if directly in front of vehicle.
Infantry (not civilians) offroad will be followed on a wider angle than on roads.
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") 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 ("Land_BarGate_F") are made indestructible (by tanks as well unfortunately).

 

Usage:
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.

Does not cause dependency on missions.

 

Notes:
Vehicles moving over ~80Km/h will not have time to react. Use "car limitSpeed 80".
Any forceSpeed command (on affected land vehicles) will be overwritten by script.

 

Known issues:
When confronted with large groups of pedestrians, vehicles occasionally  stall.
Quadbikes are not detected by other vehicles on road (@BI: they always report "isOnRoad false"). Are detected offroad.
Something is wrong with tanks: ~10 tanks overloads the script, ~5 seems fine. Further testing denied this. Thanks to kremator.

Does not work on ALiVE vehicles.
Incompatible with TPW SANITY (uses forceSpeed as well).

 

License:
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.
No Derivatives - If you remix, transform, or build upon the material, you may not distribute the modified material.

 

APL-ND.png

Arma Public License No Derivatives (APL-ND)
https://www.bohemia.net/community/licenses/arma-public-license-nd

 

Credits:
Bohemia Interactive
BI Arma Forum Contributors
Wikipedia
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

 

Thanks to:
Armaholic.com

Mondalkb 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.

 

Media:

Spoiler

AI Driving Control v2.5

 

AI Driving Control v2.4 (vehicles only)

 

AI Driving Control v2.4 (vehicles with pedestrians)

 

AI Driving Control v2.4 (pedestrians only)

 

Vanilla AI

 

AI Driving Control

 

Vanilla AI

 

AI Driving Control

 

Changelog:

Spoiler

v2.5.1 - Fixed: Animals were still being evaluated.
                Tweaked: Minimum scan radius reduced from 50m to 25m.
                Tweaked: Minor tweak to "bounding box" search.

 

v2.5 - 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.

 

v2.4.1 - 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.

 

v2.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.

 

v2.3.1 - Hotfix: FSM was running on every vehicle's passenger.

 

v2.3 - 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.

 

v2.02.2 - Hotfix: Vehicles weren't resuming after opening gates.

 

v2.02.1 - 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.

 

v2.02 - Changed: Reverted to civilian vehicle convoys offroad being possible as of v1.01. 15 meters width (overtake) buffer for all vehicles.

 

v2.01.3 - Fixed: Minor fix where offroad vehicles could be following without proper angle.

 

v2.01.2 - Fixed: On road vehicles were following offroad vehicles.

 

v2.01.1 - Tweaked: Applied Pythagorean theorem to civilians buffer. It's a safer distance.

 

v2.01 - 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.

 

v2.0 -  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.

 

v1.02 - Tweaked: Code optimized from ~0.49ms to ~0.38ms for 10 men/cars scan.
               Added: Maintain speed of front.
               Tweaked: Buffer width is now 15 meters on and offroad except for civilians. Offroad mil vehicles keep convoy, civs are overtaken.
               Added: Demo missions.

 

v1.01 - Tweaked: Wider offroad buffer now affected by military personnel only.

 

  • Like 16

Share this post


Link to post
Share on other sites

This is fantastic RCA3 !

 

Thank you very much for sharing !  :thumbs-up:

  • Like 3

Share this post


Link to post
Share on other sites

What makes it incompatible with ALiVE?

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
On 5/23/2019 at 11:49 PM, JD Wang said:

What makes it incompatible with ALiVE?

 

Good question.

I tried running Alive and see if vehicles picked up the script, and they did, but they would close it almost immediately.

If you know how to run init vehicle code particularly on Alive vehicles or you know how Alive vehicles can run permanent while{alive}do{} loops, please let me know. Thank you.

 

Edit:

Changed "incompatible" to "Does not work on ALiVE vehicles." since you may still use your own vehicles.

Edited by RCA3
Changed Known Issues ALiVE note
  • Like 1

Share this post


Link to post
Share on other sites

This seems to be working very well.  I run several repeatable SP games, more than half involving road marches of BTRs and T-72s, and I can see a definitive improvement in road march behavior.  The AI also moves itself, so it will be interesting to see if all AI controlled enemy QRFs arrive safely to  the area of operation.

 

Well done.

  • Like 2

Share this post


Link to post
Share on other sites

Changelog:

v2.0 -  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.

 

I had to change the addon name because I believe people were coming here looking for something else.

  • Like 2

Share this post


Link to post
Share on other sites

Changelog:

v2.01 - 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.

  • Like 2

Share this post


Link to post
Share on other sites

Changelog:

v2.01.1 - Tweaked: Applied Pythagorean theorem to civilians buffer. It's a safer distance.

  • Like 2

Share this post


Link to post
Share on other sites

@RCA3 Thanks for your efforts. Incidentally, any chance you could upload this to Steam's Workshop?

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, domokun said:

@RCA3 Thanks for your efforts. Incidentally, any chance you could upload this to Steam's Workshop?

You're welcome. No Steam, sorry.

 

7 hours ago, otarius-big said:

will it works side mods ai?

I think you mean all the AI combat enhancement mods/addons;  I believe you'll have no problem using them together.

 

- -

 

Thank you to everyone supporting me so far. Thanks to Foxhound for the Armaholic page.

 

v2.01.3 is out.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Interested in trying this but the readme states that there is an issue with tanks? Could you please elaborate?

  • Like 2

Share this post


Link to post
Share on other sites
12 hours ago, arma131 said:

Interested in trying this but the readme states that there is an issue with tanks? Could you please elaborate?

"Something is wrong with tanks: ~10 tanks overloads the script, ~5 seems fine. "

 

Try it out, if it overloads (drastic FPS drop) reduce number of tanks.

Can't tell you exactly why this happens. I know it doesn't happen with other vehicles, APC's, etc.

  • Like 1

Share this post


Link to post
Share on other sites

Changelog:

v2.02 - Changed: Reverted to civilian vehicle convoys offroad being possible as of v1.01. 15 meters width (overtake) buffer for all vehicles.

 

- -

 

Thought about it and realized it would be better (humanitarian convoys, etc). Sorry for the constant updating. This should be the last one unless something unforeseen comes up.

  • Like 3

Share this post


Link to post
Share on other sites

OMFG RCA3 ... you have done something that even BIS cannot do ... SORTED AI DRIVING !  What kind of friggen magic is this ?  I watched as trucks FAILED to run over friendlies, FAILED to crash into objects, FAILED to crash into walls ..... this is not the BIS way 🙂

 

For the love of all things sacred .. please keep working on this!

  • Like 3
  • Thanks 1
  • Haha 1

Share this post


Link to post
Share on other sites

 

5 minutes ago, kremator said:

OMFG RCA3 ... you have done something that even BIS cannot do ... SORTED AI DRIVING !  What kind of friggen magic is this ?  I watched as trucks FAILED to run over friendlies, FAILED to crash into objects, FAILED to crash into walls ..... this is not the BIS way 🙂

 

For the love of all things sacred .. please keep working on this!

 

Agree totally ^^^  Very nice work

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

@kremator @Rockapes You're too kind, literally:

 

On 6/8/2019 at 11:55 PM, kremator said:

I watched as trucks FAILED to run over friendlies <- - - That's me.

FAILED to crash into objects, <- - - That's luck!

FAILED to crash into walls <- - - That's luck!

😄😄😄 I'm just scanning for cars and men.

 

On 6/8/2019 at 11:55 PM, kremator said:

this is not the BIS way 🙂

I know you're joking but Bohemia did improve on AI driving back in 2016ish swerving off things and are still improving as of last week.

 

On 6/8/2019 at 11:55 PM, kremator said:

For the love of all things sacred .. please keep working on this!

Thanks, I'll do my best although this is pretty much at the peak of my capabilities. :tounge:

  • Like 1

Share this post


Link to post
Share on other sites

@arma131

"Something is wrong with tanks: ~10 tanks overloads the script, ~5 seems fine."

 

I'm not so sure about this one anymore. Last testing wasn't as bad as before and I think it could have to do with my PC to begin with.

 

If someone could confirm or deny this issue would be awesome.

 

Here's a test mission with 10 tanks:

https://drive.google.com/open?id=1iR9Fv7Ff9RCUTG4IO_iYw-cCja8c38-c

  • Like 1

Share this post


Link to post
Share on other sites

Testing now.

 

EDIT:  Not seeing any problems so far.

 

EDIT2:  A proper test would be 5 tanks approaching another 5 tanks.   Just added 5 more tanks into the mix, going to opposite way.  Mod handled it pretty well..... unforunately bloody stupid Physx ended with some tanks in the air or on their sides!

  • Thanks 1

Share this post


Link to post
Share on other sites

@kremator

Thanks bro!

I'll strike that issue now.

 

Cheers!

Share this post


Link to post
Share on other sites

Is there anything you can do to fix the 'crash, interminably long pause, reverse in the wrong direction, recrash, anothre long pause, reverse in EXACTLY the same way as before, crash ...... etc' ?  I suppose I'm asking if there is a way to detect vehicle crashes.

 

Checked the mod on a dedi server (not fully optimised) and it does improve things .. but needs a little more tweaking I guess

 

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, kremator said:

Is there anything you can do to fix the 'crash, interminably long pause, reverse in the wrong direction, recrash, anothre long pause, reverse in EXACTLY the same way as before, crash ...... etc' ?  I suppose I'm asking if there is a way to detect vehicle crashes.

 

Checked the mod on a dedi server (not fully optimised) and it does improve things .. but needs a little more tweaking I guess

 

Ok, what's not fully optimized, the addon or the server? Where do you see tweaking being needed?

 

As for crashie... I ain't even touching that. All I do is apply brakes and restore speed if there's someone/thing ahead or not. The long pause can be the script preventing move, or the game itself finding new paths. One note though: scans are all made from the front (hood) of the vehicle, so anything behind that isn't detected (e.g. like reversing on top of a man).

 

I'm guessing you're getting those results on the Altis test or somewhere where the road isn't very wide. As a rule of thumb give vehicles as much space as you can. Account for the vehicle types you're using and a realistic path for them.

 

Edit:

I did try and change timeout values with AICarSteeringComponent from https://forums.bohemia.net/forums/topic/191515-ai-driving-feedback-topic but without success. Maybe someone can build a patch with better values to complement my addon (specifically longer timeouts I find would be useful).

Share this post


Link to post
Share on other sites

Someone needs to write a pedestrian script where after the first person gets run over by a giant military truck the rest get the heck off the road. I understand the frustration of your own infantry getting run over by your own vehicles when in column but when civilians stroll down the road and refuse to get out of the way of traffic even after someone has been killed is ridiculous.

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, dr@gon said:

Someone needs to write a pedestrian script where after the first person gets run over by a giant military truck the rest get the heck off the road. I understand the frustration of your own infantry getting run over by your own vehicles when in column but when civilians stroll down the road and refuse to get out of the way of traffic even after someone has been killed is ridiculous.

There surely must be a way to check if people are walking/running towards a moving vehicle and redirect them a few metres away from that danger (apart from then loading etc)?  

 

 

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

×