6thSense.eu:AI-Manager

by 6thSense.eu

**6thSense.eu AI Manager v0.2 for ArmA, by Sickboy (sb\_at\_6thSense.eu)** (AI-M, AIM)

Meant as a tool for mission makers to create a dynamic, random and challenging Coop Mission.

# Features

* AI Spawn Manager (Spawn any number of AI, in any number of groups, picking types/class of units randomly out of defined arrays) Supporting atm: Infantry, Vehicles, Tanks, Choppers and Building Rooftop Overwatch
	+ Create Markers to choose the Area where you wish groups to be created
	+ fCreateZoneMarkers Function by Killswitch to create the patrol zones around an Objective zone automaticly!
	+ Random Placement of groups
	+ Range Amount of Units per group selectable
* AI Enhancements (Choosable per group or per Zone)
	+ 6thSense.eu NAI: New AI Enhancement based on features known by GroupLink, DAC, etc. etc.
		- Usage of NearTargets function to obtain perceived enemies and their positions, creating a fair and non-cheating AI-Enhancement.
		- No "Enemy" configuration is needed, they will react to anything that is considered enemy, doesn't matter if it's an individual, a group, or multiple groups.
		- 3 Scripts that handle the target checks, alarms and dispatch. Running after eachother, giving full control over cpu-load and array states and creating the illusion of chain of command and radio protocols.
			* Mainloop: Scans nearTargets of alerted groups and keeps a simple history and sorts unique targets. Managing the targets.
			* Alarmhandler: Uses the output of Mainloop to create alarms based on parameters. Managing the alarms.
			* Dispatcher: Uses the output of Alarmhandler to send in support groups to alarms, using the support script. Managing the supportline.
		- Debug Marker script for following alerts and alarms
		- Alarms are triggered when an AI gets hit, he reports within 3-6 seconds (configurable) to group leader, he reports to command, and within 10-20 seconds there are support groups sent to the alarm area. When a unit gets killed, while his groupleader is alive, the groupleader will report within 5-20 seconds to command (configurable)
		- Alarms only are created for enemies that are further than 150m apart (configurable)
		- A maximum of 3 groups are dispatched per alarm, and the alarm maintainer will send in new groups when old groups do not respond any longer (configurable)
		- AI will investigate the alarm position even when they have no targets yet
		- AI engagement is fully controlled by ArmA's own AI-engine, which isn't as stupid as it sometimes seems ;-)
		- Alarms are cancelled after 360 seconds when no more Enemies are spotted (configurable), alerts are cancelled after 180 seconds (configurable).
		- Currently the following Support Enhancements are inplace for groups that are called in for support:
			* If group is on foot or inside Tank, they will move out to the alarm position and engage
			* If group is inside Car, they will get out at a distance from the alarm position and move further on foot
			* If group is inside Heli Cargo, they will be parachuted by groups of 3 from the heli near the alarm
		- After Alarms are cancelled, groups will continue looking around for a bit, and then move back to their original positions and waypoints, and get back in their vehicles (even the paradroppers) if they had any
	+ UPS (Patrol Script by Kronzky): Random Patroling, Enhanced AI when in combat
	+ Grouplink (by Keycat, rewritten to ArmA by \=SNKMAN=/, rewritten to SQF by Sickboy): Groups calling support from eachother, using realworld Tactics, and various other enhancements
* AI Tracking System By Kronzky (Track Movement of AI Groups, leaving a trail of markers behind)
* Basic Objective/Mission Generator
	+ With support for:
		- Different mission types: ["Rescue","Recover","Destroy"];
		- Different mission subTypes: [["Captives","Civilian"],["Documents","Vehicles"],["Tanks","APCs","Buildings"]];
	+ Fully configurable and ability for making and maintaining templates
	+ Creates and colors markers dependent on status of objective
	+ All triggers are dynamicly created, only having the needed triggers ingame at all times
* All Scripts are in SQF, only preloaded into Memory when they are required repeatedly throughout the whole mission
	+ Most tasks are done by Functions
	+ Arrays available that contain the Zone Data (Created Groups, Size of Zone, Location, etc. etc.)

# Project Status

* Stable Version: v0.11
* Unstable Version: v0.2b6

# Download

