Author: Genesis92x
Author Website:

Requirements: No addons required

Version: 2.9.2

Short description: Redefining the CooP experience with a plug-and-play script package that uses FSM's and compiled code to make AI react in a more fulfilling way.

Date: 2017-09-28 19:14


Comments: (3)
Rating:



 



Vcom AI - Script

by
Genesis92x


Description:
Vcom AI aims to improve the AI’s combat abilities. This mod is not a miracle worker but attempts to create a CooP experience that is more dynamic and challenging than the traditional AI battles of ArmA 3.
Perhaps watch a video below and read the features to see if it is something you’d like to try out!

This is the first iteration of the new AI system...so expect bugs...I tried to test for them all, but I know I missed some. Thank you!


Features:
Configurable Varying AI accuracy
The AI’s accuracy can be easily configured depending on their rank level with the AIsetting.sqf or VCOMAI_DefaultSettings.sqf.
These options can also be modified on the fly to simulate all sorts of different enemy types.
This allows for a more customized experience on the battlefield.

AI Accuracy & Player Suppression
As the AI become more aware of the player’s position they begin to sight their weapons in and become more accurate.
Staying in one position for too long can be potentially dangerous if the engagement lasts for too long.

AI Communication
AI groups will actually communicate to each other when engaged with enemy forces.
It is up to the AI to respond in the way they see fit.

AI Use Of Cover
AI will more quickly run for cover instead of laying in the middle of an open road.
If an AI is caught off guard, and in the open, it may try to throw a smoke grenade and suppress before running to cover.

AI Area Avoidance
AI will attempt to avoid areas that their buddies have fallen in. This can prevent situations where AI would continually walk through a door with 30 dead bodies inside and the enemy camped inside.

Improved Flanking
The AI will attempt to flank the player from *good positions*.
This means they will try to prioritize good terrain/cover areas even if this means falling back.
AI will, if given the knowledge, chase players across the map if needed.
They will constantly hunt down the players if provoked.
AI Responsiveness

AI should respond to threats a lot more quickly, and take cover as a result.
If one unit in their squad takes fire they all will go into combat stance.
AI that engage and kill a target will scan the area before going back into safe mode.
They will not so easily/quickly go back into their default states as vanilla AI.
AI will respond to gunshots from a further distance and also be alerted by explosions or bullet holes.

AI Suppression
AI can become suppressed when taking too much fire.
Suppressed AI will attempt to find cover and use smoke to escape the fire.
If the AI are cornered they will simply try to kill the enemy, even if this means dangerously using a grenade in CQB.

Weapon Utilization
Want the AI to use those gosh darn static bags on their backs? What about using those big ol’ dang UAV bags?
Well now they will!
Expect AI to deploy static weapon bags in combat, use them to suppress/cover and then pack back up to move up.
Also expect them to use UAV’s to locate you and share that information with everyone else!

Mines & Explosives
AI will now use mines to kill unsuspecting enemies, or use explosives to knock someone out of a building if they don’t feel like breaching it.

Garrisoning
AI will garrison buildings to get a cover advantage over the enemy.
Putting the AI on a HOLD waypoint will force them to garrison buildings, and move around, in their surroundings.

Formations
The AI will dynamically change their formation depending on the environment.
If they are on a hill, and want to all fire down upon an enemy - they will use line formation.
In a town, they will most likely use stag. formation. Of course, during combat the formations are not prioritized at all.

Vehicle Disembarking
AI will disembark vehicles much before they reach a known enemy.
This allows them to position as they see fit before engaging.
Helicopters will also automatically unload troops when deemed necessary by the AI.


Installation:
1) Download the AI pack.
2) Copy everything in the init.sqf into your missions init.sqf
-If your mission has no init.sqf just copy the init.sqf into your mission folder
3) Copy VCOMAI folder into your mission folder
4) Save and export
5) Play


Media:


Armaholic.com has its own Youtube channel where we will cover the Community made releases.
Subscribe to the Armaholic.com Youtube channel


Usage:
For usage instructions and information of how to use the Vcom AI - Script please refer to the included documentation.

How to install script and addon of VCOM AI:

Showcase mission:

IMPORTANT EDITING COMMANDS:
this setVariable ["NOAI",1,false]; - This will turn off the VCOM AI on the given unit

This will make the AI not execute extra waypoint behavior OR respond to calls for help
this setVariable ["VCOM_NOPATHING_Unit",1,false];
This will remove all the markers that AI spawn on the map if MARKER MODE is enabled. The more markers, the longer it takes.
[] call VCOM_EraseMarkers;


