ATF Scenario Builder

ATF Power Toolkit

What's new in Raging Tiger

What's new in The Falklands War: 1982

What's new in The Star and the Crescent

Contact Us


How to Create a Faction AI Script

The basic method for building a Faction AI script is to first, plan paths for enemy hierarchies, then plan Missions for enemy hierarchies, and then, finally, create a Faction AI that triggers units to begin movement and execute Missions as triggers are met.

Now that we have planned all of the enemy paths, and we have planned and canceled the Missions for all our hierarchies, it is finally time to start building a Faction AI script.  At its heart, a Faction AI script is just a list of triggers, or conditions that must be met, and orders to be executed upon those triggers.

The best advice we can give you is keep it simple.  The more complicated your script, the more likely it will break.  Think about what you want the enemy to do, and when they need to do it, and describe it as simply as possible in the script.  Unnecessary orders or triggers almost always have unintended effects.

Create an Enemy Faction AI Script:

Both the Neutral and Enemy Unit Lists have Faction AI's.  Our scenario example does not include Neutral Units, so we will concentrate on building an Enemy Faction AI script.

1.  Select 'Unit', 'Hierarchy', 'Faction AI', 'Create', and "Enemy'.

2.  The AI Order Edit dialog is the foundation for the Faction AI script.
  • Order Name.  Not used.  Can be left blank.
  • Prerequisite Data.  Stuff that you want to store for use throughout the script is stored here.  Most commonly, you will store routes by copying them to the clipboard and then 'Adding' the 'Route' Data object.
  • Abort Conditions.  The conditions under which the entire script will abort early.
  • Abort Orders.  Final orders that will be given just before the script aborts.
  • Order Phases.  These are operational phases that will be executed in order to execute the script.  A new phase will not start until the previous phase's 'Phase End Conditions' have been met.

Add an Order Phase to the AI Script:

An Order Phase is a set of instructions that are executed at roughly the same time.  Ideally, all of your orders will fit in one phase.  However, sometimes simplicity or necessity will demand that the orders be broken into multiple phases.

1.  Select 'Add' next to the 'Order Phases'.
2.  The AI Order Phase Edit dialog contains all of the components of a phase.
  • Phase Name, Phase Long Description.  Provided to help you keep track of what the script is doing.  Not used by the AI or Armored Task Force.
  • Initiate Hierarchy Orders.  Orders that are given as soon as the phase begins.  If this is the first phase, then these orders will be given when time is first started.
  • Phase End Conditions.  The conditions which will cause the phase to end and the next phase to begin.
  • Sustain Orders.  A set of condition-order combinations that will be constantly checked as long as the phase is in effect. 
3.  The most common Phase End Condition is an AI Time Limit.  This is just an elapsed time at which the condition becomes true.  Select 'Add' from the 'Phase End Conditions' box, select 'AI Time Limit', and then enter an elapsed time.

Always provide some Phase End Condition!  If you do not, the phase will end the first time it is cycled through.

Add an AI Phase Order:

'Sustain Orders' in the 'AI Order Phases' dialog are all in the form of 'AI Phase Orders'  These are condition-order linkages that execute a list of instructions when the condition list has been triggered.  This is the heart of the 'decision point' tactics the Armored Task Force AI executes.

1.  The AI Phase Order Edit dialog allows you to create and edit Phase Orders.
  • Last Order.  An order title that allows you to add a memory aid to remember the purpose of the Phase Order.
  • Delete After Execution.  This will almost always be checked!  This tells the AI Order Phase to delete this Phase Order after it is executed (all of the conditions are met).  If you fail to check this, the hierarchy orders listed will be triggered repeatedly, without ever getting a chance to execute.  Failure to check this box is the most common cause of bugs in Faction AI scripts.
  • Order Execution Conditions.  This is a list of all of the conditions that must be 'true' before the Hierarchy Orders are executed.
  • Hierarchy Orders.  This is a list of orders, each set to act on a certain hierarchy, when the 'Order Execution Conditions' are met.
2.  The first thing you should do is decide on a condition or conditions for the order.  The trigger for the movement of artillery battalions will be when the elapsed time in Armored Task Force is 10 minutes.  We will set an AI Time Limit condition for this Phase Order.
3.  Next we add a Hierarchy Order.  The Hierarchy Order Dialog will allow us to do this.  A Hierarchy Order executes an order on a specified hierarchy, unit, or group of units.  You may either specify the hierarchy, unit, or group by name or select a list of codes to pick the target.
  • Order Type.  This is the order you want executed.  More on that in a minute.
  • Hierarchy Name.  If you wish to execute the order on a specific hierarchy or unit (the most common method), click here to select a name.
  • Target Code, Echelon.  This is a list of toggles which allows you to specify a target by describing it.  These toggles are seldom used and can often have unexpected result.  We recommend selecting a 'Hierarchy Name'.
4.  Most commonly, you will use Hierarchy Orders to initiate Missions, which are called AI Orders by the ATF Scenario Builder.  You may also use the 'Toggle Order' or 'Cancel Toggle Order' orders to turn on and off Orders and SOP's such as 'stop' or 'hold fire'.  More on this later.
5.  You need to pick the 'Mission' you want to execute.  Remember that we planned these Missions previously for our hierarchies.  DO NOT give a Mission (AI Order) to a hierarchy until you have planned it, executed it, and canceled it.  Doing so will cause the unit to act without objectives, locations, or orientations set, having buggy and unpredictable results.  If you need to plan a Mission, close all of the Faction AI windows by selecting OK, plan the mission, and then come back to this spot to edit the Faction AI.
6.  With the order set, we can now specify the hierarchy to which we want the order given.
7.  We are telling artillery battalions to move to their Position Areas, so we pick all of the artillery hierarchies.
8.  That's it!  We have finished building the hierarchy order.
9.  If we want the order to use any of the 'Prerequisite Data' from the initial AI Order dialog, we specify it here.  This is most commonly used if we have given the 'Assign Path' order in our Hierarchy Order dialog.  We would specified the stored 'Route' data item we want to assign here.
10.  We can use a single Phase order to give multiple orders to our Faction...
11.  ... So we are going to use the same Phase Order to order all of our artillery to move at once.
12.  With this phase order completed, we continue to add Sustain Orders until we have all of the condition-order sets completed that we want to execute in this phase of the battle.  

Remember, the AI will continually check all of these sustain orders while this phase is active, and continually check the Phase End condition.  If a Phase Order has 'Delete After Execution' set (the most common setting), when a Sustain Order is triggered, it will be executed and deleted.  When the Phase End Condition is met, the whole Phase will be deleted (whether all of the Sustain Orders have been triggered or not) and the next Phase will begin.

13.  We have finished adding Phase Orders and this Order Phase is complete.

Next step : Add an AI Time Limit Condition