* 6thSense.eu AI-M v0.11
* 6thSense.eu AI-M v0.2 >>>beta6<<<

**Best Played With** 6thSense.eu:Mod **Designed for Multiplayer**

Please make sure that you use this package inside the Multiplayer Editor (Multiplayer, Create a server (password it), and either click NEW or open the mission you want) and not in the Singleplayer Editor.

# Reporting Bugs

Please report bugs in our Bug Tracker (**please pick the proper Project** and other options, aswell as first check if the bug isn't already reported, thanks!)

# Planned Stages

* v0.1 - Basic AI Generator, AI Enhancements etc.
* **v0.2 - Addition of Waypoint & Basic Mission/Objective Generator based on Parameters and Addition of AI Enhancement (Basing ideas on: Grouplink, DAC, KI2 etc. etc)**

* v0.3 - Enhance & Expand Previous
* ....

# Plans

* 6thSense.eu AI Populator/Generate Script integration; Populate the whole Island based on parameters
* 6thSense.eu Player Bubble TM integration; AI Groups are only active in xxxxMeters range of Players
* Reduce-Groups; When Players are further than xxxMeters away from AI, reduce the group to only the groupleader, Spawn the other group members in when they are closer than xxxMeters
* Measure the Size of a Zone and automaticly fill the zone based on the square-meters
* Further expand and implement other/new AI Features/Scripts
* Develop Dynamic Waypoint Generator Script to give soldiers waypoints in the generated Zones (at this time this is done dynamicly through the mission by using UPS or 6thSense Patrol)
* NAI Enhancements:
	+ Artillery Support
	+ Airstrike Support
	+ Offsite/Offshore Support, meaning less patrols and less things moving around, having groups/vehicles at bases at the objective or far away, which get in their vehicles and get moved in to support.
	+ Rework alarm management based on unique id's instead of enemy targets
	+ Rework alert/alarm cancelling
	+ Add enemy and friendly 'strength' ratings to choose with what force/type the enemy should be met

# Demo Missions

* 1 Beginner Demo Mission, 1 Advanced Demo Mission and another one with 16 Mission Areas and startpoints. Available in West and East, aswell as 6thSense.eu Mod and BIS (No Addons) variants.
* 1 NAI Demo mission where enemies have no ammo, so you can test and see the responses, please check the Briefing

# Changelog

### v0.2beta6

* Added 6thSense.eu NAI, Beta
* Replaced GroupLink with NAI, altough you could still manually use it by creating your own mission
* 6thSense.eu Patrol script based on UPS Patrol Script by Kronzky is used when Grouplink or NAI is selected, otherwise UPS Patrol and AI is used
* New start positions (further away) for nearly every objective on nearly every island (Thanks to Alx)
* 6 New Objectives on Sahrani, 3 New Objectives at Southern Sahrani (Thanks to Alx)
* Updated Briefing to be more informative

### v0.2beta5

* Fixed wrong RACS units listed in AI-Manager Config, RACS by default have Desert Camo and as such I choose Woodland as default camo, putting the def (desert) camo on config position 1
* Multiplied the amount of 6thSenseMod missions by 2. Now possible to play from each side to each other side.

### v0.2beta4

* Resolved Resistance and Civilian Side not working (BUGID5). Warning, **if** you are using also 6thSense.eu:Pack1 Please update Pack1 to v0.3
* Changed knowsabout value check to 1.5, creating a better and more real enemy awareness and alarm systems
* Removed "InfoShare" script, unneeded especially considering the share capabilities of ArmA AI through AI Centers per Side
* Added more variants for 6thSenseMod

### v0.2alpha2

* six\_pt is now dynamicly updated (added to) based on the (six\_allpg select 0) array

calling team. (six\_aim\_obj#\_caller)

* six\_aim\_ratio can be used to scale the mission up/down depending on amount of players and the amount of players the Mission was made for.
	+ Idea for multiObjectives: Use a variable per objective (six\_aim\_obj#\_ratio) to make only the team that calls the objective be rated, so the objective scales to the\*\*\*
* Included basic mission/objective generator
* Base Functions
	+ fSetVarName
		- Uses the setVehicleVarName and processInitCommands to propagate the name of an object over the network
	+ fCreateGroup
		- Creates group on given side, but re-uses old created group if there are empty groups available
	+ fShuffle
		- Shuffles the contents of an array
	+ fGroupId
		- Automaticly set the groupId depending on side and amount of teams of inputted array. By default Generates 8 Different Callsigns and 8 Different Colors
* AI-M Functions
	+ fCreateObjective
		- Create an objective based on parameters and settings of cfg\_Objectives
	+ fObjHandler
		- Handles the objectives created by createObjective based on parameters and settings of cfg\_Objhandler
* AI-M Configuration
	+ cfg\_Objectives
		- Setup the objectives for fCreateObjective
	+ cfg\_ObjHandler
		- Setup the objectiveHandling for fObjHandler
	+ cfg\_Aim
		- Added six\_aim\_settings set [0, [true, 0.33]]; // Enable automatic ratio adjustment, ratio is used to determine number of units to generate per group. 0.33 - number Value, minimum Ratio

### v0.11-

* Fixed RACS (Resistance/Guer) Side (Thanks for report by fideco)
* Updated the ADV missions on Rahmadi with the createMarker methods like the ones on Sahrani. No markers will be visible in MP.
* GL2: Added Alert Cancel Distance. Default: 1000.
* Performance Optimized some of the Loops. (Thanks for the tips Crashdome!)
* Created less enemies, as the AI Enhancements should make up for the otherwise usual 10:1 Enemy AI/player ratio (Thanks Jinef for Remembering ;-))
* Added Debug Notice to Infoshare script, request by fideco. six\_debug\_lvl=16 will display the messages
* Added 4 more Objective Areas in the ADV missions on Sara
* Prefixed folders with SIX\_
* Cleaned up more Code, Split Code more from Configuration.
* Moved AIM\cfg\_Zone.sqf to SIX\_AIM\c\cfg\_Zones.sqf
* ADV Missions have some scripting inside init.sqf
* Changed the Beginner Mission to Advanced and added another, very basic Beginner Demo Mission. Hopefully this is more esay :-)
* Rewritten Grouplink to SQF. Better response times, smaller code, tighter loops, thinned and cut a lot, removed some unavailable features.
* Added a simple playervehicle generator for the missions on Sarahni
* Fixed proper Ammocrates
* Added \_bui Arrays per Zone (Representing Static Building Overwatch Groups)
* Grouplink now has debug messages, handy for the mission maker to see what's going on
* Now displays the amount of units in how many groups with how many vehicles in how many zones in how many seconds generated on server aswell as client
* Grouplink parameters changed
* Grouplink more optimized
* Rewrote the cfg\_Zone.SQF
* Using the new fCreateZoneMarkers to generate the Border/Patrol Zones
* Rebalanced groups to Infantry, Choppers, Tanks & Transport Vehicles
* Made a large patrol area for Choppers etc.
* Smaller, but more Groups
* Starting Position is Random Now
* Using smaller patrol zones, creating more properly divided Patrols
* Day/Night time Choice
* AI Type Choice (limited atm):
	+ UPS + UPSAI
	+ UPS - UPSAI + Grouplink2

# Credits

* AI and Spawn Manager, NAI AI-Enhancement and Patrol by Sickboy
* UPS, Tracking and Some Functions by Kronzky (www.kronzky.info)
* Grouplink2 by Keycat for OFP, converted by SNKMan to ArmA, Rewritten to SQF by Sickboy
* Rndselect Function by Terox
* AI Infoshare by General Barron for OFP, Optimized & Converted by Sickboy to ArmA & SQF
* Many ideas based-on or inspired-by DAC by Silola (www.mapfact.com)
* Spectator Script by Kegetys (www.kegetys.net)
* fCreateZoneMarkers Script by Killswitch, with ideas by lwlooz and Sickboy

Have fun,
6thSense.eu

# Help

### General Info

#### Configuration

* AI-M Configuration: SIX\_AIM\c\cfg\_AIM.sqf. Help is further down below.
* Zone Configuration: SIX\_AIM\c\cfg\_Zones.sqf. Help is further down below.
* NAI Configuration: SIX\_NAI\c\NAI\_Settings.sqf. Help soon
* Mission Configuration: init.sqf. Use BEGinner mission as reference. The ADVanced missions have more complicated scripting

#### Needed Gamelogics etc

* Server - You Need to create a gamelogic called Server, as seen in the Demo Missions

#### Needed Files & Folders

Best take them from BEG mission

* SIX\_AIM
* SIX\_BASE
* Stringtable.csv
* Init.sqf

#### Debug

* Getting Access to Debug Tools / Trackers etc
	+ In Mission init.sqf:
		- Add your name to the SIX\_RF array. And/Or enable debug Manually: six\_debug\_miss=true - Will display Standard System Messages important to Mission makers
		- six\_debug\_lvl=
		- 12 - AI-M Lowlevel Debug
		- 15 - GL2 Lowlevel Debug
		- 16 - Infoshare Lowlevel Debug
	+ Most debug features are only available when used together with the 6thSense.eu Mod.

#### Sides

* 1 = East
* 2 = West
* 3 = Resistance
* 4 = Civilian

#### Unit Types

* 1 = Infantry
* 2 = Vehicles
* 3 = Tanks
* 4 = Air (Choppers)
* 5 = Building Rooftop Overwatch

#### Zone/Group Options

You can combine these options with for instance the function fChkDbg. This function returns the inputted value IF debugmode is enabled, and returns nothing if debugmode is disabled.
For instance: "TRACK" call (SIX\_Aim\_F getVariable "fChkDbg") would only enable the Tracking Scripts when debug mode is enabled

* "TRACK" - Enable Kronzky's Tracking System (SP/Offline only)
* "RANDOM" - Enable Random Start Positions
* "SHARE:" - Enable Infosharing script originally written for OFP by Genr. Barron
	+ [Alarmradius,Delay]
		- Alarmradius - Number: Max distance in Meters an AI Squadleader can be away from another AI Squadleader to call in support
		- Delay - Number: Sleep time between script loops/alarmstate check
	+ Examples:
		- To Enable Infosharing in a Radius of 300m with a 30 second delay: "SHARE:", [300, 30]
		- To Enable Infosharing on default Settings (rad 150, delay 30): "SHARE:", []
* "AI:" - Enable AI Expansion, Make sure that the next array will be the configuration array [aitype, aisettings]
	+ [AIType, AISettings]
		- AIType - Number:
		- 1 = UPS AI (With UPS Patrol Waypoint Generation)
		- 2 = Grouplink AI (With UPS Patrol Waypoint Generation)
		- AISettings - Array
		- UPS:
			* See the UPS Readme for possible options
		- Grouplink:
			* ["SUPP"] - (SIX\_AIM\_SUPP array) will make the units of this group CALL and GIVE support
			* ["SUPP","STAT"] - (SIX\_AIM\_SUPP and SIX\_AIM\_STAT arrays) will make the units of this group CALL but NOT GIVE support
			* ["SUPP","NOMOUNT"] - (SIX\_AIM\_SUPP and SIX\_AIM\_NOMOUNT arrays) will make the units of this group CALL and GIVE support, but if they were inside Vehicles they will not remount them after the Alarm is finished.
	+ Examples:
		- to Enable UPS AI in a zone: "AI:", [1, []]
		- to Enable GL2 AI in a zone: "AI:", [2, ["SUPP"]]
		- to only let units call support in this zone: "AI:", [2, ["SUPP", "STAT"]

### cfg\_AIM.sqf Usage

* six\_aim\_messages set [0, true]; - Will display System Messages (e.g. Amount of units created etc) even when six\_debug\_miss=false
* More usages in future

### cfg\_Zone.sqf Usage

#### Easy Setup of Zones

```
  // Don't forget to have/create the Zone Markers on the map, in the examples: z1, z3, z4, z5 and z6. Check the BEG Example Mission for Reference.
  // Zone Configs
  ///////////////////////
  // Objective1, Main Zone:
  	_zone="obj1";   // Will create zone "obj1" based on marker "obj1"
  	_side=1;   // Will generate units on side 1-East
  	_conf=199;   // Will take units from config 199 (BIS SF East). Corresponding with the AIM\c\cfg_side.sqf files
  	_inf=[3, [4, 8]];    // Will Create 3 Infantry Groups with groupsizes between 4 and 8
  	_veh=[];   // Will not create Vehicles
  	_tan=[];   // Will not create Tanks
  	_air=[];   // Will not create Air (Choppers)
  	_bui=[1, [10, 20]];   // Will Create 1 BuildingRooftop overwatch group with groupsize between 10 and 20
  	_feats=["TRACK" call (SIX_Aim_F getVariable "fChkDbg"), "RANDOM"];   // Will Enable Unit Tracking when in Debug Mode, and make the Units start from Random Position.
  	_ai=["AI:", [2, ["STAT","SUPP"]]];   // Will Enable AI2: Group Link AI. Units will be STATic
  	// Next Part is Important, do not forget to add!
  	six_aim_z=six_aim_z+[call _c];   // Add Zone to the six_aim_z CreateZone Todo List.
  ///////////////////////

```

```
  ///////////////////////
  // Objective 2, Air/Veh/Tank/Inf Support Zone:
  	_zone="obj2";   // Will create zone "obj2" based on marker "obj2"
  	_side=1;   // Will generate units on side 1-East
  	_conf=149;   // Will take units from config 199 (BIS East). Corresponding with the AIM\c\cfg_side.sqf files
  	_inf=[2, [4, 8]];    // Will Create 2 Infantry Groups with groupsizes between 4 and 8
  	_veh=[1, [4, 10]];   // Will Create 1 Vehicle Group with infantry groupsizes between 4 and 10 (Will create as much vehicles as nececairy to accomadate for all units in group)
  	_tan=[1, [1, 1]];    // Will Create 1 Tank Group with Tank groupsize of 1
  	_air=[2, [1, 1]];    // Will Create 2 Air Groups with Chopper groupsize of 1
  	_bui=[];   // Will not create BuildingRooftop Overwatch Groups
  	_feats=["TRACK" call (SIX_Aim_F getVariable "fChkDbg"), "RANDOM"]; // Will Enable Unit Tracking when in Debug Mode, and make the Units start from Random Position.
  	_ai=["AI:", [2, ["SUPP"]]]; // Will Enable AI2: Group Link AI. Units will be SUPPortive
  	// Next Part is Important, do not forget to add!
  	six_aim_z=six_aim_z+[call _c];  // Add Zone to the six_aim_z CreateZone Todo List.
  ///////////////////////

```

```
  ///////////////////////
  // Objective 3, Veh/Tank/Inf Support Zone:
  	_zone="obj3";   // Will create zone "obj3" based on marker "obj3"
  	_side=1;   // Will generate units on side 1-East
  	_conf=149;   // Will take units from config 199 (BIS East). Corresponding with the AIM\c\cfg_side.sqf files
  	_inf=[2, [4, 8]];    // Will Create 2 Infantry Groups with groupsizes between 4 and 8
  	_veh=[1, [4, 10]];   // Will Create 1 Vehicle Group with infantry groupsizes between 4 and 10 (Will create as much vehicles as nececairy to accomadate for all units in group)
  	_tan=[1, [1, 1]];    // Will Create 1 Tank Group with Tank groupsize of 1
  	_air=[];   // Will not create Air (Choppers)
  	_bui=[];   // Will not create BuildingRooftop Overwatch Groups
  	_feats=["TRACK" call (SIX_Aim_F getVariable "fChkDbg"), "RANDOM"]; // Will Enable Unit Tracking when in Debug Mode, and make the Units start from Random Position.
  	_ai=["AI:", [2, ["SUPP"]]]; // Will Enable AI2: Group Link AI. Units will be SUPPortive
  	// Next Part is Important, do not forget to add!
  	six_aim_z=six_aim_z+[call _c];  // Add Zone to the six_aim_z CreateZone Todo List.
  ///////////////////////

```

#### Using the fCreateMarker function

```
  // Explaination: [MarkerName, [positionX,positionY], Shape, [sizeX,sizeY]] call (SIX_Aim_F getVariable "fCreateMarker");
  // Example: _marker=["obj1", [100.50,100.50], "RECTANGLE", [200,200]] call (SIX_Aim_F getVariable "fCreateMarker");
  //
  // MarkerName - String
  // Position - Position Array
  // Shape - String (can be: "Icon", "Rectangle" and "Elipse")
  // Size - Size X/Y Array
  //
  // Optional Parameters:
  // "BRUSH:","Solid"
  // "COLOR:","ColorRed"
  // "TEXT:","Objective Area"
  // "TYPE:","Pickup"
  // "GLOBAL"  Will Create the marker Globally (On all Pc's instead of only the local machine)

```

#### Using the fCreateZoneMarkers function

```
  // With this function you can create 4 "Border Zones" around the Objective Main Zone, you can specify amount of layers
  // The function returns the generated layers in an array
  _borders=["obj1", 100] call (SIX_Aim_F getVariable "fCreateZoneMarkers"); // Creates 1 Layer of 4 Borders around "obj1" marker, with a width of 100m.
  // Would Create These Zones: "obj1N1" "obj1E1" "obj1S1" "obj1W1"
  // The _borders variable would contain the following array: "obj1N1", "obj1E1", "obj1S1", "obj1W1"

```

```
  _borders=["obj1", 100, "LAYERS:", 3] call (SIX_Aim_F getVariable "fCreateZoneMarkers"); // Creates 3 Layers of 4 Borders around "obj1" marker, with a width of 100m
  // The _borders variable would contain the following arrays: [["obj1N1", "obj1E1", "obj1S1", "obj1W1"], ["obj1N2", "obj1E2", "obj1S2", "obj1W2"], ["obj1N3", "obj1E3", "obj1S3", "obj1W3"]]

```

#### Bare Scripting syntax to create Zone AI Groups

```
  /*
  gz1=["z1", 1, getMarkerPos "z1", 100, [3, [5,20]], [], [], [], [], "RANDOM", "AI:", [1, []]] call (SIX_Aim_F getVariable "fCreateZone");
  //   ^ZONE ^SIDE  ^STARTPOS      ^CONF     ^INF   ^VEH ^TAN ^AIR ^BUI  ^Features ^^^^^^^^ AI Settings

  //  Infantry/Vehicles/Tanks/Air Configs:  [AmountOfGroups, [lowest,highest]]   Leave the arrays empty: []  to disable generating units of that type
  //                                                             ^The groupsize of the generated groups will be anywhere between those 2 numbers

```

```
  // Zone Spawning Example
  gz1=["z1", 1, getMarkerPos "z1", 152, [6, [6, 12]], [3, [10, 16]], [2, [1, 3]], [2, [2, 2]], [], "RANDOM", "AI:", [1, []]] call (SIX_Aim_F getVariable "fCreateZone");

```

```
  // Would create a zone with 6 InfantryGroups of 6-12 Infantry,  3 VehicleGroups with 10-16 Infantry, 2 Tank Groups with 1-3 Tanks and 2 Chopper Groups with each 2 Choppers
  // and load the generated groups in the gz1 array.
  */

```

#### Syntax to create Individual AI Groups

```
  /*
  // d=[side,amount,position,unitconfig,unittype,areaname,OptionalFeatures] call (SIX_Aim_F getVariable "fCreate");
  // Side - Number: 1-East, 2-West, 3-Guer, 4-CIv
  // Amount - Number: Amount of units to generate (between [lowerlimit,higherlimit])
  // Position - Array: Position of start of group
  // UnitConfig - Number: Select the Unit Config from the c\cfg_(SIDE).sqf files
  // Unittype - Number: 1-Infantry, 2-Cars, 3-Armor, 4-Air
  // AreaName - String: e.g "test1"

```

```
  // Individual Group Spawning Example
  gr1=[1, [10,20], getMarkerPos "test1", 100, 1, "test1", "AI:", [1, []], "TRACK" call (SIX_Aim_F getVariable "fChkDbg"), "SHARE"] call (SIX_Aim_F getVariable "fCreate");
  gr2=[1, [10,20], getMarkerPos "test2", 100, 1, "test2", "AI:", [1, []], "TRACK" call (SIX_Aim_F getVariable "fChkDbg"), "SHARE"] call (SIX_Aim_F getVariable "fCreate");
  gr2=[1, [10,20], getMarkerPos "test3", 100, 1, "test3", "AI:", [1, []], "TRACK" call (SIX_Aim_F getVariable "fChkDbg"), "SHARE"] call (SIX_Aim_F getVariable "fCreate");
  // Would create create 3 variables (gr1, gr2, gr3) which represent the generated group objects
  */

```