Notes:
Please let me know about any bugs.
I do appreciate people pointing out areas that could be improved and telling me how. Anything to make the experience better for the community is always good.


Credits & Thanks:
My friends who helped me test this multiple times - thank you for your patience. It may seem like a small thing but it matters to me <3 stay awesome guys, you know who you are.
Dog-Company for helping me test these scripts. They run an awesome group over there and are extremely helpful with these kinds of things. Check em' out! /end shameless plug.


License / Disclaimer:
Coding for ArmA is not my job, it is my hobby. I am a Psychology student going for his masters and have 0 scripting knowledge outside of ArmA. I do this as a hobby and as a result my code may not be up to "professional" standards in terms of beautification. As long as my code works and does not destroy a server I am happy. I will constantly work to improve the scripts but please keep in mind I actually know very little when it comes to coding :> If you are looking for some beautiful eloquent script suite you are in the wrong place!


Changelog:
v2.92
-Removed in-game editing menu as it was causing too many issues with other mods.
-AI squads will now properly disembark vehicles and helicraft
-Improved AI vehicle behavior (Drivers/gunners will no longer jump out of vehicles unless the vehicle is severely damaged)
-AI cover system improved, AI will now take more chances in trying to reach cover.
-AI will be more aggressive.

v2.91
*Fixed* AI will properly disembark vehicles, most of the time.
*Changed* AI will now only call in an appropriate amount of reinforcements.
*Changed* AI have a cooldown to how often they can call in reinforcements (per-region basis)
*Fixed* AI will no longer hug the ground for the rest of their lives after combat. PTSD is a serious thing and proper therapy needs more funding.
*Fixed* Aircraft transporting AI will now attempt to unload the troops, even if under fire. They used to wait until it was perfectly safe before.
*Fixed* Config errors
*Changed* VCOM In-game options dialog now only shows if you are an admin. It is now, by default, in the top right corner of the screen and will appear only if the player mouses over that area.

v2.90
*Optimized* Checkbag function improved in terms of speed
*Optimized* Deploy static and disassemble static speed improved
*Optimized* FSM system has been optimized for faster performance.
*Optimized* Placing mines and satchels on structures has been optimized. The AI no longer need to leave the group either.
*Optimized* Changed several functions from 'spawn' to 'call' to decrease possible script-lag.
*Added* VCOM_FPSFreeze in userconfig file for disabling Vcom on units when server FPS drops below a certain level
*Added* VCOM_LeaderExecuteLimit variable in userconfig file to limit the # of leaders executing commands at once.
*Added* VCOM_BasicCheckLimit variable in userconfig file to limit the # of units executing basic commands at once.
*Added* VCOM_DisableDistance variable in userconfig file to disable Vcom AI on units when the enemy is over this distance.
*Added* Side based skill settings in userconfig file.
*Added* Classname specific skill settings in userconfig file.
*Added* Artillery cooldown timer in userconfig file.
*Added* Artillery dispersion range in userconfig file.
*Added* VCOM_WaypointDistance variable in userconfig file. This variable controls how far AI commanders can set waypoints from their targeted area.
*Added* AI will go prone when struck by a projectile.
*Added* Dynamic static weapon support for mods
*Added* In-game options menu when pressing ESC to change VCOM on the fly.
*Changed* AI Artillery will now take into account the size of the squad when determining how many rounds to fire.
*Changed* AI Garrison consider range increased to 50 meters.
*Changed* AI will patrol inside garrisoned structures now while on a HOLD waypoint.
*Changed* Slightly improved behavior of AI in vehicles
*Changed* this setvariable ["NOAI",true]; changed to this setvariable ["VCOM_NOAI",true]; !!!!!!!!!!!!!!!!

v2.81
*ADDED* AI have a better time following waypoints in combat.
*ADDED* AI will more aggressively clear out buildings now.
*ADDED* New settings in the userconfig file and VCOMAI_defaultsettings.sqf file for fine-tuning the queue system.
*FIXED* AI assaulting a point sometimes would get stuck when AI deemed no cover was findable.
*FIXED* Zeus controlled AI should now handle even better.
*OPTIMIZED* Many functions and scripts heavily optimized.
*OPTIMIZED* New queue system for AI taking cover and other HEAVY functions.

