Banner Image

Module AI.AI_CAP

AI - Perform Combat Air Patrolling (CAP) for airplanes.

Features:

  • Patrol AI airplanes within a given zone.
  • Trigger detected events when enemy airplanes are detected.
  • Manage a fuel threshold to RTB on time.
  • Engage the enemy when detected.

Demo Missions


YouTube Playlist


Author: FlightControl

Contributions:

  • Quax: Concept, Advice & Testing.
  • Pikey: Concept, Advice & Testing.
  • Gunterlund: Test case revision.
  • Whisper: Testing.
  • Delta99: Testing.

Global(s)

Global AI_CAP_ZONE

Implements the core functions to patrol a Core.Zone by an AI Wrapper.Controllable or Wrapper.Group and automatically engage any airborne enemies that are within a certain range or within a certain zone.

#AI_CAP_ZONE AI_CAP_ZONE

Implements the core functions to patrol a Core.Zone by an AI Wrapper.Controllable or Wrapper.Group and automatically engage any airborne enemies that are within a certain range or within a certain zone.

Process

The AI_CAP_ZONE is assigned a Wrapper.Group and this must be done before the AI_CAP_ZONE process can be started using the Start event.

Process

The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.

Process

This cycle will continue.

Process

During the patrol, the AI will detect enemy targets, which are reported through the Detected event.

Process

When enemies are detected, the AI will automatically engage the enemy.

Process

Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB. When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.

Process

1. AI_CAP_ZONE constructor

2. AI_CAP_ZONE is a FSM

Process

2.1 AI_CAP_ZONE States

  • None ( Group ): The process is not started yet.
  • Patrolling ( Group ): The AI is patrolling the Patrol Zone.
  • Engaging ( Group ): The AI is engaging the bogeys.
  • Returning ( Group ): The AI is returning to Base..

2.2 AI_CAP_ZONE Events

3. Set the Range of Engagement

Range

An optional range can be set in meters, that will define when the AI will engage with the detected airborne enemy targets. The range can be beyond or smaller than the range of the Patrol Zone. The range is applied at the position of the AI. Use the method AI_CAP_ZONE.SetEngageRange() to define that range.

4. Set the Zone of Engagement

Zone

An optional Core.Zone can be set, that will define when the AI will engage with the detected airborne enemy targets. Use the method AI_CAP_ZONE.SetEngageZone() to define that Zone.

Developer Note

Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE Therefore, this class is considered to be deprecated


Type(s)

Fields and Methods inherited from AI_CAP_ZONE Description

AI_CAP_ZONE:Abort()

Synchronous Event Trigger for Event Abort.

AI_CAP_ZONE:Accomplish()

Synchronous Event Trigger for Event Accomplish.

AI_CAP_ZONE.Accomplished

AI_CAP_ZONE:Destroy()

Synchronous Event Trigger for Event Destroy.

AI_CAP_ZONE:Engage()

Synchronous Event Trigger for Event Engage.

AI_CAP_ZONE.EngageRange

AI_CAP_ZONE.EngageRoute(EngageGroup, Fsm)

AI_CAP_ZONE.EngageZone

AI_CAP_ZONE.Engaging

AI_CAP_ZONE:Fired()

Synchronous Event Trigger for Event Fired.

AI_CAP_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType)

Creates a new AI_CAP_ZONE object

AI_CAP_ZONE:OnAfterAbort(Controllable, From, Event, To)

OnAfter Transition Handler for Event Abort.

AI_CAP_ZONE:OnAfterAccomplish(Controllable, From, Event, To)

OnAfter Transition Handler for Event Accomplish.

AI_CAP_ZONE:OnAfterDestroy(Controllable, From, Event, To)

OnAfter Transition Handler for Event Destroy.

AI_CAP_ZONE:OnAfterEngage(Controllable, From, Event, To)

OnAfter Transition Handler for Event Engage.

AI_CAP_ZONE:OnAfterFired(Controllable, From, Event, To)

OnAfter Transition Handler for Event Fired.

AI_CAP_ZONE:OnBeforeAbort(Controllable, From, Event, To)

OnBefore Transition Handler for Event Abort.

AI_CAP_ZONE:OnBeforeAccomplish(Controllable, From, Event, To)

OnBefore Transition Handler for Event Accomplish.

AI_CAP_ZONE:OnBeforeDestroy(Controllable, From, Event, To)

OnBefore Transition Handler for Event Destroy.

AI_CAP_ZONE:OnBeforeEngage(Controllable, From, Event, To)

OnBefore Transition Handler for Event Engage.

AI_CAP_ZONE:OnBeforeFired(Controllable, From, Event, To)

OnBefore Transition Handler for Event Fired.

AI_CAP_ZONE:OnEnterEngaging(Controllable, From, Event, To)

OnEnter Transition Handler for State Engaging.

AI_CAP_ZONE:OnEventDead(EventData)

AI_CAP_ZONE:OnLeaveEngaging(Controllable, From, Event, To)

OnLeave Transition Handler for State Engaging.

AI_CAP_ZONE:SetEngageRange(EngageRange)

Set the Engage Range when the AI will engage with airborne enemies.

AI_CAP_ZONE:SetEngageZone(EngageZone)

Set the Engage Zone which defines where the AI will engage bogies.

AI_CAP_ZONE:__Abort(Delay)

Asynchronous Event Trigger for Event Abort.

AI_CAP_ZONE:__Accomplish(Delay)

Asynchronous Event Trigger for Event Accomplish.

AI_CAP_ZONE:__Destroy(Delay)

