Module AI_Cap

AI -- (R2.1) - Manages the independent process of Combat Air Patrol (CAP) for airplanes.


Banner Image


Demo Missions


YouTube Playlist


Author: FlightControl

Contributions:


Global(s)

AI_CAP_ZONE

AICAPZONE class, extends AI_CAP#AI_PATROL_ZONE

The AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group and automatically engage any airborne enemies that are within a certain range or within a certain zone.

Type AI_CAP_ZONE

AI_CAP_ZONE.AIControllable

The Controllable patrolling.

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(AI, 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 AICAPZONE 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.TargetZone

The Zone where the patrol needs to be executed.

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)

Global(s)

#AI_CAP_ZONE AI_CAP_ZONE

AICAPZONE class, extends AI_CAP#AI_PATROL_ZONE

The AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group and automatically engage any airborne enemies that are within a certain range or within a certain zone.

Process

The AICAPZONE is assigned a Group and this must be done before the AICAPZONE 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 treshold has been reached by the AI, or when the AI is commanded to RTB. When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.

Process

1. AICAPZONE constructor

2. AICAPZONE is a FSM

Process

2.1 AICAPZONE 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 AICAPZONE 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#AI_CAP_ZONE.SetEngageRange() to define that range.

4. Set the Zone of Engagement

Zone

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


Type AI_Cap

Type AI_CAP_ZONE

Extends AI.AI_Patrol#AI_PATROL_ZONE

Field(s)

Wrapper.Controllable#CONTROLLABLE AI_CAP_ZONE.AIControllable

The Controllable patrolling.

AI_CAP_ZONE:Abort()

Synchronous Event Trigger for Event Abort.

AI_CAP_ZONE:Accomplish()

Synchronous Event Trigger for Event Accomplish.

#boolean 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(AI, EngageGroup, Fsm)

Parameters

AI_CAP_ZONE.EngageZone
#boolean 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 AICAPZONE object

Parameters

Return value

#AI_CAP_ZONE: self

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

OnAfter Transition Handler for Event Abort.

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.

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

OnAfter Transition Handler for Event Accomplish.

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.

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

OnAfter Transition Handler for Event Destroy.

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.

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

OnAfter Transition Handler for Event Engage.

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.

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

OnAfter Transition Handler for Event Fired.

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.

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

OnBefore Transition Handler for Event Abort.

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.

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

OnBefore Transition Handler for Event Accomplish.

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.

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

OnBefore Transition Handler for Event Destroy.

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.

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

OnBefore Transition Handler for Event Engage.

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.

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

OnBefore Transition Handler for Event Fired.

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.

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

OnEnter Transition Handler for State Engaging.

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.

AI_CAP_ZONE:OnEventDead(EventData)

Parameter

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

OnLeave Transition Handler for State Engaging.

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.

AI_CAP_ZONE:SetEngageRange(EngageRange)

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

Parameter

  • #number EngageRange : The Engage Range.

Return value

#AI_CAP_ZONE: self

AI_CAP_ZONE:SetEngageZone(EngageZone)

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

Parameter

  • Core.Zone#ZONE EngageZone : The zone where the AI is performing CAP.

Return value

#AI_CAP_ZONE: self

Core.Zone#ZONE_BASE AI_CAP_ZONE.TargetZone

The Zone where the patrol needs to be executed.

AI_CAP_ZONE:__Abort(Delay)

Asynchronous Event Trigger for Event Abort.

Parameter

  • #number Delay : The delay in seconds.

AI_CAP_ZONE:__Accomplish(Delay)

Asynchronous Event Trigger for Event Accomplish.

Parameter

  • #number Delay : The delay in seconds.

AI_CAP_ZONE:__Destroy(Delay)

Asynchronous Event Trigger for Event Destroy.

Parameter

  • #number Delay : The delay in seconds.

AI_CAP_ZONE:__Engage(Delay)

Asynchronous Event Trigger for Event Engage.

Parameter

  • #number Delay : The delay in seconds.

AI_CAP_ZONE:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

Parameter

  • #number Delay : The delay in seconds.

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

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.

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

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.

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

Parameters

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

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.

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

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.

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

onafter State Transition for Event Start.

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.

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

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.