v2.8
*NEW* Added new suppression mechanics for both players and AI. This reduces ability to accurately return fire while under fire. Due to the experimental nature of this change this mechanic can be disabled or modified easily via the config.
*NEW* Added a new 'adrenaline' mechanic for both players and AI. This slightly speeds up units when under fire for a short time, allowing units to seek cover and positon more effectively. Due to the experimental nature of this change this mechanic can be disabled or modified easily via the config.
*NEW* Ability to disable weather effects to accuracy.
*NEW* Ability to select percentage impact of weather effects.
*NEW* Further implemented AI debug code to give a more accurate picture of what the AI are thinking and doing.
*FIXED* AI no longer have godly-insta detect when entering combat mode. Vanilla AI seem to have a boost to their detecting abilities in the last few patches.
*FIXED* AI will not run miles and miles to rearm now. (Thanks to burneddi and crewt)
*FIXED* AI will no longer magically know when a grenade has been thrown or a mine placed. Thanks to Dancorg!
*FIXED* VCOM_AIMagLimit actually impacts the AI decision making now.
*FIXED* AI in vehicle types of "Planes" will no longer use VcomAI.
*FIXED* AI carrying mortars will not deploy and attempt to shoot said mortar indoors.
*OPTIMIZATION* VcomAI_RearmSelf script has been optimized thanks to Crewt!

v2.7
*NEW* The first revision of AI rearming is now in. AI will attempt to grab nearby ammo when low.
*NEW* Added "VCOM_AIMagLimit" to the config. When the AI reach this number of mags left, they will begin searching for ammo.
*NEW* VCOM_AIDEBUG = 1, now makes the AI talk about what is going on. Although this is funny/cute, it is purely for debug purposes to see what is going on during combat or to see how the AI are. THIS IS MESSY. Large numbers of AI will cause problems.
*NEW* When entering combat, AI now wait 30-120 seconds before calling for help. If the group is destroyed before this timer, no help is called for.
*NEW* Added Vcom_ActivateAI variable. When set to false (Vcom_ActivateAI = false) no AI new AI will be processed by VCOMAI. This variable can be toggled on/off dynamically.
*FIXED* AI getting stuck when exiting combat and refusing to move. (Thanks hyzoran!)
*FIXED* AI getting stuck when Enemy is too far away. (Thanks hyzoran!)
*FIXED* AI getting stuck when no enemy's present on the map. (Thanks hyzoran!)
*FIXED* AI friendly factions firing upon friendlies. (Thansk autigergrad! Thanks S.Crowe for a fix!)
*FIXED* Dismiss waypoints are improved.
*FIXED* AI will not properly call for help when coming under fire.
*FIXED* AI should be less willing to jump from helicopters to end their lives sooner.
*CHANGED* AI will not instantly know the where-abouts of a unit when coming under fire. They will always know the *general* direction of fire, but not the exact position of the unit. So they will still be able to return suppresive fire after they re-collect themselves.
*CHANGED* Civilian AI's removed from VCOM's interactions by default. (Thanks Vasily!)
*CHANGED* AI should prefer sticking close to their squadmates in most situations, but still willing to spread out to flank and get into cover. (Thanks hyzoran!)
*CHANGED* AI call for help ranged increased from 800 to 1000 by default.
*CHANGED* AI hearing gunshots reduced from 800 to 500 by default.
*OPTIMIZATION* VCOM AI is now less demanding on resources. However, most tests show an average impact of ~6-10 FPS with 215 AI present on a map.

v2.6
*OPTIMIZATION* Replaced MANY getvariable and setvariable commands and replacing with local variables where necessary/possible.
*OPTIMIZATION* Optimized the check AI leaders would do for enemies being inside buildings. It is less accurate overall, but should yield much better performance.
*OPTIMIZATION* Artillery firing function slightly optimized.
*CHANGED* HOLD waypoint will prevent AI from being pulled around by VCOM AI. AI will still notice fire/proceed to combat mode. AI will still take cover and move to better cover locations.
*CHANGED* HOLD waypoint will only make AI garrison if the waypoint is within 15 meters of a building.
*CHANGED* AI will surpress enemies better.
*CHANGED* AI will respect Zeus waypoints even better now. (Make sure to use "FULL" movement if you want them to move NOW)
*NEW* AI will not leave their cover if they have shot recently.
*NEW* AI will do much better with CQB. The amount of times enemy AI will run right by each other should be drastically reduced.
*NEW* AI can not see through smoke grenades
*NEW* AI set on "FULL" speed will charge their enemies and disregard cover unless under direct fire.
*NEW* AI's accuracy/vision is impact my rain intensity.
*NEW* AI defined as medics (by default, or by using the setUnitTrait command, will automatically heal hurt squad members when THEY deem is safe enough)
*NEW* AI that wander too far from their group will attempt to re-group if possible.
*FIXED* New vanilla units for Tanoa will deploy static weapons
*FIXED* Artillery units will now fire properly.
*FIXED* AI will ignore high flying aircraft for movement commands. This prevents AI trying to capture planes and rainbows.
*FIXED* AI's increasing accuracy system now works properly. The AI's accuracy will slowly increase as their enemies stick in one spot. Their accuracy is reset when target moves a short distance.
*FIXED* Fixed FSM hangup where AI would get stuck in a certain function - causing them to respond less to threats.
*FIXED* AI helicopters no longer attempt to fly into space with VCOM_AIDEBUG = 1 command.
*FIXED* Fixed AI squads getting stuck in certain cases and not advancing to a target.
*FIXED* Fixed AI squad leaders from charging off into the distance in most cases.