Asynchronous Event Trigger for Event Destroy.

AI_CAP_ZONE:__Engage(Delay)

Asynchronous Event Trigger for Event Engage.

AI_CAP_ZONE:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

AI_CAP_ZONE:onafterAbort(Controllable, From, Event, To)

AI_CAP_ZONE:onafterAccomplish(Controllable, From, Event, To)

AI_CAP_ZONE:onafterDestroy(Controllable, From, Event, To, EventData)

AI_CAP_ZONE:onafterDetected(Controllable, From, Event, To)

AI_CAP_ZONE:onafterEngage(Controllable, From, Event, To)

AI_CAP_ZONE:onafterStart(Controllable, From, Event, To)

onafter State Transition for Event Start.

AI_CAP_ZONE:onbeforeEngage(Controllable, From, Event, To)

Field(s)

Function(s)

Synchronous Event Trigger for Event Abort.

Defined in:

AI_CAP_ZONE

Synchronous Event Trigger for Event Accomplish.

Defined in:

AI_CAP_ZONE

Synchronous Event Trigger for Event Destroy.

Defined in:

AI_CAP_ZONE

Synchronous Event Trigger for Event Engage.

Defined in:

AI_CAP_ZONE

@param AI.AI_CAP#AI_CAP_ZONE @param Wrapper.Group#GROUP EngageGroup

Defined in:

AI_CAP_ZONE

Parameters:

EngageGroup

Fsm

Synchronous Event Trigger for Event Fired.

Defined in:

AI_CAP_ZONE

Creates a new AI_CAP_ZONE object

Defined in:

AI_CAP_ZONE

Parameters:

Core.Zone#ZONE_BASE PatrolZone

The Core.Zone where the patrol needs to be executed.

DCS#Altitude PatrolFloorAltitude

The lowest altitude in meters where to execute the patrol.

DCS#Altitude PatrolCeilingAltitude

The highest altitude in meters where to execute the patrol.

DCS#Speed PatrolMinSpeed

The minimum speed of the Wrapper.Controllable in km/h.

DCS#Speed PatrolMaxSpeed

The maximum speed of the Wrapper.Controllable in km/h.

DCS#AltitudeType PatrolAltType

The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO

Return value:

self

OnAfter Transition Handler for Event Abort.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnAfter Transition Handler for Event Accomplish.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnAfter Transition Handler for Event Destroy.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnAfter Transition Handler for Event Engage.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnAfter Transition Handler for Event Fired.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnBefore Transition Handler for Event Abort.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnBefore Transition Handler for Event Accomplish.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnBefore Transition Handler for Event Destroy.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnBefore Transition Handler for Event Engage.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnBefore Transition Handler for Event Fired.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnEnter Transition Handler for State Engaging.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

@param #AI_CAP_ZONE self @param Core.Event#EVENTDATA EventData

Defined in:

AI_CAP_ZONE

Parameter:

EventData

OnLeave Transition Handler for State Engaging.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

Set the Engage Range when the AI will engage with airborne enemies.

Defined in:

AI_CAP_ZONE

Parameter:

#number EngageRange

The Engage Range.

Return value:

self

Set the Engage Zone which defines where the AI will engage bogies.

Defined in:

AI_CAP_ZONE

Parameter:

Core.Zone#ZONE EngageZone

The zone where the AI is performing CAP.

Return value:

self

Asynchronous Event Trigger for Event Abort.

Defined in:

AI_CAP_ZONE

Parameter:

#number Delay

The delay in seconds.

Asynchronous Event Trigger for Event Accomplish.

Defined in:

AI_CAP_ZONE

Parameter:

#number Delay

The delay in seconds.

Asynchronous Event Trigger for Event Destroy.

Defined in:

AI_CAP_ZONE

Parameter:

#number Delay

The delay in seconds.

Asynchronous Event Trigger for Event Engage.

Defined in:

AI_CAP_ZONE

Parameter:

#number Delay

The delay in seconds.

Asynchronous Event Trigger for Event Fired.

Defined in:

AI_CAP_ZONE

Parameter:

#number Delay

The delay in seconds.

@param #AI_CAP_ZONE self @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. @param #string From The From State string. @param #string Event The Event string. @param #string To The To State string.

Defined in:

AI_CAP_ZONE

Parameters:

Controllable

From

Event

To

@param #AI_CAP_ZONE self @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. @param #string From The From State string. @param #string Event The Event string. @param #string To The To State string.

Defined in:

AI_CAP_ZONE

Parameters:

Controllable

From

Event

To

@param #AI_CAP_ZONE self @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. @param #string From The From State string. @param #string Event The Event string. @param #string To The To State string. @param Core.Event#EVENTDATA EventData

Defined in:

AI_CAP_ZONE

Parameters:

Controllable

From

Event

To

EventData

@param #AI_CAP_ZONE self @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. @param #string From The From State string. @param #string Event The Event string. @param #string To The To State string.

Defined in:

AI_CAP_ZONE

Parameters:

Controllable

From

Event

To

@param #AI_CAP_ZONE self @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. @param #string From The From State string. @param #string Event The Event string. @param #string To The To State string.

Defined in:

AI_CAP_ZONE

Parameters:

Controllable

From

Event

To

onafter State Transition for Event Start.

Defined in:

AI_CAP_ZONE

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

@param #AI_CAP_ZONE self @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. @param #string From The From State string. @param #string Event The Event string. @param #string To The To State string.

Defined in:

AI_CAP_ZONE

Parameters:

Controllable

From

Event

To