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. |
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.
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.
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.
This cycle will continue.
During the patrol, the AI will detect enemy targets, which are reported through the Detected event.
When enemies are detected, the AI will automatically engage the enemy.
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.
1. AI_CAP_ZONE constructor
- AI_CAP_ZONE.New(): Creates a new AI_CAP_ZONE object.
2. AI_CAP_ZONE is a FSM
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
- **AI.AI_Patrol#AI_PATROL_ZONE.Start**: Start the process.
- **AI.AI_Patrol#AI_PATROL_ZONE.Route**: Route the AI to a new random 3D point within the Patrol Zone.
- **AI_CAP_ZONE.Engage**: Let the AI engage the bogeys.
- **AI_CAP_ZONE.Abort**: Aborts the engagement and return patrolling in the patrol zone.
- **AI.AI_Patrol#AI_PATROL_ZONE.RTB**: Route the AI to the home base.
- **AI.AI_Patrol#AI_PATROL_ZONE.Detect**: The AI is detecting targets.
- **AI.AI_Patrol#AI_PATROL_ZONE.Detected**: The AI has detected new targets.
- **AI_CAP_ZONE.Destroy**: The AI has destroyed a bogey Wrapper.Unit.
- **AI_CAP_ZONE.Destroyed**: The AI has destroyed all bogeys Wrapper.Units assigned in the CAS task.
- Status ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
3. Set the Range of Engagement
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
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 |
---|---|
Synchronous Event Trigger for Event Abort. |
|
Synchronous Event Trigger for Event Accomplish. |
|
Synchronous Event Trigger for Event Destroy. |
|
Synchronous Event Trigger for Event Engage. |
|
Synchronous Event Trigger for Event Fired. |
|
Creates a new AI_CAP_ZONE object |
|
OnAfter Transition Handler for Event Abort. |
|
AI_CAP_ZONE:OnAfterAccomplish(Controllable, From, Event, To) |
OnAfter Transition Handler for Event Accomplish. |
OnAfter Transition Handler for Event Destroy. |
|
OnAfter Transition Handler for Event Engage. |
|
OnAfter Transition Handler for Event Fired. |
|
OnBefore Transition Handler for Event Abort. |
|
AI_CAP_ZONE:OnBeforeAccomplish(Controllable, From, Event, To) |
OnBefore Transition Handler for Event Accomplish. |
OnBefore Transition Handler for Event Destroy. |
|
OnBefore Transition Handler for Event Engage. |
|
OnBefore Transition Handler for Event Fired. |
|
OnEnter Transition Handler for State Engaging. |
|
OnLeave Transition Handler for State Engaging. |
|
Set the Engage Range when the AI will engage with airborne enemies. |
|
Set the Engage Zone which defines where the AI will engage bogies. |
|
Asynchronous Event Trigger for Event Abort. |
|
Asynchronous Event Trigger for Event Accomplish. |
|
Asynchronous Event Trigger for Event Destroy. |
|
Asynchronous Event Trigger for Event Engage. |
|
Asynchronous Event Trigger for Event Fired. |
|
AI_CAP_ZONE:onafterAccomplish(Controllable, From, Event, To) |
|
AI_CAP_ZONE:onafterDestroy(Controllable, From, Event, To, EventData) |
|
onafter State Transition for Event Start. |
|
Field(s)
Function(s)
@param AI.AI_CAP#AI_CAP_ZONE @param Wrapper.Group#GROUP EngageGroup
Defined in:
AI_CAP_ZONE
Parameters:
EngageGroup
Fsm
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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:
Wrapper.Controllable#CONTROLLABLE Controllable
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