v2.25
- uploaded correct version

v2.20 revision 2
*CHANGED* AI will no longer plant mines if they are far from the enemy
*CHANGED* AI will no longer arm/place statics if they are far from the enemy
*OPTIMIZATION* Shifted a lot more code to be executed just by squad leaders where it makes sense in the AIBEHAVIORNEW.fsm
*OPTIMIZATION* DangerIdentify.fsm - Squad leader is only one who checks for danger sources. The rest just check if they are in combat or not. This is not ideal - but saves a lot of FPS.
*NEW* AI will advance from cover to cover toward generated waypoint. AI will stay at the location for awhile and wait until they don't see any enemies anymore to move.
*CHANGED* AI will use smokes less but in better situations
*CHANGED* AI hopefully will stop blowing up their butts with grenades
*CHANGED* AI with waypoints placed in editor will no longer show off their awesome dance skills by walking back and forth
*NEW* AI inside vehicles will respond better to combat - disembarking when more appropriate and won't constantly get back inside the vehicle
*NEW* Mixed squads, (I.E. Infantry with vehicles) will work together better. Vehicle *should* not leave the troops behind and will slowly advance with infantry
*CHANGED* If the AI get too far from squad leader they will regroup
*CHANGED* Reworked cover finding code. More efficient and works better overall
*OPTIMIZATION* Optimized line-of-sight check code
*CHANGED* AI with pre-created waypoints will NOT generate extra waypoints. (Has to be more than 1 waypoint)
*CHANGED* Better Zeus implementation.
*CHANGED* Aircraft with waypoints should behave much better
*NEW* Further improved headless client support. It is still best practice to have the HC spawn the units instead of moving them over fromt he server.
*NEW* Reduced/randomized time it takes for AI to put mines.
*NEW* Added configurable random chance for a mine to be placed.
*NEW* Added config option to disable mine placement for AI.

*WARNING* Placing waypoints in editor with COMBAT behavior as their first waypoint will cause AI to break - this is due to new Eden update and enabling/disabling "FSM" on AI. No workaround found yet.

v2.10
- Added configurable grenade chance use in userconfig
- Reduced chance AI will throw smoke
- AI will attempt to utilize smoke if they cannot run for cover
- Improved vehicles supporting in combat – this still needs some work, will happen next patch.
- Fixed weird file location issues
- Fixed a possible error when no enemies could be found
- Added functionality for AI clearing buildings
- While clearing a building – AI will crouch appropriately when friendlies are behind them
- AI that start spawned into buildings will not navigate outside of the building by means of VCOM AI
- AI will now return to starting combat behavior after identifying no current threats nearby. This is variable depending on the environment. AI in a war-torn area will most likely take longer to relax than AI who just heard a gunshot or saw someone.
- AI will react to enemies more reliably.
- Hold waypoint will now put units into buildings more reliably. Optimized script to reduce FPS impact.
- AI will attack more directly with a force that they 2:1 outnumber.
- Removed all AI pacifists that could be found (AI will actually shoot each other more reliably).

v2.01
- Added VCOM_SideBasedMovement param in the param sqf file
Remove sides from the array below to force that specific AI side to not execute any advance movement code. (I.E. Moving to reinforce allies, being alerted by distant gunshots and etc). AI with this will still react normally in combat
- Added VCOM_SideBasedExecution param in the param sqf file
Remove sides from the array to remove that specific AI side from executing any of the VCOMAI scripts at all.
- Fixed several .rpt errors
- Fixed userconfig file missing
- Commented userconfig sqf file
- Fixed showcase files missing

