Mission Editor: AI Tasking
This guide applies to using the DCS mission editor and the scripting engine.
- 1 Basics
- 2 Scripting
- 3 Task List by Category
The AI tasks system in DCS received a much needed and flexible overhaul between DCS Black Shark and the A-10C release. The new system allows for a great level of control over AI actions.
There are four task categories and each behave a little differently. These categories are: Perform Task, Enroute Task, Commands, and Options.
Additionally there are "Task Wrappers" that the mission editor will automatically assemble the task inside of the mission file. Effectively it is a task of tasks and may give the AI rules for how to execute the given task.
Perform Task vs Enroute Task
Perform Task: Is a task that is assigned and executed immediately.
Enroute Task: Is a set of tasking instructions that remains active throughout a groups route.
There are no two tasks that are identical between perform task and enroute task, however there are tasks that end in the same result, but go about it completely differently. With the AttackGroup task GroupA will automatically detect GroupB and attack it the instant the tasking is given. This includes flying from its current location directly to GroupB's location and ignoring other targets along the way. With the Enroute Task EngageGroup, GroupB is added to a list of valid targets for GroupA. GroupA simply flies its assigned route, if at any point GroupA detects GroupB, then it will proceed to engage GroupB.
Once GroupB is destroyed, how GroupA reacts is different between the two tasks. As stated with the engageGroup tasking GroupA flew its route whereas with attackGroup it flew directly to the target. Thus once GroupB is destroyed the flight with engageGroup will continue on to its next waypoint while the flight with attackGroup will have to fly back to make up any waypoints it missed.
Enroute tasking is used as a general purpose task that allows AI to react to an evolving threat environment, where-as Perform Tasks are best suited for attacking very specific targets that may be critical to the missions objective.
Note: The escort task is effectively a combination of the two tasking types. It is assigned as a perform task to rendezvous and fly formation on an assigned group, but the act of escorting and protecting the group from the specified threats is an ongoing task that occurs throughout the escorted groups route and position.
Commands and Options
Commands: Are actions that are run on the group that don't have any overall effect on what the AI is allowed or isn't allowed to do. Commands typically dictate how a group can interact with the game world (callsign and frequencies) or are actual commands to follow.
Options: Are used to define behavior options for the AI group. These options decide what the AI is and isn't allowed to do. The options can over-ride active tasking. For instance with RTB on out of ammo the AI will return to base and abort its current mission if it runs out of a specific type of ammunition.
Both commands and options are executed immediately and take no time to run.
Aircraft selection and role
When placing an aircraft or helicopter group in the mission editor the "TASK" option is an important setting that controls a number of items. To avoid confusion it is best to think of this option as a "Role" instead of "task". This setting dictates the types of aircraft and pre-made weapons payloads available for that role. Additionally within the AI tasking different tasks are available and are filtered to correspond to the role assigned to the aircraft.
See Figure 1. The TASK (Red Arrow) filters the list of aircraft types (Blue Arrow) available to fill the role of "CAP".
AI tasking can then be executed via two different means. "Waypoint Actions" and "Triggered Actions". Each has its own specific uses.
Waypoint actions are tasks that are tied directly to a groups route and executed upon reaching a specific waypoint. For example a mission designer may want a B-1B to bomb an runway, the designer would plan the B-1Bs route and assign the BombingRunway task on the nearest waypoint to the targeted airbase.
Pros: Tasks can be setup along a route to get consistent behavior from the AI.
Cons: Tasks can only be started once the group arrives at a waypoint. If for any reason the start conditions prevent a task from executing, then the task will never be evaluated again.
Triggered actions are a listing of tasks that can be triggered at any point for the group. These actions can be triggered via mission editor triggers or via the scripting engine. A common use is for a group of artillery to fire at a specified target during the mission. A mission designer would have a group of artillery with a triggered action task to fireAtPoint a pre-defined target once an invasion starts. A trigger that may start the invasion would also use Push AI Task to assign the artillery group its fireAtPoint tasking.
Pros: Forces a task for AI to immediately follow.
Cons: By assigning a new task it can easily "interrupt" AI in active tasks.
Fundamentally the scripting usage of AI tasks is identical to the mission editor.
The scripting engine is not bound to the limitations of the mission editor when it comes to AI tasking. These bounds are typically manifested in the options available for a given task. For example in the mission editor the main task selected for an aircraft limits the aircraft list that can do the task, the actual tasks and enroute tasks that can be selected, and the options within the tasks.
For example see the image below. The only difference is the selection of the "main task" from CAP and Fighter Sweep. This identifies some of the limits that exist with the editor limiting attributes and tasks available.
The same task, engageTargets, is available for CAP, SEAD, Fighter Sweep, CAS, AFAC, and Anti-ship.
Task Wrappers are special tasks that include other tasks. These tasks are automatically created by the mission editor when placing AI routes and assigning tasking. Essentially it follows the same format of the mission file where it is 1 giant table with table entries nested as far as they need to go.
mission : This is the entire task tree. It contains route information and any task that will be executed at a given waypoint.
ControlledTask : Is used for any tasks that may have special rules applied for if the task can start and when the task ends.
WrappedAction : Is used when setting Options and Commands due to how the game interprets those values as part of a larger task. Note that these can also be set at anypoint via script calling setOption or setCommand.
Task List by Category
AttackGroup, AttackUnit, Bombing, Strafing, CarpetBombing, AttackMapObject, BombingRunway, orbit, refueling, land, follow, followBigFormation, escort, Embarking, fireAtPoint, hold, FAC_AttackGroup, EmbarkToTransport, DisembarkFromTransport, CargoTransportation, goToWaypoint, groundEscort, RecoveryTanker
script, setCallsign, setFrequency, switchWaypoint, stopRoute, switchAction, setInvisible, setImmortal, setUnlimitedFuel, activateBeacon, deactivateBeacon, activateICLS, deactivateICLS, eplrs, start, transmitMessage, stopTransmission, smoke_on_off, ActivateLink4, deactivateLink4, activateACLS, deactivateACLS, LoadingShip
ROE, Reaction To Threat, Radar Using, Flare Using, Formation, RTB On Bingo, silence, Disperse on Attack, Alarm State, RTB on Out of Ammo, ECM Using, Prohibit AA, Prohibit Jettison, Prohibit Afterburner, Prohibit AG, Missile Attack Range, Prohibit WP Pass Report, Engage Air Weapons, Option Radio Usage Contact, Option Radio Usage Engage, Option Radio Usage Kill, AC Engagement Range Restriction, jett tanks if empty, forced attack, Altitude Restriction for AAA Min, restrict targets, Altitude Restriction for AAA Max