Military AI Commander

From ALiVE Wiki
Jump to: navigation, search
Custom Objectives used to occupy a front line (Thanks to Oktyabr for this pic)
Part of:
Icon mil opcom.png ALiVE Military
Requirements: Synced
Icon sys profile.png Virtual AI System
Onebit no.png
Module milplacement.png Military Placement (Mil Obj)
Onebit yes.png
Optional: Synced
Icon mil ML.png Military Logistics
Onebit yes.png

How It Works

The Military AI Commander prioritises a list of objectives and then plans and executes missions with available units. AI Commanders will react to the changing environment and attack, defend, withdraw or resupply depending on the current tactical situation. Commanders continue to work with profiled groups, controlling a virtual battlefield out of visual range of players.

AI Commanders consists of two core elements: Operational Command (OPCOM) and Tactical Command (TACOM). Commanders take the objectives of any synced Placement modules and prioritis them depending on the strategy set by the mission maker. It also regularly analyses the map, relative troop strengths and available assets required to capture and hold objectives in its area of operations. Commanders give missions to TACOM, which in turn executes the tactical level orders to units and reports back its state once that mission is complete.

The AI Commanders only control groups profiled with the Virtual AI System. This means it is possible to transfer the status of groups and objectives seamlessly between the Visual (spawned) Layer and the Virtual (unspawned or cached) Layer. This allows huge ongoing virtual battles, from offensive operations with blazing battlefronts to insurgency deployments with a high degree of realism and minimal impact on performance.


Place a Military AI Commander module in the editor and select the faction it will control from the drop down. OPCOM can control more than one faction on the same side at the same time and custom factions can be entered in the “override factions” box. Commanders must have some troops to control from a synced Placement module set to spawn troops or some manually placed and profiled units.

Control Type: The strategy dictates which objectives the AI Commander prioritises first, the number of military groups used and their activity once they reach the objective.

  • Invasion: an invading commander will prioritise objectives closest to headquarters first (HQ is set at the location of the Military AI Commander module on the map). The commander will only use one or two groups to defend objectives and will focus on securing the next as quickly as possible until all objectives in its TAOR are secured or it runs out of groups to use. This is an aggressive and fast moving strategy but is vulnerable to attacks behind the front line.
  • Occupation: in this approach, the AI Commander takes into account a number of factors to determine the relative strategic importance of each objective including distance to HQ, the size and priority set by the Military Placement modules and the height above sea level. It will put a great deal of importance on holding objectives, sending up to 5 defensive groups if a location comes under attack. This is a cautious approach but uses a lot more troops to secure ground and so is vulnerable to attacks on the supply lines.
  • Asymmetric: insurgency commanders will attempt to cause maximum damage using as few military groups as possible. They will employ tactics such as sabotage, raids and ambushes whilst attempting to recruit fighters and coerce civilians into aiding their cause. Thorough patrolling and good intelligence is the only way to reduce the insurgency threat. More information can be found in the Asymmetric Warfare Briefing Note.

Installations: used with Asymmetric AI Commanders, this will pre-place a number insurgency installations such as recruitment centres and IED factories to enable an established insurgency presence at mission start.

Roadblocks: enables Asymmetric AI Commanders to build roadblocks. Has no effect on other commander types.

Reinforcements: sets the frequency of resupply requests when the Military Logistics module is synced. The AI Commander will send requests for battle casualty replacements when it reaches a given percentage of its start state.

  • Constant: Requests sent at 90% Combat Effectiveness. Effect: Reinforcements will arrive in a constant trickle.
  • Packets: Requests sent at 75% CE. Effect: packets of reinforcements will arrive at intervals.
  • Seldom: Requests sent at 50% CE. Effect: large block of reinforcements will arrive but very rarely.

INTEL: in Asymmetric mode, this plants intel items on enemy combatants that may indicate the location of nearby insurgency installations.

Factions: determines which factions the AI Commander will control. This can be multiple different factions but they must be on the same side.

Max Simultaneous Attacks: Sets the maximum number of objectives that the AI Commander will attack in a cycle, given that he has sufficient groups available to do so. Fewer objectives will result in a slower rate of advance.

Min Recruitment Size: Asymmetric commanders recruit new insurgents from the civilian population. By default, they will establish recruitment centres if there are 2 or more civ pop in a town. Setting the threshold higher will reduce the instances of recruitment centres and slow the rate at which new insurgents are recruited.

Editor Notes

Syncing Virtual AI Commanders to Placements

A key concept to understand is that the AI Commander will only deal with Objectives he knows about. Objectives are defined by the Placement modules (Military, Civilian or Custom) and the AI Commander is 'informed' about these Objectives by syncing the two modules together. Therefore the AI Commander must be synced with every Placement Module that covers an Objective you want them to attack. See the TAOR demo for more details on how to sync modules.

Units Under Command

By default, AI Commanders will take command of all available virtual units (profiles) for its faction. To limit Commanders to a set number of units, manually place some units or groups in the editor and Sync (F5) them to the Virtual AI System module with appropriate settings to ‘convert’ them to profiles. Make sure you select Objectives Only on the Placement Module if you want to prevent it spawning any units.

Halting OPCOM activity

The AI Commander can be stopped and started by syncing a trigger to the module. When all trigger states are TRUE, the Commander will commence attacking the next unsecured objective. If the trigger state returns to False, the Commander will complete any currently assigned objectives then stop. For example, this can be used to stop AI Commander if no players are present on the map.

Custom Objectives

Additional objectives can be placed using the Military Placement (Custom Objectives) module synced to an AI Commander. Additionally, advanced editors can place a location gamelogic of any type on the map and sync it to the Commander module(s). Optionally put in init field of the gamelogic:

this setvariable ["size",150]; this setvariable ["priority", 500];
  • Size is in metres
  • Priority can be any number greater than 1 (999 would be extremely high prio!)

The following function can be used to add or remove Objectives from a script

[_OPCOM,"addObjective",[_id, _pos, _size]] call ALiVE_fnc_OPCOM
[_OPCOM, "removeObjective",_id] call ALiVE_fnc_OPCOM

Dev Notes

The number of groups used by the AI Commander to conduct a recce/attack, reserve or defend operation is determined by the AI Commander's strategy.

Invasion: 4 Attack, 1 Reserve, 2 Defend

Occupation: 4 Attack, 1 Reserve, 5 Defend