v1.10
- Vehicles: Make vehicles support infantry more reliably. Still needs some more love.
- Code: Fix error message about returning parents of a class. (Check if isNil then exitwith...)
- Players: Players will no longer utilize AI scripts.
- Code: Better Zeus integration. Still needs some love.
- Groups: AI will garrison nearby statics if possible.
- Groups: Double check GUARD waypoints and garrisoning.
- Players: Sometimes players swapping to control AI will not fully take over the AI and have to fight the unit for control...
- Vehicles: Improved AI driving skills...made them avoid simple obstacles.
- Groups: AI will now consider the threat level of enemy groups. If a groups "Nerves" are too much, and they are heavily out numbered, they may choose to retreat (rout) for some time.
- Code: Optimize AI suppression code.
- Groups: AI will actually use statics on their backs now.
- Groups: Make AI flank/follow waypoints better.
- Groups:AI will not execute most VCOM AI code when their leader is a player.
- Code:Userconfig folder implemented. It's implemented in such a way that it will not crash if it isn't defined...it will simply fall back on default variables.

v1.09
- Reconstructed the scripts completely. I know have a much better system that allows for easier changes to individual AI.
- AI units no longer try to control their leader.
- Fixed the scripts executing on players sometimes
- AI personality framework is beginning now. AI can get "Surprised" when ambushed. An AI with low control/low rank may accidently discharge their weapon and etc.
- New cover system. AI will now consider slopes as cover if possible
- New debug system to allow easier bug fixing
- Much more that I'm too tired to remember

v1.08
- Added new artillery function, AI will call artillery for support if enabled and is present on the map.
- Individual units can now have their own response ranges and other settings configured independently of others. The settings in the init.sqf act as only defaults now. See 1st post for new variable settings
- Fixed bug where scripts would not even run on dedicated server.
- Fixed a few error message popping up
- Reworked HOLD waypoints. AI will no longer leave the area they are in. AI will garrison more effectively or spread out if all of the group can't fit in a single building. AI are forced to either crouch or stand inside buildings to prevent AI shooting through walls
- AI are more aggressive with planting explosives on occupied buildings
- Added debug option to track AI movement in map. *BE CAREFUL WITH THIS. IT SPAMS MARKERS AND CAN CAUSE EXTREME LAG WITH LOTS OF AI. See 1st post for new variable settings.

v1.07
- Suppression effects updated to be more efficient with less FPS drain. I no longer track bullets or "#craters". It was getting too complex and laggy :|. I now use worldToScreen and cursortarget. Which has it's own issues - but it's super fast!
- Changed AI waypoints to consider locations where they can fire upon the enemy (using overwatch systems)
- Fixed AI creating 50 waypoints instead of the default 3
- AI will now remove waypoints once their target enemy group is fully destroyed
- AI should trip over themselves much less
- Lessened time between supression
- AI will now suppress enemies more
- Fix animation errors (thanks)

v1.06
- Addon version now available
- Changed bullet hit detection. It's not perfect but should help cut down on desync
- Implemented backbone for morale system. It currently doesn't do anything because I don't know how to implement it yet.
- Fixed units not using static weapons
- Added actual headless client/zeus support. AI script will run on any client and not just AI that belong to the server.
- Implemented the downing system a bit more full
AI can actually be killed while down
AI will call for help from other AI while down. The AI just needs a FAK or medikit to revive the AI
- AI will more aggressively plant satchels on buildings to kill players now
- Backbone for AI using mines on roads implemented now. Not functional yet - but it's coming.
- More optimizations and etc

v1.05

v1.04
- Removed annoying error (hopefully) about BIS_fnc_selectrandom spam. It should be gone now. Let me know if it isn't
- Redid some background scripts, getting ready for more complex animation system and additional features (AI will soon be counting the # of known enemies and responding accordingly)

v1.03
- AI should act in a more cohesive manner. Still spreading out but staying as a group. The groups are still a lot more loose than default AI
- Fixed bug where AI would stop engaging and stare up at the stars
- AI will now delete their engagement waypoints after their opposition has been killed
- AI accuracy settings are randomized. Some AI soldiers will be better than others.
- AI vehicles should behave a lot better inside vehicles now.
- Optimizations: 164 AI engagement had a low of 30 FPS for ~30 seconds on the test server.

v1.02
- AI will use explosives (if available) on enemies that are garrisoning buildings a bit too long.
- Improved AI flanking behaviors and movements, they should move around a bit more now
- AI will not execute any complicated/over controlling commands when their leader is a human player. I will put in ways to control this in the future.
- A few bug fixes

v1.0
- accidently deleted a bit of code that affected the AI and their cover taking abilities (thanks VRCRaptor)
- fixed the players not being able to suppress the AI properly

v1.00
- first release


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Ai,   Fsm,   Showcase