From 5a7551d3124667094d7593fba6c3ac7fc06947c7 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Tue, 13 Jun 2017 13:17:17 +0200 Subject: [PATCH] Progress --- Moose Development/Moose/AI/AI_A2A.lua | 8 +- Moose Development/Moose/AI/AI_A2A_Cap.lua | 8 +- .../Moose/AI/AI_A2A_Dispatcher.lua | 333 +- Moose Development/Moose/AI/AI_A2A_Gci.lua | 3 +- Moose Development/Moose/Core/Base.lua | 4 +- .../Moose/Functional/Detection.lua | 8 +- Moose Development/Moose/Functional/Spawn.lua | 2 +- .../bin/TreeHierarchy.csv | 2 + docs/Documentation/AI_A2A.html | 1822 ++++++++++ docs/Documentation/AI_A2A_Cap.html | 1712 +++++++++ docs/Documentation/AI_A2A_Dispatcher.html | 3159 +++++++++++++++++ docs/Documentation/AI_A2A_GCI.html | 1566 ++++++++ docs/Documentation/AI_A2A_Patrol.html | 1093 ++++++ docs/Documentation/AI_BAI.html | 5 + docs/Documentation/AI_Balancer.html | 5 + docs/Documentation/AI_Cap.html | 5 + docs/Documentation/AI_Cas.html | 5 + docs/Documentation/AI_Formation.html | 5 + docs/Documentation/AI_Patrol.html | 8 +- docs/Documentation/Account.html | 5 + docs/Documentation/Airbase.html | 25 + docs/Documentation/AirbasePolice.html | 5 + docs/Documentation/Assign.html | 5 + docs/Documentation/Base.html | 5 + docs/Documentation/Cargo.html | 6 + docs/Documentation/CleanUp.html | 5 + docs/Documentation/Client.html | 5 + docs/Documentation/CommandCenter.html | 5 + docs/Documentation/Controllable.html | 244 ++ docs/Documentation/DCSAirbase.html | 5 + docs/Documentation/DCSCoalitionObject.html | 5 + docs/Documentation/DCSCommand.html | 5 + docs/Documentation/DCSController.html | 5 + docs/Documentation/DCSGroup.html | 5 + docs/Documentation/DCSObject.html | 5 + docs/Documentation/DCSTask.html | 5 + docs/Documentation/DCSTypes.html | 5 + docs/Documentation/DCSUnit.html | 5 + docs/Documentation/DCSVec3.html | 5 + docs/Documentation/DCSWorld.html | 5 + docs/Documentation/DCSZone.html | 5 + docs/Documentation/DCScountry.html | 5 + docs/Documentation/DCStimer.html | 5 + docs/Documentation/DCStrigger.html | 5 + docs/Documentation/Database.html | 5 + docs/Documentation/Designate.html | 6 + docs/Documentation/Detection.html | 41 +- docs/Documentation/DetectionManager.html | 255 ++ docs/Documentation/Escort.html | 5 + docs/Documentation/Event.html | 5 + docs/Documentation/Fsm.html | 8 +- docs/Documentation/Group.html | 135 + docs/Documentation/Identifiable.html | 5 + docs/Documentation/Menu.html | 5 + docs/Documentation/Message.html | 5 + docs/Documentation/MissileTrainer.html | 5 + docs/Documentation/Mission.html | 5 + docs/Documentation/Movement.html | 5 + docs/Documentation/Object.html | 5 + docs/Documentation/Point.html | 9 +- docs/Documentation/Positionable.html | 52 +- docs/Documentation/Process_JTAC.html | 5 + docs/Documentation/Process_Pickup.html | 5 + docs/Documentation/Radio.html | 5 + docs/Documentation/Route.html | 5 + docs/Documentation/Scenery.html | 5 + docs/Documentation/ScheduleDispatcher.html | 8 +- docs/Documentation/Scheduler.html | 5 + docs/Documentation/Scoring.html | 5 + docs/Documentation/Sead.html | 5 + docs/Documentation/Set.html | 29 + docs/Documentation/Settings.html | 5 + docs/Documentation/Smoke.html | 5 + docs/Documentation/Spawn.html | 224 +- docs/Documentation/SpawnStatic.html | 5 + docs/Documentation/Spot.html | 9 +- docs/Documentation/Static.html | 5 + docs/Documentation/StaticObject.html | 5 + docs/Documentation/Task.html | 5 + docs/Documentation/Task_A2A.html | 5 + docs/Documentation/Task_A2A_Dispatcher.html | 5 + docs/Documentation/Task_A2G.html | 5 + docs/Documentation/Task_A2G_Dispatcher.html | 5 + docs/Documentation/Task_Cargo.html | 8 +- docs/Documentation/Task_PICKUP.html | 5 + docs/Documentation/Unit.html | 5 + docs/Documentation/Utils.html | 40 + docs/Documentation/Zone.html | 5 + docs/Documentation/env.html | 5 + docs/Documentation/index.html | 62 + docs/Documentation/land.html | 5 + docs/Documentation/routines.html | 5 + 92 files changed, 11076 insertions(+), 118 deletions(-) create mode 100644 docs/Documentation/AI_A2A.html create mode 100644 docs/Documentation/AI_A2A_Cap.html create mode 100644 docs/Documentation/AI_A2A_Dispatcher.html create mode 100644 docs/Documentation/AI_A2A_GCI.html create mode 100644 docs/Documentation/AI_A2A_Patrol.html diff --git a/Moose Development/Moose/AI/AI_A2A.lua b/Moose Development/Moose/AI/AI_A2A.lua index f45c8c36d..d5e8317fe 100644 --- a/Moose Development/Moose/AI/AI_A2A.lua +++ b/Moose Development/Moose/AI/AI_A2A.lua @@ -12,7 +12,7 @@ -- -- @module AI_A2A -BASE:TraceClass("AI_A2A") +--BASE:TraceClass("AI_A2A") --- @type AI_A2A @@ -437,13 +437,15 @@ end function AI_A2A:onafterRTB( AIGroup, From, Event, To ) self:F( { AIGroup, From, Event, To } ) - self:E( "Group " .. self.Controllable:GetName() .. " ... Returning! ( " .. self:GetState() .. " )" ) + self:E( "Group " .. self.Controllable:GetName() .. " ... RTB! ( " .. self:GetState() .. " )" ) if AIGroup and AIGroup:IsAlive() then self.CheckStatus = false self:ClearTargetDistance() + AIGroup:ClearTasks() + AIGroup:ClearTasks() local EngageRoute = {} @@ -488,7 +490,7 @@ function AI_A2A:onafterRTB( AIGroup, From, Event, To ) AIGroup:SetState( AIGroup, "AI_A2A", self ) --- NOW ROUTE THE GROUP! - AIGroup:WayPointExecute( 1, 2 ) + AIGroup:WayPointExecute( 1, 0 ) end diff --git a/Moose Development/Moose/AI/AI_A2A_Cap.lua b/Moose Development/Moose/AI/AI_A2A_Cap.lua index 3a6607d65..64846ae01 100644 --- a/Moose Development/Moose/AI/AI_A2A_Cap.lua +++ b/Moose Development/Moose/AI/AI_A2A_Cap.lua @@ -350,7 +350,7 @@ end --- @param Wrapper.Group#GROUP AIGroup function AI_A2A_CAP.AttackRoute( AIGroup ) - local EngageZone = AIGroup:GetState( AIGroup, "EngageZone" ) -- AI.AI_Cap#AI_A2A_CAP + local EngageZone = AIGroup:GetState( AIGroup, "AI_A2A_CAP" ) -- AI.AI_Cap#AI_A2A_CAP EngageZone:__Engage( 0.5 ) end @@ -438,14 +438,16 @@ function AI_A2A_CAP:onafterEngage( AIGroup, From, Event, To, AttackSetUnit ) self:__Abort( 0.5 ) else AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, #AttackTasks, "AI_A2A_CAP.AttackRoute" ) + AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( 4000, self.PatrolMinSpeed ) + EngageRoute[1].task = AIGroup:TaskCombo( AttackTasks ) --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... - AIGroup:SetState( AIGroup, "EngageZone", self ) + AIGroup:SetState( AIGroup, "AI_A2A_CAP", self ) end --- NOW ROUTE THE GROUP! - AIGroup:WayPointExecute( 1, 2 ) + AIGroup:WayPointExecute( 1, 0 ) end else self:E("No targets found -> Going back to Patrolling") diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index 35263c50a..e7d811fa4 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -1,8 +1,9 @@ ---- **AI** - The AI_A2A_DISPATCHER creates and manages AI_A2A tasks based on detected targets. +--- **AI** - The AI_A2A_DISPATCHER creates an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI. -- -- ==== -- --- ### Author: **Sven Van de Velde (FlightControl)** +-- ### Authors: **Sven Van de Velde (FlightControl)** +-- **Stonehouse** -- -- ### Contributions: -- @@ -10,7 +11,7 @@ -- -- @module AI_A2A_Dispatcher -BASE:TraceClass("AI_A2A_DISPATCHER") +--BASE:TraceClass("AI_A2A_DISPATCHER") do -- AI_A2A_DISPATCHER @@ -30,44 +31,14 @@ do -- AI_A2A_DISPATCHER -- Note that in order to create a two way A2A defense system, two AI_A2A_DISPATCHER defense system may need to be created, for each coalition one. -- This is a good implementation, because maybe in the future, more coalitions may become available in DCS world. -- - -- ## AI_A2A_DISPATCHER constructor: + -- ## 1. AI_A2A_DISPATCHER constructor: -- -- The @{#AI_A2A_DISPATCHER.New}() method creates a new AI_A2A_DISPATCHER instance. - -- There are two parameters required, a @{Set#SET_GROUP} that defines the groups within the EWR network, and a radius in meters, that will be used to group detected targets. + -- There are two parameters required, a @{Set#SET_GROUP} that defines the Groups of the EWR network, and a radius in meters, that will be used to group the detected targets. -- - -- ## Which countries will be selected for each coalition? + -- The @{#AI_A2A_DISPATCHER.New}() method is used to setup the EWR network and to define the grouping. -- - -- Which countries are assigned to a coalition influences which units are available to the coalition. - -- For example because the mission calls for a EWR radar on the blue side the Ukraine might be chosen as a blue country - -- so that the 55G6 EWR radar unit is available to blue. - -- Some countries assign different tasking to aircraft, for example Germany assigns the CAP task to F-4E Phantoms but the USA does not. - -- Therefore if F4s are wanted as a coalition’s CAP or GCI aircraft Germany will need to be assigned to that coalition. - -- - -- ## Area of red and blue territories? - -- - -- According to the tactical and strategic design of the mission broadly decide the shape and extent of red and blue territories. - -- They should be laid out such that a border area is created between the two coalitions. - -- - -- See more below regarding borders. - -- - -- ## Is it a hot or cold war? - -- - -- Define a border area to simulate a **cold war** scenario and use the method @{#AI_A2A_DISPATCHER.InitBorderZone}() to create a border zone for the dispatcher. - -- - -- A **cold war** is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border. - -- A **hot war** is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it. - -- If it’s a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Zone#ZONE_BASE}. - -- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1 - -- - -- ## Which squadrons act at which airfields within their territory? - -- - -- **Squadrons** operate at defined airfields, have specific plane types and have limited resources. - -- - -- Use the method @{#AI_A2A_DISPATCHER.SetSquadron}() to setup a new squadron active at an airfield, while defining which plane types are being used by the squadron and how many resources are available. - -- Note that squadrons have specific settings that need to be specified using the Squadron... methods. - -- The name of the squadron given acts as the **squadron key** in the AI_A2A_DISPATCHER:Squadron...() methods. - -- - -- ## How are EWR networks defined? + -- ### 1.1. Define the EWR network: -- -- Typically EWR networks are setup using 55G6 EWR, 1L13 EWR, Hawk sr and Patriot str ground based radar units. -- These radars have different ranges and 55G6 EWR and 1L13 EWR radars are Eastern Bloc units (eg Russia, Ukraine, Georgia) while the Hawk and Patriot radars are Western (eg US). @@ -85,37 +56,118 @@ do -- AI_A2A_DISPATCHER -- By defining in a smart way the names or name prefixes of the groups of EWR capable units, these units will be automatically added or deleted from the EWR network, -- increasing or decreasing the radar coverage of the Early Warning System. -- - -- ## How many CAP zones will be required and where will they be located? + -- See the following example to setup an EWR network containing EWR stations and AWACS. -- - -- * CAP zones are patrol areas where Combat Air Patrol (CAP) flights loiter until they either return to base due to low fuel or are assigned an interception task by ground control. - -- - -- * As the CAP flights wander around within the zone waiting to be tasked these zones need to be large enough that the aircraft are not constantly turning - -- but do not have to be big and numerous enough to completely cover a border. - -- - -- * CAP zones can be of any type, and are derived from the @{Zone#ZONE_BASE} class. Zones can be @{Zone#ZONE}, @{Zone#ZONE_POLYGON}, @{Zone#ZONE_UNIT}, @{Zone#GROUP}, etc. - -- This allows to setup static, moveable or complex zones wherein aircraft will perform the CAP. - -- - -- * Typically 20000-50000 metres radius is used and they are spaced so that aircraft in the zone waiting for tasks don’t have to far to travel to protect their coalitions important targets. - -- These targets are chosen as part of the mission design and might be an important airfield or town etc. - -- Zone size is also determined somewhat by territory size, plane types (eg WW2 aircraft might mean smaller zones or more zones because they are slower and take longer to intercept enemy aircraft) - -- - -- * In a cold war it is important to make sure a CAP zone doesn’t intrude into enemy territory as otherwise CAP flights will likely cross borders - -- and spark a full scale conflict which will escalate rapidly. - -- - -- * CAP flights must travel to a CAP zone before they are “on station” and ready for tasking. - -- Therefore if their airfield is in their CAP zone they are on station immediately. - -- You might not do this though if having the airfield in the CAP zone allows it to be attacked easily so might position the CAP zone closer - -- to the border and accept the period of time a CAP flight will be unavailable for tasking while they travel to their zone. - -- - -- * Typically if a CAP flight is tasked and therefore leaves their zone empty while they go off and intercept their target another CAP flight will spawn to take their place. - -- - -- CAP zones need to be setup per squadron. The method @{#AI_A2A_DISPATCHER.SetSquadronCap() defines a CAP zone for a squadron. - -- Setting-up a CAP zone also requires specific parameters, like the minimum and maximum altitude, minimum speed and maximum speed and the altitude type that define how the - -- squadron will perform the CAP while partrolling. Different terrain types requires different types of CAP. - -- - -- ## How many aircraft will CAP or GCI and how will they be grouped? + -- -- Define a SET_GROUP object that builds a collection of groups that define the EWR network. + -- -- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. + -- DetectionSetGroup = SET_GROUP:New() + -- DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) + -- DetectionSetGroup:FilterStart() + -- + -- -- Setup the A2A dispatcher, and initialize it. + -- A2ADispatcher = AI_A2A_DISPATCHER:New( DetectionSetGroup, 30000 ) -- - -- Choices are 1, 2, 3 or 4 when CAP flights spawn. Use the method @{#AI_A2A_DISPATCHER.SetSquadronGrouping}() to set the amount of CAP flights that will take-off when spawned. + -- The above example creates a SET_GROUP instance, and stores this in the variable (object) **DetectionSetGroup**. + -- **DetectionSetGroup** is then being configured to filter all active groups with a group name starting with **DF CCCP AWACS** or **DF CCCP EWR** to be included in the Set. + -- **DetectionSetGroup** is then being ordered to start the dynamic filtering. Note that any destroy or new spawn of a group with the above names will be removed or added to the Set. + -- The **DetectionSetGroup** variable is then passed to the @{#AI_A2A_DISPATCHER.New}() method to indicate the EWR network configuration and setup the A2A defense detection mechanism. + -- As a second parameter of the @{#AI_A2A_DISPATCHER.New}() method, 30000 indicates that detected targets need to be grouped within a radius of 30km. + -- The grouping radius should not be too small, but also depends on the types of planes and the era of the simulation. + -- Fast planes like in the 80s, need a larger radius than WWII planes. + -- Typically I suggest to use 30000 for new generation planes and 10000 for older era aircraft. + -- + -- Note that detected targets are constantly re-grouped, that is, when certain detected aircraft are moving further than the group radius, then these aircraft will become a separate + -- group being detected. This may result in additional GCI being started by the dispatcher! So don't make this value too small! + -- + -- ## 2. Set the **engage radius**: + -- + -- Define the radius to engage any target by airborne friendlies, which are executing cap or returning from an intercept mission. + -- So, if there is a target area detected and reported, + -- then any friendlies that are airborne near this target area, + -- will be commanded to (re-)engage that target when available (if no other tasks were commanded). + -- For example, if 100000 is given as a value, then any friendly that is airborne within 100km from the detected target, + -- will be considered to receive the command to engage that target area. + -- You need to evaluate the value of this parameter carefully. + -- If too small, more intercept missions may be triggered upon detected target areas. + -- If too large, any airborne cap may not be able to reach the detected target area in time, because it is too far. + -- + -- ## 3. Set the **borders**: + -- + -- According to the tactical and strategic design of the mission broadly decide the shape and extent of red and blue territories. + -- They should be laid out such that a border area is created between the two coalitions. + -- + -- Define a border area to simulate a **cold war** scenario and use the method @{#AI_A2A_DISPATCHER.SetBorderZone}() to create a border zone for the dispatcher. + -- + -- A **cold war** is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border. + -- A **hot war** is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it. + -- If it’s a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Zone#ZONE_BASE}. + -- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1 + -- + -- ## 4. Squadrons: + -- + -- The AI_A2A_DISPATCHER works with **Squadrons**, that need to be defined using the different methods available. + -- + -- Use the method @{#AI_A2A_DISPATCHER.SetSquadron}() to **setup a new squadron** active at an airfield, + -- while defining which plane types are being used by the squadron and how many resources are available. + -- + -- Squadrons: + -- + -- * Have name (string) that is the identifier or key of the squadron. + -- * Have specific plane types. + -- * Are located at one airbase. + -- * Have a limited set of resources. + -- + -- The name of the squadron given acts as the **squadron key** in the AI_A2A_DISPATCHER:Squadron...() methods. + -- + -- Additionally, squadrons have specific configuration options to: + -- + -- * Control how new aircraft are taking off from the airfield (in the air, cold, hot, at the runway). + -- * Control how returning aircraft are landing at the airfield (in the air near the airbase, after landing, after engine shutdown). + -- * Control the **grouping** of new aircraft spawned at the airfield. If there is more than one aircraft to be spawned, these may be grouped. + -- * Control the **overhead** or defensive strength of the squadron. Depending on the types of planes and amount of resources, the mission designer can choose to increase or reduce the amount of planes spawned. + -- + -- For performance and bug workaround reasons within DCS, squadrons have different methods to spawn new aircraft or land returning or damaged aircraft. + -- + -- + -- ### 4.1. Set squadron take-off methods + -- + -- Use the various SetSquadronTakeoff... methods to control how squadrons are taking-off from the airfield: + -- + -- * @{#AI_A2A_DISPATCHER.SetSquadronTakeoff}() is the generic configuration method to control takeoff from the air, hot, cold or from the runway. See the method for further details. + -- * @{#AI_A2A_DISPATCHER.SetSquadronTakeoffInAir}() will spawn new aircraft from the squadron directly in the air. + -- * @{#AI_A2A_DISPATCHER.SetSquadronTakeoffFromParkingCold}() will spawn new aircraft in without running engines at a parking spot at the airfield. + -- * @{#AI_A2A_DISPATCHER.SetSquadronTakeoffFromParkingHot}() will spawn new aircraft in with running engines at a parking spot at the airfield. + -- * @{#AI_A2A_DISPATCHER.SetSquadronTakeoffFromRunway}() will spawn new aircraft at the runway at the airfield. + -- + -- Use these methods to fine-tune for specific airfields that are known to create bottlenecks, or have reduced airbase efficiency. + -- The more and the longer aircraft need to taxi at an airfield, the more risk there is that: + -- + -- * aircraft will stop waiting for each other or for a landing aircraft before takeoff. + -- * aircraft may get into a "dead-lock" situation, where two aircraft are blocking each other. + -- * aircraft may collide at the airbase. + -- * aircraft may be awaiting the landing of a plane currently in the air, but never lands ... + -- + -- Currently within the DCS engine, the airfield traffic coordination is erroneous and contains a lot of bugs. + -- If you experience while testing problems with aircraft take-off or landing, please use one of the above methods as a solution to workaround these issues! + -- + -- ### 4.2. Set squadron landing methods + -- + -- In analogy with takeoff, the landing methods are to control how squadrons land at the airfield: + -- + -- * @{#AI_A2A_DISPATCHER.SetSquadronLanding}() is the generic configuration method to control landing, namely despawn the aircraft near the airfield in the air, right after landing, or at engine shutdown. + -- * @{#AI_A2A_DISPATCHER.SetSquadronLandingNearAirbase}() will despawn the returning aircraft in the air when near the airfield. + -- * @{#AI_A2A_DISPATCHER.SetSquadronLandingAtRunway}() will despawn the returning aircraft directly after landing at the runway. + -- * @{#AI_A2A_DISPATCHER.SetSquadronLandingAtEngineShutdown}() will despawn the returning aircraft when the aircraft has returned to its parking spot and has turned off its engines. + -- + -- You can use these methods to minimize the airbase coodination overhead and to increase the airbase efficiency. + -- When there are lots of aircraft returning for landing, at the same airbase, the takeoff process will be halted, which can cause a complete failure of the + -- A2A defense system, as no new CAP or GCI planes can takeoff. + -- Note that the method @{#AI_A2A_DISPATCHER.SetSquadronLandingNearAirbase}() will only work for returning aircraft, not for damaged or out of fuel aircraft. + -- Damaged or out-of-fuel aircraft are returning to the nearest friendly airbase and will land, and are out of control from ground control. + -- + -- ### 4.3. Set squadron grouping + -- + -- Choices are 1, 2, 3 or 4 when CAP or GCI flights spawn. Use the method @{#AI_A2A_DISPATCHER.SetSquadronGrouping}() to set the amount of CAP or GCI flights that will take-off when spawned. -- In the case of GCI, the @{#AI_A2A_DISPATCHER.SetSquadronGrouping}() method has additional behaviour. When there aren't enough CAP flights airborne, a GCI will be initiated for the remaining -- targets to be engaged. Depending on the grouping parameter, the spawned flights for GCI are grouped into this setting. -- For example with a group setting of 2, if 3 targets are detected and cannot be engaged by CAP or any airborne flight, @@ -123,29 +175,122 @@ do -- AI_A2A_DISPATCHER -- -- The **grouping value is set for a Squadron**, and can be **dynamically adjusted** during mission execution, so to adjust the defense flights grouping when the tactical situation changes. -- - -- ## How to balance or setup effective air defenses in case of GCI? + -- ### 4.4. Balance or setup effectiveness of the air defenses in case of GCI -- - -- Overhead The %-tage of Units that dispatching command will allocate to intercept in surplus of detected amount of units. - -- The default overhead is 1, so equal balance. The @{#AI_A2A_DISPATCHER.SetOverhead}() method can be used to tweak the defense strength, - -- taking into account the plane types of the squadron. For example, a MIG-31 with full long-distance A2A missiles payload, may still be less effective than a F-15C with short missiles... + -- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units. + -- The **default value** of the overhead parameter is 1.0, which means **equal balance**. -- + -- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed. + -- + -- The @{#AI_A2A_DISPATCHER.SetOverhead}() method can be used to tweak the defense strength, + -- taking into account the plane types of the squadron. + -- + -- For example, a MIG-31 with full long-distance A2A missiles payload, may still be less effective than a F-15C with short missiles... -- So in this case, one may want to use the @{#AI_A2A_DISPATCHER.SetOverhead}() method to allocate more defending planes as the amount of detected attacking planes. -- The overhead must be given as a decimal value with 1 as the neutral value, which means that overhead values: -- - -- * Higher than 1, will increase the defense unit amounts. - -- * Lower than 1, will decrease the defense unit amounts. + -- * Higher than 1.0, for example 1.5, will increase the defense unit amounts. For 4 planes detected, 6 planes will be spawned. + -- * Lower than 1, for example 0.75, will decrease the defense unit amounts. For 4 planes detected, only 3 planes will be spawned. -- -- The amount of defending units is calculated by multiplying the amount of detected attacking planes as part of the detected group -- multiplied by the Overhead and rounded up to the smallest integer. -- -- The **overhead value is set for a Squadron**, and can be **dynamically adjusted** during mission execution, so to adjust the defense overhead when the tactical situation changes. + -- + -- ## 5. Setup a squadron for CAP -- - -- ## Number of spawned and active GCI interceptor flights for each coalition? + -- ### 5.1. Set the CAP zones + -- + -- * CAP zones are patrol areas where Combat Air Patrol (CAP) flights loiter until they either return to base due to low fuel or are assigned an interception task by ground control. + -- + -- * As the CAP flights wander around within the zone waiting to be tasked, these zones need to be large enough that the aircraft are not constantly turning + -- but do not have to be big and numerous enough to completely cover a border. + -- + -- * CAP zones can be of any type, and are derived from the @{Zone#ZONE_BASE} class. Zones can be @{Zone#ZONE}, @{Zone#ZONE_POLYGON}, @{Zone#ZONE_UNIT}, @{Zone#ZONE_GROUP}, etc. + -- This allows to setup **static, moving and/or complex zones** wherein aircraft will perform the CAP. + -- + -- * Typically 20000-50000 metres width is used and they are spaced so that aircraft in the zone waiting for tasks don’t have to far to travel to protect their coalitions important targets. + -- These targets are chosen as part of the mission design and might be an important airfield or town etc. + -- Zone size is also determined somewhat by territory size, plane types + -- (eg WW2 aircraft might mean smaller zones or more zones because they are slower and take longer to intercept enemy aircraft). + -- + -- * In a **cold war** it is important to make sure a CAP zone doesn’t intrude into enemy territory as otherwise CAP flights will likely cross borders + -- and spark a full scale conflict which will escalate rapidly. + -- + -- * CAP flights do not need to be in the CAP zone before they are “on station” and ready for tasking. + -- + -- * Typically if a CAP flight is tasked and therefore leaves their zone empty while they go off and intercept their target another CAP flight will spawn to take their place. + -- + -- The following example illustrates how CAP zones are coded: + -- + -- -- CAP Squadron execution. + -- CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) + -- A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) + -- A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) + -- + -- CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) + -- A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) + -- A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + -- + -- CAPZoneMiddle = ZONE:New( "CAP Zone Middle") + -- A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) + -- A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + -- + -- Note the different @{Zone} MOOSE classes being used to create zones of different types. Please click the @{Zone} link for more information about the different zone types. + -- Zones can be circles, can be setup in the mission editor using trigger zones, but can also be setup in the mission editor as polygons and in this case GROUP objects are being used! + -- + -- ## 5.2. Set the squadron to execute CAP: + -- + -- The method @{#AI_A2A_DISPATCHER.SetSquadronCap}() defines a CAP execution for a squadron. + -- + -- Setting-up a CAP zone also requires specific parameters: + -- + -- * The minimum and maximum altitude + -- * The minimum speed and maximum patrol speed + -- * The minimum and maximum engage speed + -- * The type of altitude measurement + -- + -- These define how the squadron will perform the CAP while partrolling. Different terrain types requires different types of CAP. + -- + -- The @{#AI_A2A_DISPATCHER.SetSquadronCapInterval}() method specifies **how much** and **when** CAP flights will takeoff. + -- + -- It is recommended not to overload the air defense with CAP flights, as these will decrease the performance of the overall system. + -- + -- For example, the following setup will create a CAP for squadron "Sochi": + -- + -- A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) + -- A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + -- + -- ## 6. Setup a squadron for GCI: + -- + -- The method @{#AI_A2A_DISPATCHER.SetSquadronGci}() defines a GCI execution for a squadron. + -- + -- Setting-up a GCI readiness also requires specific parameters: + -- + -- * The minimum speed and maximum patrol speed -- -- Essentially this controls how many flights of GCI aircraft can be active at any time. -- Note allowing large numbers of active GCI flights can adversely impact mission performance on low or medium specification hosts/servers. + -- GCI needs to be setup at strategic airbases. Too far will mean that the aircraft need to fly a long way to reach the intruders, + -- too short will mean that the intruders may have alraedy passed the ideal interception point! -- - -- # Country, type, load out, skill and skins for CAP and GCI aircraft? + -- For example, the following setup will create a GCI for squadron "Sochi": + -- + -- A2ADispatcher:SetSquadronGci( "Mozdok", 900, 1200 ) + -- + -- ## 7. User Guide: + -- + -- ## 8. Questionnaire: + -- + -- ### 8.1. Which countries will be selected for each coalition? + -- + -- Which countries are assigned to a coalition influences which units are available to the coalition. + -- For example because the mission calls for a EWR radar on the blue side the Ukraine might be chosen as a blue country + -- so that the 55G6 EWR radar unit is available to blue. + -- Some countries assign different tasking to aircraft, for example Germany assigns the CAP task to F-4E Phantoms but the USA does not. + -- Therefore if F4s are wanted as a coalition’s CAP or GCI aircraft Germany will need to be assigned to that coalition. + -- + -- ### 8.2.Country, type, load out, skill and skins for CAP and GCI aircraft? -- -- * Note these can be from any countries within the coalition but must be an aircraft with one of the main tasks being “CAP”. -- * Obviously skins which are selected must be available to all players that join the mission otherwise they will see a default skin. @@ -339,7 +484,13 @@ do -- AI_A2A_DISPATCHER self:RemoveDefenderFromSquadron( Squadron, Defender ) end DefenderUnit:Destroy() + return end + if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then + -- Damaged units cannot be repaired anymore. + DefenderUnit:Destroy() + return + end end end @@ -379,7 +530,7 @@ do -- AI_A2A_DISPATCHER -- -- Set 100km as the radius to engage any target by airborne friendlies. -- Dispatcher:InitDetectionFriendiesRadius( 100000 ) -- - function AI_A2A_DISPATCHER:InitEngageRadius( FriendliesRadius ) + function AI_A2A_DISPATCHER:SetEngageRadius( FriendliesRadius ) self.Detection:SetFriendliesRange( FriendliesRadius ) @@ -398,14 +549,31 @@ do -- AI_A2A_DISPATCHER -- -- -- Set a polygon zone as the border for the A2A dispatcher. -- local BorderZone = ZONE_POLYGON( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -- The GROUP object is a late activate helicopter unit. - -- Dispatcher:InitBorderZone( BorderZone ) + -- Dispatcher:SetBorderZone( BorderZone ) -- - function AI_A2A_DISPATCHER:InitBorderZone( BorderZone ) + function AI_A2A_DISPATCHER:SetBorderZone( BorderZone ) self.Detection:SetAcceptZones( BorderZone ) return self end + + --- Display a tactical report every 30 seconds about which aircraft are: + -- * Patrolling + -- * Engaging + -- * Returning + -- * Damaged + -- * Out of Fuel + -- * ... + -- @param #AI_A2A_DISPATCHER self + -- @param #boolean TacticalDisplay Provide a value of **true** to display every 30 seconds a tactical overview. + -- @return #AI_A2A_DISPATCHER + function AI_A2A_DISPATCHER:SetTacticalDisplay( TacticalDisplay ) + + self.TacticalDisplay = TacticalDisplay + + return self + end --- Calculates which AI friendlies are nearby the area -- @param #AI_A2A_DISPATCHER self @@ -475,10 +643,6 @@ do -- AI_A2A_DISPATCHER end if Defender and DefenderTask and DefenderTask.Target then DefenderTask.Target = nil - if DefenderTask.Fsm:Is("Engaging") then - DefenderTask.Fsm:Return() - DefenderTask.Fsm:__RTB( 0.5 ) - end end -- if Defender and DefenderTask then -- if DefenderTask.Fsm:Is( "Fuel" ) @@ -1483,9 +1647,10 @@ do -- AI_A2A_DISPATCHER for Defender, DefenderTask in pairs( self:GetDefenderTasks() ) do TaskCount = TaskCount + 1 local Defender = Defender -- Wrapper.Group#GROUP - if not DefenderTask.Target then - Report:Add( string.format( " - %s ( %s - %s )", Defender:GetName(), DefenderTask.Type, DefenderTask.Fsm:GetState() ) ) - end + if not DefenderTask.Target then + local DefenderHasTask = Defender:HasTask() + Report:Add( string.format( " - %s ( %s - %s ) %s", Defender:GetName(), DefenderTask.Type, DefenderTask.Fsm:GetState(), Defender:HasTask() == true and "Executing" or "Idle" ) ) + end end Report:Add( string.format( "\n - %d Tasks", TaskCount ) ) diff --git a/Moose Development/Moose/AI/AI_A2A_Gci.lua b/Moose Development/Moose/AI/AI_A2A_Gci.lua index 93245349c..60da2645c 100644 --- a/Moose Development/Moose/AI/AI_A2A_Gci.lua +++ b/Moose Development/Moose/AI/AI_A2A_Gci.lua @@ -408,6 +408,7 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit ) self:__RTB( 0.5 ) else AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, #AttackTasks, "AI_A2A_GCI.InterceptRoute" ) + AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( 4000, self.EngageMinSpeed ) EngageRoute[1].task = AIGroup:TaskCombo( AttackTasks ) --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... @@ -415,7 +416,7 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit ) end --- NOW ROUTE THE GROUP! - AIGroup:WayPointExecute( 1, 2 ) + AIGroup:WayPointExecute( 1, 0 ) end else diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index e06eaf308..8a8e345b1 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -703,7 +703,7 @@ end --- Set tracing for a class -- @param #BASE self -- @param #string Class -function BASE:TraceClass( Class ) +function --BASE:TraceClass( Class ) _TraceClass[Class] = true _TraceClassMethod[Class] = {} self:E( "Tracing class " .. Class ) @@ -713,7 +713,7 @@ end -- @param #BASE self -- @param #string Class -- @param #string Method -function BASE:TraceClassMethod( Class, Method ) +function --BASE:TraceClassMethod( Class, Method ) if not _TraceClassMethod[Class] then _TraceClassMethod[Class] = {} _TraceClassMethod[Class].Method = {} diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index bf4f43191..2285531f1 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -37,10 +37,10 @@ -- -- @module Detection ---BASE:TraceClass("DETECTION_BASE") ---BASE:TraceClass("DETECTION_AREAS") ---BASE:TraceClass("DETECTION_UNITS") ---BASE:TraceClass("DETECTION_TYPES") +----BASE:TraceClass("DETECTION_BASE") +----BASE:TraceClass("DETECTION_AREAS") +----BASE:TraceClass("DETECTION_UNITS") +----BASE:TraceClass("DETECTION_TYPES") do -- DETECTION_BASE diff --git a/Moose Development/Moose/Functional/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua index 68122b4e0..8ad718194 100644 --- a/Moose Development/Moose/Functional/Spawn.lua +++ b/Moose Development/Moose/Functional/Spawn.lua @@ -37,7 +37,7 @@ -- -- @module Spawn ---BASE:TraceClass("SPAWN") +----BASE:TraceClass("SPAWN") --- SPAWN Class diff --git a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv index fbf810e65..90e2e74d1 100644 --- a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv +++ b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv @@ -39,3 +39,5 @@ @K=function, @M=Designate, @N=OnAfterStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15822, @K=function, @M=Designate, @N=Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16043, @K=function, @M=Designate, @N=__Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16166, +@K=function, @M=AI_A2A_Dispatcher, @N=onafterHome, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\AI\AI_A2A_Dispatcher.lua, @C=65028, +@K=function, @M=AI_A2A_Dispatcher, @N=onafterHome, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\AI\AI_A2A_Dispatcher.lua, @C=69237, diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html new file mode 100644 index 000000000..c29b58938 --- /dev/null +++ b/docs/Documentation/AI_A2A.html @@ -0,0 +1,1822 @@ + + + + + + +
+
+ +
+
+
+
+ +
+

Module AI_A2A

+ +

AI -- AI A2A Air Patrolling or Staging.

+ +
+ +

Author: Sven Van de Velde (FlightControl)

+

Contributions:

+ +
    +
  • Dutch_Baron: Working together with James has resulted in the creation of the AI_BALANCER class.
  • +
+ + +

James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) + * Pikey: Testing and API concept review.

+ +
+ + +

Global(s)

+ + + + + +
AI_A2A +

AI_A2A class, extends Fsm#FSM_CONTROLLABLE

+ +

The AI_A2A class implements the core functions to operate an AI Group A2A tasking.

+
+

Type AI_A2A

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AI_A2A.CheckStatus + +
AI_A2A:ClearTargetDistance() + +
AI_A2A:GetDispatcher() + +
AI_A2A.HomeAirbase + +
AI_A2A:ManageDamage(PatrolDamageTreshold) +

When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.

+
AI_A2A:ManageFuel(PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime) +

When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.

+
AI_A2A:New(AIGroup) +

Creates a new AI_A2A object

+
AI_A2A:OnAfterRTB(Controllable, From, Event, To) +

OnAfter Transition Handler for Event RTB.

+
AI_A2A:OnAfterStart(From, Event, To) +

Start Handler OnAfter for AI_A2A

+
AI_A2A:OnAfterStatus(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Status.

+
AI_A2A:OnAfterStop(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Stop.

+
AI_A2A:OnBeforeRTB(Controllable, From, Event, To) +

OnBefore Transition Handler for Event RTB.

+
AI_A2A:OnBeforeStart(From, Event, To) +

Start Handler OnBefore for AI_A2A

+
AI_A2A:OnBeforeStatus(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Status.

+
AI_A2A:OnBeforeStop(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Stop.

+
AI_A2A:OnCrash(EventData) + +
AI_A2A:OnEjection(EventData) + +
AI_A2A:OnEnterReturning(Controllable, From, Event, To) +

OnEnter Transition Handler for State Returning.

+
AI_A2A:OnEnterStopped(Controllable, From, Event, To) +

OnEnter Transition Handler for State Stopped.

+
AI_A2A:OnLeaveReturning(Controllable, From, Event, To) +

OnLeave Transition Handler for State Returning.

+
AI_A2A:OnLeaveStopped(Controllable, From, Event, To) +

OnLeave Transition Handler for State Stopped.

+
AI_A2A:OnPilotDead(EventData) + +
AI_A2A.PatrolCeilingAltitude + +
AI_A2A.PatrolDamageTreshold + +
AI_A2A.PatrolFloorAltitude + +
AI_A2A.PatrolFuelTresholdPercentage + +
AI_A2A.PatrolManageDamage + +
AI_A2A.PatrolManageFuel + +
AI_A2A.PatrolMaxSpeed + +
AI_A2A.PatrolMinSpeed + +
AI_A2A.PatrolOutOfFuelOrbitTime + +
AI_A2A:RTB() +

Synchronous Event Trigger for Event RTB.

+
AI_A2A.RTBRoute(AIGroup) + +
AI_A2A:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude) +

Sets the floor and ceiling altitude of the patrol.

+
AI_A2A:SetDispatcher(Dispatcher) + +
AI_A2A:SetHomeAirbase(HomeAirbase) +

Sets the home airbase.

+
AI_A2A:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed) +

Sets (modifies) the minimum and maximum speed of the patrol.

+
AI_A2A:SetStatusOff() +

Set the status checking off.

+
AI_A2A:SetTargetDistance(Coordinate) + +
AI_A2A:Start() +

Start Trigger for AI_A2A

+
AI_A2A:Status() +

Synchronous Event Trigger for Event Status.

+
AI_A2A:Stop() +

Synchronous Event Trigger for Event Stop.

+
AI_A2A:__RTB(Delay) +

Asynchronous Event Trigger for Event RTB.

+
AI_A2A:__Start(Delay) +

Start Asynchronous Trigger for AI_A2A

+
AI_A2A:__Status(Delay) +

Asynchronous Event Trigger for Event Status.

+
AI_A2A:__Stop(Delay) +

Asynchronous Event Trigger for Event Stop.

+
AI_A2A:onafterDead() + +
AI_A2A:onafterHome(AIGroup, From, Event, To) + +
AI_A2A:onafterRTB(AIGroup, From, Event, To) + +
AI_A2A:onafterStart(Controllable, From, Event, To) +

Defines a new patrol route using the Process_PatrolZone parameters and settings.

+
AI_A2A:onafterStatus() + +
AI_A2A:onbeforeStatus() + +
+ +

Global(s)

+
+
+ + #AI_A2A + +AI_A2A + +
+
+ +

AI_A2A class, extends Fsm#FSM_CONTROLLABLE

+ +

The AI_A2A class implements the core functions to operate an AI Group A2A tasking.

+ + + + +

AI_A2A constructor

+ + + +

2. AI_A2A is a FSM

+ +

Process

+ +

2.1. AI_A2A States

+ +
    +
  • None ( Group ): The process is not started yet.
  • +
  • Patrolling ( Group ): The AI is patrolling the Patrol Zone.
  • +
  • Returning ( Group ): The AI is returning to Base.
  • +
  • Stopped ( Group ): The process is stopped.
  • +
  • Crashed ( Group ): The AI has crashed or is dead.
  • +
+ +

2.2. AI_A2A Events

+ +
    +
  • Start ( Group ): Start the process.
  • +
  • Stop ( Group ): Stop the process.
  • +
  • Route ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
  • +
  • RTB ( Group ): Route the AI to the home base.
  • +
  • Detect ( Group ): The AI is detecting targets.
  • +
  • Detected ( Group ): The AI has detected new targets.
  • +
  • Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.
  • +
+ +

3. Set or Get the AI controllable

+ + + + +
+
+

Type AI_A2A

+

Field(s)

+
+
+ + #boolean + +AI_A2A.CheckStatus + +
+
+ + + +
+
+
+
+ + +AI_A2A:ClearTargetDistance() + +
+
+ + + +
+
+
+
+ + +AI_A2A:GetDispatcher() + +
+
+ + + +
+
+
+
+ + + +AI_A2A.HomeAirbase + +
+
+ + + +
+
+
+
+ + +AI_A2A:ManageDamage(PatrolDamageTreshold) + +
+
+ +

When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.

+ + +

However, damage cannot be foreseen early on. +Therefore, when the damage treshold is reached, +the AI will return immediately to the home base (RTB). +Note that for groups, the average damage of the complete group will be calculated. +So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25.

+ +

Parameter

+
    +
  • + +

    #number PatrolDamageTreshold : +The treshold in percentage (between 0 and 1) when the AI is considered to be damaged.

    + +
  • +
+

Return value

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:ManageFuel(PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime) + +
+
+ +

When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.

+ + +

Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. +When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_A2A. +Once the time is finished, the old AI will return to the base.

+ +

Parameters

+
    +
  • + +

    #number PatrolFuelTresholdPercentage : +The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.

    + +
  • +
  • + +

    #number PatrolOutOfFuelOrbitTime : +The amount of seconds the out of fuel AIControllable will orbit before returning to the base.

    + +
  • +
+

Return value

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:New(AIGroup) + +
+
+ +

Creates a new AI_A2A object

+ +

Parameter

+ +

Return value

+ +

#AI_A2A:

+ + +
+
+
+
+ + +AI_A2A:OnAfterRTB(Controllable, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event RTB.

+ +

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_A2A:OnAfterStart(From, Event, To) + +
+
+ +

Start Handler OnAfter for AI_A2A

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+
+
+
+
+ + +AI_A2A:OnAfterStatus(Controllable, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Status.

+ +

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_A2A:OnAfterStop(Controllable, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Stop.

+ +

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_A2A:OnBeforeRTB(Controllable, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event RTB.

+ +

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_A2A:OnBeforeStart(From, Event, To) + +
+
+ +

Start Handler OnBefore for AI_A2A

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+

Return value

+ +

#boolean:

+ + +
+
+
+
+ + +AI_A2A:OnBeforeStatus(Controllable, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Status.

+ +

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_A2A:OnBeforeStop(Controllable, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Stop.

+ +

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_A2A:OnCrash(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A:OnEjection(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A:OnEnterReturning(Controllable, From, Event, To) + +
+
+ +

OnEnter Transition Handler for State Returning.

+ +

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_A2A:OnEnterStopped(Controllable, From, Event, To) + +
+
+ +

OnEnter Transition Handler for State Stopped.

+ +

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_A2A:OnLeaveReturning(Controllable, From, Event, To) + +
+
+ +

OnLeave Transition Handler for State Returning.

+ +

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_A2A:OnLeaveStopped(Controllable, From, Event, To) + +
+
+ +

OnLeave Transition Handler for State Stopped.

+ +

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_A2A:OnPilotDead(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + + +AI_A2A.PatrolCeilingAltitude + +
+
+ + + +
+
+
+
+ + + +AI_A2A.PatrolDamageTreshold + +
+
+ + + +
+
+
+
+ + + +AI_A2A.PatrolFloorAltitude + +
+
+ + + +
+
+
+
+ + + +AI_A2A.PatrolFuelTresholdPercentage + +
+
+ + + +
+
+
+
+ + #boolean + +AI_A2A.PatrolManageDamage + +
+
+ + + +
+
+
+
+ + #boolean + +AI_A2A.PatrolManageFuel + +
+
+ + + +
+
+
+
+ + + +AI_A2A.PatrolMaxSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A.PatrolMinSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A.PatrolOutOfFuelOrbitTime + +
+
+ + + +
+
+
+
+ + +AI_A2A:RTB() + +
+
+ +

Synchronous Event Trigger for Event RTB.

+ +
+
+
+
+ + +AI_A2A.RTBRoute(AIGroup) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude) + +
+
+ +

Sets the floor and ceiling altitude of the patrol.

+ +

Parameters

+
    +
  • + +

    Dcs.DCSTypes#Altitude PatrolFloorAltitude : +The lowest altitude in meters where to execute the patrol.

    + +
  • +
  • + +

    Dcs.DCSTypes#Altitude PatrolCeilingAltitude : +The highest altitude in meters where to execute the patrol.

    + +
  • +
+

Return value

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:SetDispatcher(Dispatcher) + +
+
+ + + +

Parameter

+
    +
  • + +

    Dispatcher :

    + +
  • +
+
+
+
+
+ + +AI_A2A:SetHomeAirbase(HomeAirbase) + +
+
+ +

Sets the home airbase.

+ +

Parameter

+ +

Return value

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed) + +
+
+ +

Sets (modifies) the minimum and maximum speed of the patrol.

+ +

Parameters

+ +

Return value

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:SetStatusOff() + +
+
+ +

Set the status checking off.

+ +

Return value

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:SetTargetDistance(Coordinate) + +
+
+ + + +

Parameter

+
    +
  • + +

    Coordinate :

    + +
  • +
+
+
+
+
+ + +AI_A2A:Start() + +
+
+ +

Start Trigger for AI_A2A

+ +
+
+
+
+ + +AI_A2A:Status() + +
+
+ +

Synchronous Event Trigger for Event Status.

+ +
+
+
+
+ + +AI_A2A:Stop() + +
+
+ +

Synchronous Event Trigger for Event Stop.

+ +
+
+
+
+ + +AI_A2A:__RTB(Delay) + +
+
+ +

Asynchronous Event Trigger for Event RTB.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A:__Start(Delay) + +
+
+ +

Start Asynchronous Trigger for AI_A2A

+ +

Parameter

+
    +
  • + +

    #number Delay :

    + +
  • +
+
+
+
+
+ + +AI_A2A:__Status(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Status.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A:__Stop(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Stop.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A:onafterDead() + +
+
+ + + +
+
+
+
+ + +AI_A2A:onafterHome(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+ +
+
+
+
+ + +AI_A2A:onafterRTB(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+ +
+
+
+
+ + +AI_A2A:onafterStart(Controllable, From, Event, To) + +
+
+ +

Defines a new patrol route using the Process_PatrolZone parameters and settings.

+ +

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

+ +

#AI_A2A: +self

+ +
+
+
+
+ + +AI_A2A:onafterStatus() + +
+
+ + + +
+
+
+
+ + +AI_A2A:onbeforeStatus() + +
+
+ + + +
+
+ +
+ +
+ + diff --git a/docs/Documentation/AI_A2A_Cap.html b/docs/Documentation/AI_A2A_Cap.html new file mode 100644 index 000000000..e16f6b1ec --- /dev/null +++ b/docs/Documentation/AI_A2A_Cap.html @@ -0,0 +1,1712 @@ + + + + + + +
+
+ +
+
+
+
+ +
+

Module AI_A2A_Cap

+ +

AI -- Execute Combat Air Patrol (CAP).

+ +

Banner Image

+ +
+ +

AI CAP classes makes AI Controllables execute a Combat Air Patrol.

+ + + +

There are the following types of CAP classes defined:

+ + + +
+ +

Author: Sven Van de Velde (FlightControl)

+ +

Contributions:

+ + + +
+ + +

Global(s)

+ + + + + +
AI_A2A_CAP +

AIA2ACAP class, extends AICAP#AIPATROL_ZONE

+ +

The AIA2ACAP 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_A2A_CAP

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AI_A2A_CAP:Abort() +

Synchronous Event Trigger for Event Abort.

+
AI_A2A_CAP:Accomplish() +

Synchronous Event Trigger for Event Accomplish.

+
AI_A2A_CAP.Accomplished + +
AI_A2A_CAP.AttackRoute(AIGroup) + +
AI_A2A_CAP.AttackSetUnit + +
AI_A2A_CAP:Destroy() +

Synchronous Event Trigger for Event Destroy.

+
AI_A2A_CAP:Engage() +

Synchronous Event Trigger for Event Engage.

+
AI_A2A_CAP.EngageMaxSpeed + +
AI_A2A_CAP.EngageMinSpeed + +
AI_A2A_CAP.EngageRange + +
AI_A2A_CAP.EngageZone + +
AI_A2A_CAP.Engaging + +
AI_A2A_CAP:Fired() +

Synchronous Event Trigger for Event Fired.

+
AI_A2A_CAP:New(AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, PatrolAltType) +

Creates a new AIA2ACAP object

+
AI_A2A_CAP:OnAfterAbort(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Abort.

+
AI_A2A_CAP:OnAfterAccomplish(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Accomplish.

+
AI_A2A_CAP:OnAfterDestroy(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Destroy.

+
AI_A2A_CAP:OnAfterEngage(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Engage.

+
AI_A2A_CAP:OnAfterFired(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Fired.

+
AI_A2A_CAP:OnBeforeAbort(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Abort.

+
AI_A2A_CAP:OnBeforeAccomplish(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Accomplish.

+
AI_A2A_CAP:OnBeforeDestroy(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Destroy.

+
AI_A2A_CAP:OnBeforeEngage(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Engage.

+
AI_A2A_CAP:OnBeforeFired(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Fired.

+
AI_A2A_CAP:OnEnterEngaging(Controllable, From, Event, To) +

OnEnter Transition Handler for State Engaging.

+
AI_A2A_CAP:OnEventDead(EventData) + +
AI_A2A_CAP:OnLeaveEngaging(Controllable, From, Event, To) +

OnLeave Transition Handler for State Engaging.

+
AI_A2A_CAP:SetEngageRange(EngageRange) +

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

+
AI_A2A_CAP:SetEngageZone(EngageZone) +

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

+
AI_A2A_CAP:__Abort(Delay) +

Asynchronous Event Trigger for Event Abort.

+
AI_A2A_CAP:__Accomplish(Delay) +

Asynchronous Event Trigger for Event Accomplish.

+
AI_A2A_CAP:__Destroy(Delay) +

Asynchronous Event Trigger for Event Destroy.

+
AI_A2A_CAP:__Engage(Delay) +

Asynchronous Event Trigger for Event Engage.

+
AI_A2A_CAP:__Fired(Delay) +

Asynchronous Event Trigger for Event Fired.

+
AI_A2A_CAP:onafterAbort(AIGroup, From, Event, To) + +
AI_A2A_CAP:onafterAccomplish(Controllable, From, Event, To) + +
AI_A2A_CAP:onafterDestroy(Controllable, From, Event, To, EventData) + +
AI_A2A_CAP:onafterEngage(AIGroup, From, Event, To, AttackSetUnit) + +
AI_A2A_CAP:onafterPatrol(AIGroup, From, Event, To) +

onafter State Transition for Event Patrol.

+
AI_A2A_CAP:onbeforeEngage(AIGroup, From, Event, To) + +
+ +

Global(s)

+
+
+ + #AI_A2A_CAP + +AI_A2A_CAP + +
+
+ +

AIA2ACAP class, extends AICAP#AIPATROL_ZONE

+ +

The AIA2ACAP 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 AIA2ACAP is assigned a Group and this must be done before the AIA2ACAP 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. AIA2ACAP constructor

+ + + +

2. AIA2ACAP is a FSM

+ +

Process

+ +

2.1 AIA2ACAP 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 AIA2ACAP 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 AICAP#AIA2A_CAP.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 AICap#AIA2A_CAP.SetEngageZone() to define that Zone.

+ +
+ + +
+
+

Type AI_A2A_Cap

+ +

Type AI_A2A_CAP

+

Field(s)

+
+
+ + +AI_A2A_CAP:Abort() + +
+
+ +

Synchronous Event Trigger for Event Abort.

+ +
+
+
+
+ + +AI_A2A_CAP:Accomplish() + +
+
+ +

Synchronous Event Trigger for Event Accomplish.

+ +
+
+
+
+ + #boolean + +AI_A2A_CAP.Accomplished + +
+
+ + + +
+
+
+
+ + +AI_A2A_CAP.AttackRoute(AIGroup) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + Core.Set#SET_UNIT + +AI_A2A_CAP.AttackSetUnit + +
+
+ + + +
+
+
+
+ + +AI_A2A_CAP:Destroy() + +
+
+ +

Synchronous Event Trigger for Event Destroy.

+ +
+
+
+
+ + +AI_A2A_CAP:Engage() + +
+
+ +

Synchronous Event Trigger for Event Engage.

+ +
+
+
+
+ + + +AI_A2A_CAP.EngageMaxSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A_CAP.EngageMinSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A_CAP.EngageRange + +
+
+ + + +
+
+
+
+ + + +AI_A2A_CAP.EngageZone + +
+
+ + + +
+
+
+
+ + #boolean + +AI_A2A_CAP.Engaging + +
+
+ + + +
+
+
+
+ + +AI_A2A_CAP:Fired() + +
+
+ +

Synchronous Event Trigger for Event Fired.

+ +
+
+
+
+ + +AI_A2A_CAP:New(AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, PatrolAltType) + +
+
+ +

Creates a new AIA2ACAP object

+ +

Parameters

+ +

Return value

+ +

#AIA2ACAP:

+ + +
+
+
+
+ + +AI_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP: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_A2A_CAP:OnEventDead(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A_CAP: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_A2A_CAP:SetEngageRange(EngageRange) + +
+
+ +

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

+ +

Parameter

+
    +
  • + +

    #number EngageRange : +The Engage Range.

    + +
  • +
+

Return value

+ +

#AIA2ACAP: +self

+ +
+
+
+
+ + +AI_A2A_CAP: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

+ +

#AIA2ACAP: +self

+ +
+
+
+
+ + +AI_A2A_CAP:__Abort(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Abort.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:__Accomplish(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Accomplish.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:__Destroy(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Destroy.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:__Engage(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Engage.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:__Fired(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Fired.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:onafterAbort(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Controllable#CONTROLLABLE AIGroup : +The AI Group managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP: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_A2A_CAP:onafterDestroy(Controllable, From, Event, To, EventData) + +
+
+ + + +

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.

    + +
  • +
  • + +

    Core.Event#EVENTDATA EventData :

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:onafterEngage(AIGroup, From, Event, To, AttackSetUnit) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Controllable#CONTROLLABLE AIGroup : +The Controllable Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
  • + +

    AttackSetUnit :

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:onafterPatrol(AIGroup, From, Event, To) + +
+
+ +

onafter State Transition for Event Patrol.

+ +

Parameters

+
    +
  • + +

    Wrapper.Controllable#CONTROLLABLE AIGroup : +The AI Group managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_CAP:onbeforeEngage(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Controllable#CONTROLLABLE AIGroup : +The Controllable Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+ +
+ +
+ + diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html new file mode 100644 index 000000000..ec26e3638 --- /dev/null +++ b/docs/Documentation/AI_A2A_Dispatcher.html @@ -0,0 +1,3159 @@ + + + + + + +
+
+ +
+
+
+
+ +
+

Module AI_A2A_Dispatcher

+ +

AI - The AIA2ADISPATCHER creates an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI.

+ + + +
+ +

Authors: Sven Van de Velde (FlightControl)

+
         **Stonehouse**
+
+ +

Contributions:

+ +
+ + +

Global(s)

+ + + + + +
AI_A2A_DISPATCHER +

AIA2ADISPATCHER class, extends Tasking#DETECTION_MANAGER

+ +

The #AIA2ADISPATCHER class is designed to create an automatic air defence system for a coalition.

+
+

Type AI_A2A_DISPATCHER

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AI_A2A_DISPATCHER:AddDefenderToSquadron(Squadron, Defender) + +
AI_A2A_DISPATCHER:CAP() +

CAP Trigger for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:CanCAP(SquadronName) + +
AI_A2A_DISPATCHER:CanGCI(SquadronName) + +
AI_A2A_DISPATCHER:ClearDefenderTask(Defender) + +
AI_A2A_DISPATCHER:ClearDefenderTaskTarget(Defender) + +
AI_A2A_DISPATCHER:CountCapAirborne(SquadronName) + +
AI_A2A_DISPATCHER:CountDefendersEngaged(Target) + +
AI_A2A_DISPATCHER:CountDefendersToBeEngaged(DetectedItem, DefenderCount) + +
AI_A2A_DISPATCHER.DefenderSpawns + +
AI_A2A_DISPATCHER.DefenderSquadrons + +
AI_A2A_DISPATCHER.DefenderTasks + +
AI_A2A_DISPATCHER.Defenders + +
AI_A2A_DISPATCHER.Detection + +
AI_A2A_DISPATCHER:ENGAGE() +

ENGAGE Trigger for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:EvaluateENGAGE(DetectedItem) +

Creates an ENGAGE task when there are human friendlies airborne near the targets.

+
AI_A2A_DISPATCHER:EvaluateGCI(DetectedItem, Target) +

Creates an GCI task when there are targets for it.

+
AI_A2A_DISPATCHER:EvaluateSWEEP(DetectedItem) +

Creates an SWEEP task when there are targets for it.

+
AI_A2A_DISPATCHER:GCI() +

GCI Trigger for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:GetAIFriendliesNearBy(DetectedItem) +

Calculates which AI friendlies are nearby the area

+
AI_A2A_DISPATCHER:GetCAPDelay(SquadronName) + +
AI_A2A_DISPATCHER:GetDefenderTask(Defender) + +
AI_A2A_DISPATCHER:GetDefenderTaskFsm(Defender) + +
AI_A2A_DISPATCHER:GetDefenderTaskTarget(Defender) + +
AI_A2A_DISPATCHER:GetDefenderTasks() + +
AI_A2A_DISPATCHER:GetFriendliesNearBy(DetectedItem, Target) +

Calculates which friendlies are nearby the area

+
AI_A2A_DISPATCHER:GetPlayerFriendliesNearBy(DetectedItem) +

Calculates which HUMAN friendlies are nearby the area

+
AI_A2A_DISPATCHER:GetSquadron(SquadronName) +

Get an item from the Squadron table.

+
AI_A2A_DISPATCHER:GetSquadronFromDefender(Defender) + +
AI_A2A_DISPATCHER:GetSquadronLanding(SquadronName) +

Gets the method at which flights will land and despawn as part of the defense system.

+
AI_A2A_DISPATCHER:GetSquadronTakeoff(SquadronName) +

Gets the method at which new flights will spawn and take-off as part of the defense system.

+
AI_A2A_DISPATCHER.Landing +

Defnes Landing location.

+
AI_A2A_DISPATCHER:New(The, DetectionSetGroup, GroupingRadius) +

AIA2ADISPATCHER constructor.

+
AI_A2A_DISPATCHER:OnAfterAssign(From, Event, To, Task, TaskUnit, PlayerName) +

OnAfter Transition Handler for Event Assign.

+
AI_A2A_DISPATCHER:OnAfterCAP(From, Event, To) +

CAP Handler OnAfter for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:OnAfterENGAGE(From, Event, To) +

ENGAGE Handler OnAfter for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:OnAfterGCI(From, Event, To) +

GCI Handler OnAfter for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:OnBeforeCAP(From, Event, To) +

CAP Handler OnBefore for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:OnBeforeENGAGE(From, Event, To) +

ENGAGE Handler OnBefore for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:OnBeforeGCI(From, Event, To) +

GCI Handler OnBefore for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:OnEventCrashOrDead(EventData) + +
AI_A2A_DISPATCHER:OnEventEngineShutdown(EventData) + +
AI_A2A_DISPATCHER:OnEventLand(EventData) + +
AI_A2A_DISPATCHER:ProcessDetected(Detection) +

Assigns A2A AI Tasks in relation to the detected items.

+
AI_A2A_DISPATCHER:RemoveDefenderFromSquadron(Squadron, Defender) + +
AI_A2A_DISPATCHER.SchedulerCAP(AI_A2A_DISPATCHER, SquadronName, self) + +
AI_A2A_DISPATCHER:SetBorderZone(BorderZone) +

Define a border area to simulate a cold war scenario.

+
AI_A2A_DISPATCHER:SetDefenderTask(Defender, Type, Fsm, Target) + +
AI_A2A_DISPATCHER:SetDefenderTaskTarget(AIGroup, Defender, Target) + +
AI_A2A_DISPATCHER:SetEngageRadius(FriendliesRadius) +

Define the radius to engage any target by airborne friendlies, which are executing cap or returning from an intercept mission.

+
AI_A2A_DISPATCHER:SetSquadron(SquadronName, AirbaseName, SpawnTemplates, Resources) + +
AI_A2A_DISPATCHER:SetSquadronCap(SquadronName, Zone, FloorAltitude, CeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, AltType) + +
AI_A2A_DISPATCHER:SetSquadronCapInterval(SquadronName, CapLimit, LowInterval, HighInterval, Probability) + +
AI_A2A_DISPATCHER:SetSquadronGci(SquadronName, EngageMinSpeed, EngageMaxSpeed) + +
AI_A2A_DISPATCHER:SetSquadronGrouping(SquadronName, Grouping) + +
AI_A2A_DISPATCHER:SetSquadronLanding(SquadronName, Landing) +

Defines the method at which flights will land and despawn as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronLandingAtEngineShutdown(SquadronName) +

Sets flights to land and despawn at engine shutdown, as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronLandingAtRunway(SquadronName) +

Sets flights to land and despawn at the runway, as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronLandingNearAirbase(SquadronName) +

Sets flights to land and despawn near the airbase in the air, as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronOverhead(SquadronName, Overhead) +

Defines the amount of extra planes that will take-off as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronTakeoff(SquadronName, Takeoff) +

Defines the method at which new flights will spawn and take-off as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronTakeoffFromParkingCold(SquadronName) +

Sets flights to take-off from the airbase at a cold location, as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronTakeoffFromParkingHot(SquadronName) +

Sets flights to take-off from the airbase at a hot location, as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronTakeoffFromRunway(SquadronName) +

Sets flights to take-off from the runway, as part of the defense system.

+
AI_A2A_DISPATCHER:SetSquadronTakeoffInAir(SquadronName) +

Sets flights to take-off in the air, as part of the defense system.

+
AI_A2A_DISPATCHER:SetTacticalDisplay(TacticalDisplay) +

Display a tactical report every 30 seconds about which aircraft are: + * Patrolling + * Engaging + * Returning + * Damaged + * Out of Fuel + * ...

+
AI_A2A_DISPATCHER.TacticalDisplay + +
AI_A2A_DISPATCHER.Takeoff + +
AI_A2A_DISPATCHER:__CAP(Delay) +

CAP Asynchronous Trigger for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:__ENGAGE(Delay) +

ENGAGE Asynchronous Trigger for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:__GCI(Delay) +

GCI Asynchronous Trigger for AIA2ADISPATCHER

+
AI_A2A_DISPATCHER:onafterCAP(From, Event, To, SquadronName) + +
AI_A2A_DISPATCHER:onafterENGAGE(From, Event, To, Target, AIGroups) + +
AI_A2A_DISPATCHER:onafterGCI(From, Event, To, Target, DefendersMissing, AIGroups) + +
+ +

Global(s)

+
+
+ + #AI_A2A_DISPATCHER + +AI_A2A_DISPATCHER + +
+
+ +

AIA2ADISPATCHER class, extends Tasking#DETECTION_MANAGER

+ +

The #AIA2ADISPATCHER class is designed to create an automatic air defence system for a coalition.

+ + +

It includes automatic spawning of Combat Air Patrol aircraft (CAP) and Ground Controlled Intercept aircraft (GCI) in response to enemy air movements that are detected by a ground based radar network. +CAP flights will take off and proceed to designated CAP zones where they will remain on station until the ground radars direct them to intercept detected enemy aircraft or they run short of fuel and must return to base (RTB). When a CAP flight leaves their zone to perform an interception or return to base a new CAP flight will spawn to take their place. +If all CAP flights are engaged or RTB then additional GCI interceptors will scramble to intercept unengaged enemy aircraft under ground radar control. +With a little time and with a little work it provides the mission designer with a convincing and completely automatic air defence system. +In short it is a plug in very flexible and configurable air defence module for DCS World.

+ +

Note that in order to create a two way A2A defense system, two AIA2ADISPATCHER defense system may need to be created, for each coalition one. +This is a good implementation, because maybe in the future, more coalitions may become available in DCS world.

+ +

1. AIA2ADISPATCHER constructor:

+ +

The AIA2ADISPATCHER.New() method creates a new AIA2ADISPATCHER instance. +There are two parameters required, a Set#SET_GROUP that defines the Groups of the EWR network, and a radius in meters, that will be used to group the detected targets.

+ +

The AIA2ADISPATCHER.New() method is used to setup the EWR network and to define the grouping.

+ +

1.1. Define the EWR network:

+ +

Typically EWR networks are setup using 55G6 EWR, 1L13 EWR, Hawk sr and Patriot str ground based radar units. +These radars have different ranges and 55G6 EWR and 1L13 EWR radars are Eastern Bloc units (eg Russia, Ukraine, Georgia) while the Hawk and Patriot radars are Western (eg US). +Additionally, ANY other radar capable unit can be part of the EWR network! Also AWACS airborne units, planes, helicopters can help to detect targets, as long as they have radar. +The position of these units is very important as they need to provide enough coverage +to pick up enemy aircraft as they approach so that CAP and GCI flights can be tasked to intercept them. +Additionally in a hot war situation where the border is no longer respected the placement of radars has a big effect on how fast the war escalates. +For example if they are a long way forward and can detect enemy planes on the ground and taking off +they will start to vector CAP and GCI flights to attack them straight away which will immediately draw a response from the other coalition. +Having the radars further back will mean a slower escalation because fewer targets will be detected and +therefore less CAP and GCI flights will spawn and this will tend to make just the border area active rather than a melee over the whole map. +It all depends on what the desired effect is.

+ +

EWR networks are dynamically constructed, that is, they form part of the Set#SET_GROUP object that is given as the input parameter of the AIA2ADISPATCHER class. +By defining in a smart way the names or name prefixes of the groups of EWR capable units, these units will be automatically added or deleted from the EWR network, +increasing or decreasing the radar coverage of the Early Warning System.

+ +

See the following example to setup an EWR network containing EWR stations and AWACS.

+ +
-- Define a SET_GROUP object that builds a collection of groups that define the EWR network.
+-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR.
+DetectionSetGroup = SET_GROUP:New()
+DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } )
+DetectionSetGroup:FilterStart()
+
+-- Setup the A2A dispatcher, and initialize it.
+A2ADispatcher = AI_A2A_DISPATCHER:New( DetectionSetGroup, 30000 )
+
+ +

The above example creates a SET_GROUP instance, and stores this in the variable (object) DetectionSetGroup. +DetectionSetGroup is then being configured to filter all active groups with a group name starting with DF CCCP AWACS or DF CCCP EWR to be included in the Set. +DetectionSetGroup is then being ordered to start the dynamic filtering. Note that any destroy or new spawn of a group with the above names will be removed or added to the Set. +The DetectionSetGroup variable is then passed to the AIA2ADISPATCHER.New() method to indicate the EWR network configuration and setup the A2A defense detection mechanism. +As a second parameter of the AIA2ADISPATCHER.New() method, 30000 indicates that detected targets need to be grouped within a radius of 30km. +The grouping radius should not be too small, but also depends on the types of planes and the era of the simulation. +Fast planes like in the 80s, need a larger radius than WWII planes.
+Typically I suggest to use 30000 for new generation planes and 10000 for older era aircraft.

+ +

Note that detected targets are constantly re-grouped, that is, when certain detected aircraft are moving further than the group radius, then these aircraft will become a separate +group being detected. This may result in additional GCI being started by the dispatcher! So don't make this value too small!

+ +

2. Set the engage radius:

+ +

Define the radius to engage any target by airborne friendlies, which are executing cap or returning from an intercept mission. +So, if there is a target area detected and reported, +then any friendlies that are airborne near this target area, +will be commanded to (re-)engage that target when available (if no other tasks were commanded). +For example, if 100000 is given as a value, then any friendly that is airborne within 100km from the detected target, +will be considered to receive the command to engage that target area. +You need to evaluate the value of this parameter carefully. +If too small, more intercept missions may be triggered upon detected target areas. +If too large, any airborne cap may not be able to reach the detected target area in time, because it is too far.

+ +

3. Set the borders:

+ +

According to the tactical and strategic design of the mission broadly decide the shape and extent of red and blue territories. +They should be laid out such that a border area is created between the two coalitions.

+ +

Define a border area to simulate a cold war scenario and use the method AIA2ADISPATCHER.SetBorderZone() to create a border zone for the dispatcher.

+ +

A cold war is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border. +A hot war is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it. +If it’s a cold war then the borders of red and blue territory need to be defined using a zone object derived from Zone#ZONE_BASE. +If a hot war is chosen then no borders actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1

+ +

4. Squadrons:

+ +

The AIA2ADISPATCHER works with Squadrons, that need to be defined using the different methods available.

+ +

Use the method AIA2ADISPATCHER.SetSquadron() to setup a new squadron active at an airfield, +while defining which plane types are being used by the squadron and how many resources are available.

+ +

Squadrons:

+ +
    +
  • Have name (string) that is the identifier or key of the squadron.
  • +
  • Have specific plane types.
  • +
  • Are located at one airbase.
  • +
  • Have a limited set of resources.
  • +
+ +

The name of the squadron given acts as the squadron key in the AIA2ADISPATCHER:Squadron...() methods.

+ +

Additionally, squadrons have specific configuration options to:

+ +
    +
  • Control how new aircraft are taking off from the airfield (in the air, cold, hot, at the runway).
  • +
  • Control how returning aircraft are landing at the airfield (in the air near the airbase, after landing, after engine shutdown).
  • +
  • Control the grouping of new aircraft spawned at the airfield. If there is more than one aircraft to be spawned, these may be grouped.
  • +
  • Control the overhead or defensive strength of the squadron. Depending on the types of planes and amount of resources, the mission designer can choose to increase or reduce the amount of planes spawned.
  • +
+ +

For performance and bug workaround reasons within DCS, squadrons have different methods to spawn new aircraft or land returning or damaged aircraft.

+ + +

4.1. Set squadron take-off methods

+ +

Use the various SetSquadronTakeoff... methods to control how squadrons are taking-off from the airfield:

+ + + +

Use these methods to fine-tune for specific airfields that are known to create bottlenecks, or have reduced airbase efficiency. +The more and the longer aircraft need to taxi at an airfield, the more risk there is that:

+ +
    +
  • aircraft will stop waiting for each other or for a landing aircraft before takeoff.
  • +
  • aircraft may get into a "dead-lock" situation, where two aircraft are blocking each other.
  • +
  • aircraft may collide at the airbase.
  • +
  • aircraft may be awaiting the landing of a plane currently in the air, but never lands ...
  • +
+ +

Currently within the DCS engine, the airfield traffic coordination is erroneous and contains a lot of bugs. +If you experience while testing problems with aircraft take-off or landing, please use one of the above methods as a solution to workaround these issues!

+ +

4.2. Set squadron landing methods

+ +

In analogy with takeoff, the landing methods are to control how squadrons land at the airfield:

+ + + +

You can use these methods to minimize the airbase coodination overhead and to increase the airbase efficiency. +When there are lots of aircraft returning for landing, at the same airbase, the takeoff process will be halted, which can cause a complete failure of the +A2A defense system, as no new CAP or GCI planes can takeoff. +Note that the method AIA2ADISPATCHER.SetSquadronLandingNearAirbase() will only work for returning aircraft, not for damaged or out of fuel aircraft. +Damaged or out-of-fuel aircraft are returning to the nearest friendly airbase and will land, and are out of control from ground control.

+ +

4.3. Set squadron grouping

+ +

Choices are 1, 2, 3 or 4 when CAP or GCI flights spawn. Use the method AIA2ADISPATCHER.SetSquadronGrouping() to set the amount of CAP or GCI flights that will take-off when spawned. +In the case of GCI, the AIA2ADISPATCHER.SetSquadronGrouping() method has additional behaviour. When there aren't enough CAP flights airborne, a GCI will be initiated for the remaining +targets to be engaged. Depending on the grouping parameter, the spawned flights for GCI are grouped into this setting.
+For example with a group setting of 2, if 3 targets are detected and cannot be engaged by CAP or any airborne flight, +a GCI needs to be started, the GCI flights will be grouped as follows: Group 1 of 2 flights and Group 2 of one flight!

+ +

The grouping value is set for a Squadron, and can be dynamically adjusted during mission execution, so to adjust the defense flights grouping when the tactical situation changes.

+ +

4.4. Balance or setup effectiveness of the air defenses in case of GCI

+ +

The effectiveness can be set with the overhead parameter. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units. +The default value of the overhead parameter is 1.0, which means equal balance.

+ +

However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.

+ +

The AIA2ADISPATCHER.SetOverhead() method can be used to tweak the defense strength, +taking into account the plane types of the squadron.

+ +

For example, a MIG-31 with full long-distance A2A missiles payload, may still be less effective than a F-15C with short missiles... +So in this case, one may want to use the AIA2ADISPATCHER.SetOverhead() method to allocate more defending planes as the amount of detected attacking planes. +The overhead must be given as a decimal value with 1 as the neutral value, which means that overhead values:

+ +
    +
  • Higher than 1.0, for example 1.5, will increase the defense unit amounts. For 4 planes detected, 6 planes will be spawned.
  • +
  • Lower than 1, for example 0.75, will decrease the defense unit amounts. For 4 planes detected, only 3 planes will be spawned.
  • +
+ +

The amount of defending units is calculated by multiplying the amount of detected attacking planes as part of the detected group +multiplied by the Overhead and rounded up to the smallest integer.

+ +

The overhead value is set for a Squadron, and can be dynamically adjusted during mission execution, so to adjust the defense overhead when the tactical situation changes.

+ +

5. Setup a squadron for CAP

+ +

5.1. Set the CAP zones

+ +
    +
  • CAP zones are patrol areas where Combat Air Patrol (CAP) flights loiter until they either return to base due to low fuel or are assigned an interception task by ground control.

  • +
  • As the CAP flights wander around within the zone waiting to be tasked, these zones need to be large enough that the aircraft are not constantly turning + but do not have to be big and numerous enough to completely cover a border.

  • +
  • CAP zones can be of any type, and are derived from the Zone#ZONE_BASE class. Zones can be Zone#ZONE, Zone#ZONE_POLYGON, Zone#ZONE_UNIT, Zone#ZONE_GROUP, etc. + This allows to setup static, moving and/or complex zones wherein aircraft will perform the CAP.

  • +
  • Typically 20000-50000 metres width is used and they are spaced so that aircraft in the zone waiting for tasks don’t have to far to travel to protect their coalitions important targets. + These targets are chosen as part of the mission design and might be an important airfield or town etc. + Zone size is also determined somewhat by territory size, plane types + (eg WW2 aircraft might mean smaller zones or more zones because they are slower and take longer to intercept enemy aircraft).

  • +
  • In a cold war it is important to make sure a CAP zone doesn’t intrude into enemy territory as otherwise CAP flights will likely cross borders + and spark a full scale conflict which will escalate rapidly.

  • +
  • CAP flights do not need to be in the CAP zone before they are “on station” and ready for tasking.

  • +
  • Typically if a CAP flight is tasked and therefore leaves their zone empty while they go off and intercept their target another CAP flight will spawn to take their place.

  • +
+ +

The following example illustrates how CAP zones are coded:

+ +
 -- CAP Squadron execution.
+ CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) )
+ A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 )
+ A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 )
+
+ CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) )
+ A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" )
+ A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 )
+
+ CAPZoneMiddle = ZONE:New( "CAP Zone Middle")
+ A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" )
+ A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 )
+
+ +

Note the different Zone MOOSE classes being used to create zones of different types. Please click the Zone link for more information about the different zone types. +Zones can be circles, can be setup in the mission editor using trigger zones, but can also be setup in the mission editor as polygons and in this case GROUP objects are being used!

+ +

5.2. Set the squadron to execute CAP:

+ +

The method AIA2ADISPATCHER.SetSquadronCap() defines a CAP execution for a squadron.

+ +

Setting-up a CAP zone also requires specific parameters:

+ +
    +
  • The minimum and maximum altitude
  • +
  • The minimum speed and maximum patrol speed
  • +
  • The minimum and maximum engage speed
  • +
  • The type of altitude measurement
  • +
+ +

These define how the squadron will perform the CAP while partrolling. Different terrain types requires different types of CAP.

+ +

The AIA2ADISPATCHER.SetSquadronCapInterval() method specifies how much and when CAP flights will takeoff.

+ +

It is recommended not to overload the air defense with CAP flights, as these will decrease the performance of the overall system.

+ +

For example, the following setup will create a CAP for squadron "Sochi":

+ +

A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) + A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 )

+ +

6. Setup a squadron for GCI:

+ +

The method AIA2ADISPATCHER.SetSquadronGci() defines a GCI execution for a squadron.

+ +

Setting-up a GCI readiness also requires specific parameters:

+ +
    +
  • The minimum speed and maximum patrol speed
  • +
+ +

Essentially this controls how many flights of GCI aircraft can be active at any time. +Note allowing large numbers of active GCI flights can adversely impact mission performance on low or medium specification hosts/servers. +GCI needs to be setup at strategic airbases. Too far will mean that the aircraft need to fly a long way to reach the intruders, +too short will mean that the intruders may have alraedy passed the ideal interception point!

+ +

For example, the following setup will create a GCI for squadron "Sochi":

+ +

A2ADispatcher:SetSquadronGci( "Mozdok", 900, 1200 )

+ +

7. User Guide:

+ +

8. Questionnaire:

+ +

8.1. Which countries will be selected for each coalition?

+ +

Which countries are assigned to a coalition influences which units are available to the coalition. +For example because the mission calls for a EWR radar on the blue side the Ukraine might be chosen as a blue country +so that the 55G6 EWR radar unit is available to blue.
+Some countries assign different tasking to aircraft, for example Germany assigns the CAP task to F-4E Phantoms but the USA does not.
+Therefore if F4s are wanted as a coalition’s CAP or GCI aircraft Germany will need to be assigned to that coalition.

+ +

8.2.Country, type, load out, skill and skins for CAP and GCI aircraft?

+ +
    +
  • Note these can be from any countries within the coalition but must be an aircraft with one of the main tasks being “CAP”.
  • +
  • Obviously skins which are selected must be available to all players that join the mission otherwise they will see a default skin.
  • +
  • Load outs should be appropriate to a CAP mission eg perhaps drop tanks for CAP flights and extra missiles for GCI flights.
  • +
  • These decisions will eventually lead to template aircraft units being placed as late activation units that the script will use as templates for spawning CAP and GCI flights. Up to 4 different aircraft configurations can be chosen for each coalition. The spawned aircraft will inherit the characteristics of the template aircraft.
  • +
  • The selected aircraft type must be able to perform the CAP tasking for the chosen country.
  • +
+ + + +
+
+

Type AI_A2A_Dispatcher

+ +

Type AI_A2A_DISPATCHER

+ +

AIA2ADISPATCHER class.

+ +

Field(s)

+
+
+ + +AI_A2A_DISPATCHER:AddDefenderToSquadron(Squadron, Defender) + +
+
+ + + +

Parameters

+
    +
  • + +

    Squadron :

    + +
  • +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:CAP() + +
+
+ +

CAP Trigger for AIA2ADISPATCHER

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:CanCAP(SquadronName) + +
+
+ + + +

Parameter

+
    +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
+

Return value

+ +

#table: +DefenderSquadron

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:CanGCI(SquadronName) + +
+
+ + + +

Parameter

+
    +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
+

Return value

+ +

#table: +DefenderSquadron

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:ClearDefenderTask(Defender) + +
+
+ + + +

Parameter

+
    +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:ClearDefenderTaskTarget(Defender) + +
+
+ + + +

Parameter

+
    +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:CountCapAirborne(SquadronName) + +
+
+ + + +

Parameter

+
    +
  • + +

    SquadronName :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:CountDefendersEngaged(Target) + +
+
+ + + +

Parameter

+
    +
  • + +

    Target :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:CountDefendersToBeEngaged(DetectedItem, DefenderCount) + +
+
+ + + +

Parameters

+
    +
  • + +

    DetectedItem :

    + +
  • +
  • + +

    DefenderCount :

    + +
  • +
+
+
+
+
+ + + +AI_A2A_DISPATCHER.DefenderSpawns + +
+
+ + + +
+
+
+
+ + + +AI_A2A_DISPATCHER.DefenderSquadrons + +
+
+ + + + +

The Defender Squadrons.

+ +
+
+
+
+ + + +AI_A2A_DISPATCHER.DefenderTasks + +
+
+ + + + +

The Defenders Tasks.

+ +
+
+
+
+ + +AI_A2A_DISPATCHER.Defenders + +
+
+ + + +
+
+
+
+ + Functional.Detection#DETECTION_AREAS + +AI_A2A_DISPATCHER.Detection + +
+
+ + + +
+
+
+
+ + +AI_A2A_DISPATCHER:ENGAGE() + +
+
+ +

ENGAGE Trigger for AIA2ADISPATCHER

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:EvaluateENGAGE(DetectedItem) + +
+
+ +

Creates an ENGAGE task when there are human friendlies airborne near the targets.

+ +

Parameter

+ +

Return values

+
    +
  1. + +

    Set#SET_UNIT: +TargetSetUnit: The target set of units.

    + +
  2. +
  3. + +

    #nil: +If there are no targets to be set.

    + +
  4. +
+
+
+
+
+ + +AI_A2A_DISPATCHER:EvaluateGCI(DetectedItem, Target) + +
+
+ +

Creates an GCI task when there are targets for it.

+ +

Parameters

+ +

Return values

+
    +
  1. + +

    Set#SET_UNIT: +TargetSetUnit: The target set of units.

    + +
  2. +
  3. + +

    #nil: +If there are no targets to be set.

    + +
  4. +
+
+
+
+
+ + +AI_A2A_DISPATCHER:EvaluateSWEEP(DetectedItem) + +
+
+ +

Creates an SWEEP task when there are targets for it.

+ +

Parameter

+ +

Return values

+
    +
  1. + +

    Set#SET_UNIT: +TargetSetUnit: The target set of units.

    + +
  2. +
  3. + +

    #nil: +If there are no targets to be set.

    + +
  4. +
+
+
+
+
+ + +AI_A2A_DISPATCHER:GCI() + +
+
+ +

GCI Trigger for AIA2ADISPATCHER

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:GetAIFriendliesNearBy(DetectedItem) + +
+
+ +

Calculates which AI friendlies are nearby the area

+ +

Parameter

+
    +
  • + +

    DetectedItem :

    + +
  • +
+

Return value

+ +

#number, Core.CommandCenter#REPORT:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:GetCAPDelay(SquadronName) + +
+
+ + + +

Parameter

+
    +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:GetDefenderTask(Defender) + +
+
+ + + +

Parameter

+
    +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:GetDefenderTaskFsm(Defender) + +
+
+ + + +

Parameter

+
    +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:GetDefenderTaskTarget(Defender) + +
+
+ + + +

Parameter

+
    +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:GetDefenderTasks() + +
+
+ + + +
+
+
+
+ + +AI_A2A_DISPATCHER:GetFriendliesNearBy(DetectedItem, Target) + +
+
+ +

Calculates which friendlies are nearby the area

+ +

Parameters

+
    +
  • + +

    DetectedItem :

    + +
  • +
  • + +

    Target :

    + +
  • +
+

Return value

+ +

#number, Core.CommandCenter#REPORT:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:GetPlayerFriendliesNearBy(DetectedItem) + +
+
+ +

Calculates which HUMAN friendlies are nearby the area

+ +

Parameter

+
    +
  • + +

    DetectedItem :

    + +
  • +
+

Return value

+ +

#number, Core.CommandCenter#REPORT:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:GetSquadron(SquadronName) + +
+
+ +

Get an item from the Squadron table.

+ +

Parameter

+
    +
  • + +

    SquadronName :

    + +
  • +
+

Return value

+ +

#table:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:GetSquadronFromDefender(Defender) + +
+
+ + + +

Parameter

+
    +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:GetSquadronLanding(SquadronName) + +
+
+ +

Gets the method at which flights will land and despawn as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#number: +Landing The landing method which can be NearAirbase, AtRunway, AtEngineShutdown

+ +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  local LandingMethod = Dispatcher:GetSquadronLanding( "SquadronName", AI_A2A_Dispatcher.Landing.NearAirbase )
+  if LandingMethod == AI_A2A_Dispatcher.Landing.NearAirbase then
+   ...
+  end
+
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:GetSquadronTakeoff(SquadronName) + +
+
+ +

Gets the method at which new flights will spawn and take-off as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#number: +Takeoff From the airbase hot, from the airbase cold, in the air, from the runway.

+ +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  local TakeoffMethod = Dispatcher:GetSquadronTakeoff( "SquadronName" )
+  if TakeOffMethod == , AI_A2A_Dispatcher.Takeoff.InAir then
+    ...
+  end
+  
+ +
+
+
+
+ + + +AI_A2A_DISPATCHER.Landing + +
+
+ +

Defnes Landing location.

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:New(The, DetectionSetGroup, GroupingRadius) + +
+
+ +

AIA2ADISPATCHER constructor.

+ +

Parameters

+
    +
  • + +

    #string The : +Squadron Name. This name is used to control the squadron settings in the A2A dispatcher, and also in communication to human players.

    + +
  • +
  • + +

    Core.Set#SET_GROUP DetectionSetGroup : +The Set of group objects that will setup the Early Warning Radar network.

    + +
  • +
  • + +

    #number GroupingRadius : +The radius in meters wherein detected planes are being grouped as one target area. +For airplanes, 6000 (6km) is recommended, and is also the default value of this parameter.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER: +self

+ +

Usage:

+
  
+  -- Set a new AI A2A Dispatcher object, based on an EWR network with a 6 km grouping radius.
+  
+
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:OnAfterAssign(From, Event, To, Task, TaskUnit, PlayerName) + +
+
+ +

OnAfter Transition Handler for Event Assign.

+ +

Parameters

+
    +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
  • + +

    Tasking.TaskA2A#AIA2A Task :

    + +
  • +
  • + +

    Wrapper.Unit#UNIT TaskUnit :

    + +
  • +
  • + +

    #string PlayerName :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:OnAfterCAP(From, Event, To) + +
+
+ +

CAP Handler OnAfter for AIA2ADISPATCHER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:OnAfterENGAGE(From, Event, To) + +
+
+ +

ENGAGE Handler OnAfter for AIA2ADISPATCHER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:OnAfterGCI(From, Event, To) + +
+
+ +

GCI Handler OnAfter for AIA2ADISPATCHER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:OnBeforeCAP(From, Event, To) + +
+
+ +

CAP Handler OnBefore for AIA2ADISPATCHER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+

Return value

+ +

#boolean:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:OnBeforeENGAGE(From, Event, To) + +
+
+ +

ENGAGE Handler OnBefore for AIA2ADISPATCHER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+

Return value

+ +

#boolean:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:OnBeforeGCI(From, Event, To) + +
+
+ +

GCI Handler OnBefore for AIA2ADISPATCHER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+

Return value

+ +

#boolean:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:OnEventCrashOrDead(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:OnEventEngineShutdown(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:OnEventLand(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:ProcessDetected(Detection) + +
+
+ +

Assigns A2A AI Tasks in relation to the detected items.

+ +

Parameter

+ +

Return value

+ +

#boolean: +Return true if you want the task assigning to continue... false will cancel the loop.

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:RemoveDefenderFromSquadron(Squadron, Defender) + +
+
+ + + +

Parameters

+
    +
  • + +

    Squadron :

    + +
  • +
  • + +

    Defender :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER.SchedulerCAP(AI_A2A_DISPATCHER, SquadronName, self) + +
+
+ + + +

Parameters

+
    +
  • + +

    AIA2ADISPATCHER :

    + +
  • +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
  • + +

    self :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:SetBorderZone(BorderZone) + +
+
+ +

Define a border area to simulate a cold war scenario.

+ + +

A cold war is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border. +A hot war is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it. +If it’s a cold war then the borders of red and blue territory need to be defined using a zone object derived from Zone#ZONE_BASE. This method needs to be used for this. +If a hot war is chosen then no borders actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1

+ +

Parameter

+
    +
  • + +

    Core.Zone#ZONE_BASE BorderZone : +An object derived from ZONE_BASE, that defines a zone between

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+  -- Set a polygon zone as the border for the A2A dispatcher.
+  local BorderZone = ZONE_POLYGON( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -- The GROUP object is a late activate helicopter unit.
+  Dispatcher:SetBorderZone( BorderZone )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetDefenderTask(Defender, Type, Fsm, Target) + +
+
+ + + +

Parameters

+
    +
  • + +

    Defender :

    + +
  • +
  • + +

    Type :

    + +
  • +
  • + +

    Fsm :

    + +
  • +
  • + +

    Target :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:SetDefenderTaskTarget(AIGroup, Defender, Target) + +
+
+ + + +

Parameters

+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetEngageRadius(FriendliesRadius) + +
+
+ +

Define the radius to engage any target by airborne friendlies, which are executing cap or returning from an intercept mission.

+ + +

So, if there is a target area detected and reported, +then any friendlies that are airborne near this target area, +will be commanded to (re-)engage that target when available (if no other tasks were commanded). +For example, if 100000 is given as a value, then any friendly that is airborne within 100km from the detected target, +will be considered to receive the command to engage that target area. +You need to evaluate the value of this parameter carefully. +If too small, more intercept missions may be triggered upon detected target areas. +If too large, any airborne cap may not be able to reach the detected target area in time, because it is too far.

+ +

Parameter

+
    +
  • + +

    #number FriendliesRadius : +The radius to report friendlies near the target.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+  -- Set 100km as the radius to engage any target by airborne friendlies.
+  Dispatcher:InitDetectionFriendiesRadius( 100000 )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadron(SquadronName, AirbaseName, SpawnTemplates, Resources) + +
+
+ + + +

Parameters

+
    +
  • + +

    SquadronName :

    + +
  • +
  • + +

    AirbaseName :

    + +
  • +
  • + +

    SpawnTemplates :

    + +
  • +
  • + +

    Resources :

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronCap(SquadronName, Zone, FloorAltitude, CeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, AltType) + +
+
+ + + +

Parameters

+
    +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
  • + +

    Core.Zone#ZONE_BASE Zone : +The Zone object derived from Zone#ZONE_BASE that defines the zone wherein the CAP will be executed.

    + +
  • +
  • + +

    #number FloorAltitude : +The minimum altitude at which the cap can be executed.

    + +
  • +
  • + +

    #number CeilingAltitude : +the maximum altitude at which the cap can be executed.

    + +
  • +
  • + +

    #number PatrolMinSpeed : +The minimum speed at which the cap can be executed.

    + +
  • +
  • + +

    #number PatrolMaxSpeed : +The maximum speed at which the cap can be executed.

    + +
  • +
  • + +

    #number EngageMinSpeed : +The minimum speed at which the engage can be executed.

    + +
  • +
  • + +

    #number EngageMaxSpeed : +The maximum speed at which the engage can be executed.

    + +
  • +
  • + +

    #number AltType : +The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronCapInterval(SquadronName, CapLimit, LowInterval, HighInterval, Probability) + +
+
+ + + +

Parameters

+
    +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
  • + +

    CapLimit :

    + +
  • +
  • + +

    LowInterval :

    + +
  • +
  • + +

    HighInterval :

    + +
  • +
  • + +

    Probability :

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronGci(SquadronName, EngageMinSpeed, EngageMaxSpeed) + +
+
+ + + +

Parameters

+
    +
  • + +

    #string SquadronName : +The squadron name.

    + +
  • +
  • + +

    #number EngageMinSpeed : +The minimum speed at which the gci can be executed.

    + +
  • +
  • + +

    #number EngageMaxSpeed : +The maximum speed at which the gci can be executed.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronGrouping(SquadronName, Grouping) + +
+
+ + + +

Parameters

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
  • + +

    #number Grouping : +The level of grouping that will be applied of the CAP or GCI defenders.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  Dispatcher:SetSquadronGrouping( "SquadronName", 2 )
+
+
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronLanding(SquadronName, Landing) + +
+
+ +

Defines the method at which flights will land and despawn as part of the defense system.

+ +

Parameters

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
  • + +

    #number Landing : +The landing method which can be NearAirbase, AtRunway, AtEngineShutdown

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  Dispatcher:SetSquadronLanding( "SquadronName", AI_A2A_Dispatcher.Landing.NearAirbase )
+  
+  -- Let new flights take-off from the runway.
+  Dispatcher:SetSquadronLanding( "SquadronName", AI_A2A_Dispatcher.Landing.AtRunway )
+  
+  -- Let new flights take-off from the airbase hot.
+  Dispatcher:SetSquadronLanding( "SquadronName", AI_A2A_Dispatcher.Landing.AtEngineShutdown )
+
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronLandingAtEngineShutdown(SquadronName) + +
+
+ +

Sets flights to land and despawn at engine shutdown, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let flights land and despawn at engine shutdown.
+  Dispatcher:SetSquadronLandingAtEngineShutdown( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronLandingAtRunway(SquadronName) + +
+
+ +

Sets flights to land and despawn at the runway, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let flights land at the runway and despawn.
+  Dispatcher:SetSquadronLandingAtRunway( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronLandingNearAirbase(SquadronName) + +
+
+ +

Sets flights to land and despawn near the airbase in the air, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let flights land in the air and despawn.
+  Dispatcher:SetSquadronLandingNearAirbase( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronOverhead(SquadronName, Overhead) + +
+
+ +

Defines the amount of extra planes that will take-off as part of the defense system.

+ +

Parameters

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
  • + +

    #number Overhead : +The %-tage of Units that dispatching command will allocate to intercept in surplus of detected amount of units. +The default overhead is 1, so equal balance. The AIA2ADISPATCHER.SetOverhead() method can be used to tweak the defense strength, +taking into account the plane types of the squadron. For example, a MIG-31 with full long-distance A2A missiles payload, may still be less effective than a F-15C with short missiles... +So in this case, one may want to use the Overhead method to allocate more defending planes as the amount of detected attacking planes. +The overhead must be given as a decimal value with 1 as the neutral value, which means that Overhead values:

    + +
      +
    • Higher than 1, will increase the defense unit amounts.
    • +
    • Lower than 1, will decrease the defense unit amounts.
    • +
    + +

    The amount of defending units is calculated by multiplying the amount of detected attacking planes as part of the detected group +multiplied by the Overhead and rounded up to the smallest integer.

    + +

    The Overhead value set for a Squadron, can be programmatically adjusted (by using this SetOverhead method), to adjust the defense overhead during mission execution.

    + +

    See example below. +

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- An overhead of 1,5 with 1 planes detected, will allocate 2 planes ( 1 * 1,5 ) = 1,5 => rounded up gives 2.
+  -- An overhead of 1,5 with 2 planes detected, will allocate 3 planes ( 2 * 1,5 ) = 3 =>  rounded up gives 3.
+  -- An overhead of 1,5 with 3 planes detected, will allocate 5 planes ( 3 * 1,5 ) = 4,5 => rounded up gives 5 planes.
+  -- An overhead of 1,5 with 4 planes detected, will allocate 6 planes ( 4 * 1,5 ) = 6  => rounded up gives 6 planes.
+  
+  Dispatcher:SetSquadronOverhead( 1,5 )
+
+
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronTakeoff(SquadronName, Takeoff) + +
+
+ +

Defines the method at which new flights will spawn and take-off as part of the defense system.

+ +

Parameters

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
  • + +

    #number Takeoff : +From the airbase hot, from the airbase cold, in the air, from the runway.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  Dispatcher:SetSquadronTakeoff( "SquadronName", AI_A2A_Dispatcher.Takeoff.Air )
+  
+  -- Let new flights take-off from the runway.
+  Dispatcher:SetSquadronTakeoff( "SquadronName", AI_A2A_Dispatcher.Takeoff.Runway )
+  
+  -- Let new flights take-off from the airbase hot.
+  Dispatcher:SetSquadronTakeoff( "SquadronName", AI_A2A_Dispatcher.Takeoff.Hot )
+
+  -- Let new flights take-off from the airbase cold.
+  Dispatcher:SetSquadronTakeoff( "SquadronName", AI_A2A_Dispatcher.Takeoff.Cold )
+
+
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronTakeoffFromParkingCold(SquadronName) + +
+
+ +

Sets flights to take-off from the airbase at a cold location, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  Dispatcher:SetSquadronTakeoffFromParkingCold( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronTakeoffFromParkingHot(SquadronName) + +
+
+ +

Sets flights to take-off from the airbase at a hot location, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  Dispatcher:SetSquadronTakeoffFromParkingHot( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronTakeoffFromRunway(SquadronName) + +
+
+ +

Sets flights to take-off from the runway, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  Dispatcher:SetSquadronTakeoffFromRunway( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetSquadronTakeoffInAir(SquadronName) + +
+
+ +

Sets flights to take-off in the air, as part of the defense system.

+ +

Parameter

+
    +
  • + +

    #string SquadronName : +The name of the squadron.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+
+  local Dispatcher = AI_A2A_DISPATCHER:New( ... )
+  
+  -- Let new flights take-off in the air.
+  Dispatcher:SetSquadronTakeoffInAir( "SquadronName" )
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetTacticalDisplay(TacticalDisplay) + +
+
+ +

Display a tactical report every 30 seconds about which aircraft are: + * Patrolling + * Engaging + * Returning + * Damaged + * Out of Fuel + * ...

+ +

Parameter

+
    +
  • + +

    #boolean TacticalDisplay : +Provide a value of true to display every 30 seconds a tactical overview.

    + +
  • +
+

Return value

+ +

#AIA2ADISPATCHER:

+ + +
+
+
+
+ + + +AI_A2A_DISPATCHER.TacticalDisplay + +
+
+ + + +
+
+
+
+ + #AI_A2A_DISPATCHER.Takeoff + +AI_A2A_DISPATCHER.Takeoff + +
+
+ + + +
+
+
+
+ + +AI_A2A_DISPATCHER:__CAP(Delay) + +
+
+ +

CAP Asynchronous Trigger for AIA2ADISPATCHER

+ +

Parameter

+
    +
  • + +

    #number Delay :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:__ENGAGE(Delay) + +
+
+ +

ENGAGE Asynchronous Trigger for AIA2ADISPATCHER

+ +

Parameter

+
    +
  • + +

    #number Delay :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:__GCI(Delay) + +
+
+ +

GCI Asynchronous Trigger for AIA2ADISPATCHER

+ +

Parameter

+
    +
  • + +

    #number Delay :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:onafterCAP(From, Event, To, SquadronName) + +
+
+ + + +

Parameters

+
    +
  • + +

    From :

    + +
  • +
  • + +

    Event :

    + +
  • +
  • + +

    To :

    + +
  • +
  • + +

    SquadronName :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:onafterENGAGE(From, Event, To, Target, AIGroups) + +
+
+ + + +

Parameters

+
    +
  • + +

    From :

    + +
  • +
  • + +

    Event :

    + +
  • +
  • + +

    To :

    + +
  • +
  • + +

    Target :

    + +
  • +
  • + +

    AIGroups :

    + +
  • +
+
+
+
+
+ + +AI_A2A_DISPATCHER:onafterGCI(From, Event, To, Target, DefendersMissing, AIGroups) + +
+
+ + + +

Parameters

+
    +
  • + +

    From :

    + +
  • +
  • + +

    Event :

    + +
  • +
  • + +

    To :

    + +
  • +
  • + +

    Target :

    + +
  • +
  • + +

    DefendersMissing :

    + +
  • +
  • + +

    AIGroups :

    + +
  • +
+
+
+ +

Type AI_A2A_DISPATCHER.Takeoff

+ +

Enumerator for spawns at airbases

+ + +
+ +
+ + diff --git a/docs/Documentation/AI_A2A_GCI.html b/docs/Documentation/AI_A2A_GCI.html new file mode 100644 index 000000000..c6d4b3b60 --- /dev/null +++ b/docs/Documentation/AI_A2A_GCI.html @@ -0,0 +1,1566 @@ + + + + + + +
+
+ +
+
+
+
+ +
+

Module AI_A2A_GCI

+ +

AI -- Execute Ground Controlled Interception (GCI).

+ +

Banner Image

+ +
+ +

AI A2A_INTEREPT class makes AI Groups execute an Intercept.

+ + + +

There are the following types of GCI classes defined:

+ + + +
+ +

Author: Sven Van de Velde (FlightControl)

+ +

Contributions:

+ +
+ + +

Global(s)

+ + + + + +
AI_A2A_GCI +

AIA2AGCI class, extends AIA2A#AIA2A

+ +

The AIA2AGCI class implements the core functions to intercept intruders.

+
+

Type AI_A2A_GCI

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AI_A2A_GCI:Abort() +

Synchronous Event Trigger for Event Abort.

+
AI_A2A_GCI:Accomplish() +

Synchronous Event Trigger for Event Accomplish.

+
AI_A2A_GCI.Accomplished + +
AI_A2A_GCI.AttackSetUnit + +
AI_A2A_GCI:Destroy() +

Synchronous Event Trigger for Event Destroy.

+
AI_A2A_GCI:Engage() +

Synchronous Event Trigger for Event Engage.

+
AI_A2A_GCI.EngageMaxSpeed + +
AI_A2A_GCI.EngageMinSpeed + +
AI_A2A_GCI.Engaging + +
AI_A2A_GCI:Fired() +

Synchronous Event Trigger for Event Fired.

+
AI_A2A_GCI.InterceptRoute(AIControllable) + +
AI_A2A_GCI:New(AIGroup, EngageMinSpeed, EngageMaxSpeed) +

Creates a new AIA2AGCI object

+
AI_A2A_GCI:OnAfterAbort(AIGroup, From, Event, To) +

OnAfter Transition Handler for Event Abort.

+
AI_A2A_GCI:OnAfterAccomplish(AIGroup, From, Event, To) +

OnAfter Transition Handler for Event Accomplish.

+
AI_A2A_GCI:OnAfterDestroy(AIGroup, From, Event, To) +

OnAfter Transition Handler for Event Destroy.

+
AI_A2A_GCI:OnAfterEngage(AIGroup, From, Event, To) +

OnAfter Transition Handler for Event Engage.

+
AI_A2A_GCI:OnAfterFired(AIGroup, From, Event, To) +

OnAfter Transition Handler for Event Fired.

+
AI_A2A_GCI:OnBeforeAbort(AIGroup, From, Event, To) +

OnBefore Transition Handler for Event Abort.

+
AI_A2A_GCI:OnBeforeAccomplish(AIGroup, From, Event, To) +

OnBefore Transition Handler for Event Accomplish.

+
AI_A2A_GCI:OnBeforeDestroy(AIGroup, From, Event, To) +

OnBefore Transition Handler for Event Destroy.

+
AI_A2A_GCI:OnBeforeEngage(AIGroup, From, Event, To) +

OnBefore Transition Handler for Event Engage.

+
AI_A2A_GCI:OnBeforeFired(AIGroup, From, Event, To) +

OnBefore Transition Handler for Event Fired.

+
AI_A2A_GCI:OnEnterEngaging(AIGroup, From, Event, To) +

OnEnter Transition Handler for State Engaging.

+
AI_A2A_GCI:OnEventDead(EventData) + +
AI_A2A_GCI:OnLeaveEngaging(AIGroup, From, Event, To) +

OnLeave Transition Handler for State Engaging.

+
AI_A2A_GCI.PatrolAltType + +
AI_A2A_GCI.PatrolMaxSpeed + +
AI_A2A_GCI.PatrolMinSpeed + +
AI_A2A_GCI:__Abort(Delay) +

Asynchronous Event Trigger for Event Abort.

+
AI_A2A_GCI:__Accomplish(Delay) +

Asynchronous Event Trigger for Event Accomplish.

+
AI_A2A_GCI:__Destroy(Delay) +

Asynchronous Event Trigger for Event Destroy.

+
AI_A2A_GCI:__Engage(Delay) +

Asynchronous Event Trigger for Event Engage.

+
AI_A2A_GCI:__Fired(Delay) +

Asynchronous Event Trigger for Event Fired.

+
AI_A2A_GCI:onafterAbort(AIGroup, From, Event, To) + +
AI_A2A_GCI:onafterAccomplish(AIGroup, From, Event, To) + +
AI_A2A_GCI:onafterDestroy(AIGroup, From, Event, To, EventData) + +
AI_A2A_GCI:onafterEngage(AIGroup, From, Event, To) +

onafter State Transition for Event Patrol.

+
AI_A2A_GCI:onbeforeEngage(AIGroup, From, Event, To) + +
+ +

Global(s)

+
+
+ + #AI_A2A_GCI + +AI_A2A_GCI + +
+
+ +

AIA2AGCI class, extends AIA2A#AIA2A

+ +

The AIA2AGCI class implements the core functions to intercept intruders.

+ + +

The Engage function will intercept intruders.

+ +

Process

+ +

The AIA2AGCI is assigned a Group and this must be done before the AIA2AGCI 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. AIA2AGCI constructor

+ + + +

2. AIA2AGCI is a FSM

+ +

Process

+ +

2.1 AIA2AGCI 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 AIA2AGCI 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 AIGCI#AIA2A_GCI.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 AICap#AIA2A_GCI.SetEngageZone() to define that Zone.

+ +
+ + +
+
+

Type AI_A2A_GCI

+

Field(s)

+
+
+ + +AI_A2A_GCI:Abort() + +
+
+ +

Synchronous Event Trigger for Event Abort.

+ +
+
+
+
+ + +AI_A2A_GCI:Accomplish() + +
+
+ +

Synchronous Event Trigger for Event Accomplish.

+ +
+
+
+
+ + #boolean + +AI_A2A_GCI.Accomplished + +
+
+ + + +
+
+
+
+ + Core.Set#SET_UNIT + +AI_A2A_GCI.AttackSetUnit + +
+
+ + + +
+
+
+
+ + +AI_A2A_GCI:Destroy() + +
+
+ +

Synchronous Event Trigger for Event Destroy.

+ +
+
+
+
+ + +AI_A2A_GCI:Engage() + +
+
+ +

Synchronous Event Trigger for Event Engage.

+ +
+
+
+
+ + + +AI_A2A_GCI.EngageMaxSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A_GCI.EngageMinSpeed + +
+
+ + + +
+
+
+
+ + #boolean + +AI_A2A_GCI.Engaging + +
+
+ + + +
+
+
+
+ + +AI_A2A_GCI:Fired() + +
+
+ +

Synchronous Event Trigger for Event Fired.

+ +
+
+
+
+ + +AI_A2A_GCI.InterceptRoute(AIControllable) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A_GCI:New(AIGroup, EngageMinSpeed, EngageMaxSpeed) + +
+
+ +

Creates a new AIA2AGCI object

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup :

    + +
  • +
  • + +

    EngageMinSpeed :

    + +
  • +
  • + +

    EngageMaxSpeed :

    + +
  • +
+

Return value

+ +

#AIA2AGCI:

+ + +
+
+
+
+ + +AI_A2A_GCI:OnAfterAbort(AIGroup, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Abort.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:OnAfterAccomplish(AIGroup, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Accomplish.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:OnAfterDestroy(AIGroup, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Destroy.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:OnAfterEngage(AIGroup, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Engage.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:OnAfterFired(AIGroup, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Fired.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:OnBeforeAbort(AIGroup, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Abort.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup 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_A2A_GCI:OnBeforeAccomplish(AIGroup, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Accomplish.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup 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_A2A_GCI:OnBeforeDestroy(AIGroup, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Destroy.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup 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_A2A_GCI:OnBeforeEngage(AIGroup, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Engage.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup 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_A2A_GCI:OnBeforeFired(AIGroup, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Fired.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup 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_A2A_GCI:OnEnterEngaging(AIGroup, From, Event, To) + +
+
+ +

OnEnter Transition Handler for State Engaging.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:OnEventDead(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ + +AI_A2A_GCI:OnLeaveEngaging(AIGroup, From, Event, To) + +
+
+ +

OnLeave Transition Handler for State Engaging.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup 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.

+ +
+
+
+
+ + #string + +AI_A2A_GCI.PatrolAltType + +
+
+ + + +
+
+
+
+ + + +AI_A2A_GCI.PatrolMaxSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A_GCI.PatrolMinSpeed + +
+
+ + + +
+
+
+
+ + +AI_A2A_GCI:__Abort(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Abort.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:__Accomplish(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Accomplish.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:__Destroy(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Destroy.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:__Engage(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Engage.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:__Fired(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Fired.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:onafterAbort(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AI Group managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:onafterAccomplish(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:onafterDestroy(AIGroup, From, Event, To, EventData) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
  • + +

    Core.Event#EVENTDATA EventData :

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:onafterEngage(AIGroup, From, Event, To) + +
+
+ +

onafter State Transition for Event Patrol.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AI Group managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+
+
+ + +AI_A2A_GCI:onbeforeEngage(AIGroup, From, Event, To) + +
+
+ + + +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup Object managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+ +
+ +
+ + diff --git a/docs/Documentation/AI_A2A_Patrol.html b/docs/Documentation/AI_A2A_Patrol.html new file mode 100644 index 000000000..a386ed968 --- /dev/null +++ b/docs/Documentation/AI_A2A_Patrol.html @@ -0,0 +1,1093 @@ + + + + + + +
+
+ +
+
+
+
+ +
+

Module AI_A2A_Patrol

+ +

AI -- Air Patrolling or Staging.

+ +

Banner Image

+ +
+ +

AI PATROL classes makes AI Controllables execute an Patrol.

+ + + +

There are the following types of PATROL classes defined:

+ + + +
+ +

Demo Missions

+ +

AI_PATROL Demo Missions source code

+ +

AI_PATROL Demo Missions, only for beta testers

+ +

ALL Demo Missions pack of the last release

+ +
+ +

YouTube Channel

+ +

AI_PATROL YouTube Channel

+ +
+ +

Author: Sven Van de Velde (FlightControl)

+

Contributions:

+ +
    +
  • Dutch_Baron: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
  • +
  • Pikey: Testing and API concept review.
  • +
+ +
+ + +

Global(s)

+ + + + + +
AI_A2A_PATROL +

AIA2APATROL class, extends Fsm#FSM_CONTROLLABLE

+ +

The AIA2APATROL class implements the core functions to patrol a Zone by an AI Controllable or Group.

+
+

Type AI_A2A_PATROL

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AI_A2A_PATROL:New(AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType) +

Creates a new AIA2APATROL object

+
AI_A2A_PATROL:OnAfterPatrol(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Patrol.

+
AI_A2A_PATROL:OnAfterRoute(Controllable, From, Event, To) +

OnAfter Transition Handler for Event Route.

+
AI_A2A_PATROL:OnBeforePatrol(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Patrol.

+
AI_A2A_PATROL:OnBeforeRoute(Controllable, From, Event, To) +

OnBefore Transition Handler for Event Route.

+
AI_A2A_PATROL:OnEnterPatrolling(Controllable, From, Event, To) +

OnEnter Transition Handler for State Patrolling.

+
AI_A2A_PATROL:OnLeavePatrolling(Controllable, From, Event, To) +

OnLeave Transition Handler for State Patrolling.

+
AI_A2A_PATROL:Patrol() +

Synchronous Event Trigger for Event Patrol.

+
AI_A2A_PATROL.PatrolAltType + +
AI_A2A_PATROL.PatrolCeilingAltitude + +
AI_A2A_PATROL.PatrolFloorAltitude + +
AI_A2A_PATROL.PatrolMaxSpeed + +
AI_A2A_PATROL.PatrolMinSpeed + +
AI_A2A_PATROL.PatrolRoute(AIGroup) + +
AI_A2A_PATROL.PatrolZone + +
AI_A2A_PATROL:Route() +

Synchronous Event Trigger for Event Route.

+
AI_A2A_PATROL:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude) +

Sets the floor and ceiling altitude of the patrol.

+
AI_A2A_PATROL:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed) +

Sets (modifies) the minimum and maximum speed of the patrol.

+
AI_A2A_PATROL:__Patrol(Delay) +

Asynchronous Event Trigger for Event Patrol.

+
AI_A2A_PATROL:__Route(Delay) +

Asynchronous Event Trigger for Event Route.

+
AI_A2A_PATROL:onafterPatrol(Controllable, From, Event, To) +

Defines a new patrol route using the Process_PatrolZone parameters and settings.

+
AI_A2A_PATROL:onafterRoute(AIGroup, From, Event, To) +

Defines a new patrol route using the Process_PatrolZone parameters and settings.

+
+ +

Global(s)

+
+
+ + #AI_A2A_PATROL + +AI_A2A_PATROL + +
+
+ +

AIA2APATROL class, extends Fsm#FSM_CONTROLLABLE

+ +

The AIA2APATROL class implements the core functions to patrol a Zone by an AI Controllable or Group.

+ + + +

Process

+ +

The AIA2APATROL is assigned a Group and this must be done before the AIA2APATROL 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

+ +

-- Note that the enemy is not engaged! To model enemy engagement, either tailor the Detected event, or +use derived AI_ classes to model AI offensive or defensive behaviour.

+ +

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. AIA2APATROL constructor

+ + + +

2. AIA2APATROL is a FSM

+ +

Process

+ +

2.1. AIA2APATROL States

+ +
    +
  • None ( Group ): The process is not started yet.
  • +
  • Patrolling ( Group ): The AI is patrolling the Patrol Zone.
  • +
  • Returning ( Group ): The AI is returning to Base.
  • +
  • Stopped ( Group ): The process is stopped.
  • +
  • Crashed ( Group ): The AI has crashed or is dead.
  • +
+ +

2.2. AIA2APATROL Events

+ +
    +
  • Start ( Group ): Start the process.
  • +
  • Stop ( Group ): Stop the process.
  • +
  • Route ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
  • +
  • RTB ( Group ): Route the AI to the home base.
  • +
  • Detect ( Group ): The AI is detecting targets.
  • +
  • Detected ( Group ): The AI has detected new targets.
  • +
  • Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.
  • +
+ +

3. Set or Get the AI controllable

+ + + +

4. Set the Speed and Altitude boundaries of the AI controllable

+ + + +

5. Manage the detection process of the AI controllable

+ +

The detection process of the AI controllable can be manipulated. +Detection requires an amount of CPU power, which has an impact on your mission performance. +Only put detection on when absolutely necessary, and the frequency of the detection can also be set.

+ + + +

The detection frequency can be set with AIA2APATROL.SetDetectionInterval( seconds ), where the amount of seconds specify how much seconds will be waited before the next detection. +Use the method AIA2APATROL.GetDetectedUnits() to obtain a list of the Units detected by the AI.

+ +

The detection can be filtered to potential targets in a specific zone. +Use the method AIA2APATROL.SetDetectionZone() to set the zone where targets need to be detected. +Note that when the zone is too far away, or the AI is not heading towards the zone, or the AI is too high, no targets may be detected +according the weather conditions.

+ +

6. Manage the "out of fuel" in the AIA2APATROL

+ +

When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. +Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. +When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, +while a new AI is targetted to the AIA2APATROL. +Once the time is finished, the old AI will return to the base. +Use the method AIA2APATROL.ManageFuel() to have this proces in place.

+ +

7. Manage "damage" behaviour of the AI in the AIA2APATROL

+ +

When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on. +Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). +Use the method AIA2APATROL.ManageDamage() to have this proces in place.

+ +
+ + +
+
+

Type AI_A2A_Patrol

+ +

Type AI_A2A_PATROL

+

Field(s)

+
+
+ + +AI_A2A_PATROL:New(AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType) + +
+
+ +

Creates a new AIA2APATROL object

+ +

Parameters

+ +

Return value

+ +

#AIA2APATROL: +self

+ +

Usage:

+
-- Define a new AI_A2A_PATROL Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h.
+PatrolZone = ZONE:New( 'PatrolZone' )
+PatrolSpawn = SPAWN:New( 'Patrol Group' )
+PatrolArea = AI_A2A_PATROL:New( PatrolZone, 3000, 6000, 600, 900 )
+ +
+
+
+
+ + +AI_A2A_PATROL:OnAfterPatrol(Controllable, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Patrol.

+ +

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_A2A_PATROL:OnAfterRoute(Controllable, From, Event, To) + +
+
+ +

OnAfter Transition Handler for Event Route.

+ +

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_A2A_PATROL:OnBeforePatrol(Controllable, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Patrol.

+ +

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_A2A_PATROL:OnBeforeRoute(Controllable, From, Event, To) + +
+
+ +

OnBefore Transition Handler for Event Route.

+ +

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_A2A_PATROL:OnEnterPatrolling(Controllable, From, Event, To) + +
+
+ +

OnEnter Transition Handler for State Patrolling.

+ +

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_A2A_PATROL:OnLeavePatrolling(Controllable, From, Event, To) + +
+
+ +

OnLeave Transition Handler for State Patrolling.

+ +

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_A2A_PATROL:Patrol() + +
+
+ +

Synchronous Event Trigger for Event Patrol.

+ +
+
+
+
+ + +AI_A2A_PATROL.PatrolAltType + +
+
+ + + + +

defafult PatrolAltType to "RADIO" if not specified

+ +
+
+
+
+ + + +AI_A2A_PATROL.PatrolCeilingAltitude + +
+
+ + + +
+
+
+
+ + + +AI_A2A_PATROL.PatrolFloorAltitude + +
+
+ + + +
+
+
+
+ + + +AI_A2A_PATROL.PatrolMaxSpeed + +
+
+ + + +
+
+
+
+ + + +AI_A2A_PATROL.PatrolMinSpeed + +
+
+ + + +
+
+
+
+ + +AI_A2A_PATROL.PatrolRoute(AIGroup) + +
+
+ + + +

Parameter

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +This statis method is called from the route path within the last task at the last waaypoint of the Controllable. +Note that this method is required, as triggers the next route when patrolling for the Controllable.

    + +
  • +
+
+
+
+
+ + + +AI_A2A_PATROL.PatrolZone + +
+
+ + + +
+
+
+
+ + +AI_A2A_PATROL:Route() + +
+
+ +

Synchronous Event Trigger for Event Route.

+ +
+
+
+
+ + +AI_A2A_PATROL:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude) + +
+
+ +

Sets the floor and ceiling altitude of the patrol.

+ +

Parameters

+
    +
  • + +

    Dcs.DCSTypes#Altitude PatrolFloorAltitude : +The lowest altitude in meters where to execute the patrol.

    + +
  • +
  • + +

    Dcs.DCSTypes#Altitude PatrolCeilingAltitude : +The highest altitude in meters where to execute the patrol.

    + +
  • +
+

Return value

+ +

#AIA2APATROL: +self

+ +
+
+
+
+ + +AI_A2A_PATROL:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed) + +
+
+ +

Sets (modifies) the minimum and maximum speed of the patrol.

+ +

Parameters

+ +

Return value

+ +

#AIA2APATROL: +self

+ +
+
+
+
+ + +AI_A2A_PATROL:__Patrol(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Patrol.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_PATROL:__Route(Delay) + +
+
+ +

Asynchronous Event Trigger for Event Route.

+ +

Parameter

+
    +
  • + +

    #number Delay : +The delay in seconds.

    + +
  • +
+
+
+
+
+ + +AI_A2A_PATROL:onafterPatrol(Controllable, From, Event, To) + +
+
+ +

Defines a new patrol route using the Process_PatrolZone parameters and settings.

+ +

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

+ +

#AIA2APATROL: +self

+ +
+
+
+
+ + +AI_A2A_PATROL:onafterRoute(AIGroup, From, Event, To) + +
+
+ +

Defines a new patrol route using the Process_PatrolZone parameters and settings.

+ +

Parameters

+
    +
  • + +

    Wrapper.Group#GROUP AIGroup : +The AIGroup managed by the FSM.

    + +
  • +
  • + +

    #string From : +The From State string.

    + +
  • +
  • + +

    #string Event : +The Event string.

    + +
  • +
  • + +

    #string To : +The To State string.

    + +
  • +
+
+
+ +
+ +
+ + diff --git a/docs/Documentation/AI_BAI.html b/docs/Documentation/AI_BAI.html index 3c95dd5f8..afa707ccf 100644 --- a/docs/Documentation/AI_BAI.html +++ b/docs/Documentation/AI_BAI.html @@ -17,6 +17,11 @@ index + + +
+
+ + + +CONTROLLABLE.TaskScheduler + +
+
+ + +
@@ -3315,6 +3528,37 @@ If WayPoints is given, then use the route.

Type DCSStopCondition

+

Type Vec2

+

Field(s)

+
+
+ + + +Vec2.x + +
+
+ + + +
+
+
+
+ + + +Vec2.y + +
+
+ + + +
+
+

Type list

diff --git a/docs/Documentation/DCSAirbase.html b/docs/Documentation/DCSAirbase.html index 3ac796e64..dcf1f5e56 100644 --- a/docs/Documentation/DCSAirbase.html +++ b/docs/Documentation/DCSAirbase.html @@ -17,6 +17,11 @@ index

Multiple Unit.Category entries can be given as a table and then these will be evaluated as an OR expression.

+ + + + DETECTION_BASE:ForgetDetectedUnit(UnitName) + +

Forget a Unit from a DetectionItem

@@ -2389,7 +2400,6 @@ The index of the DetectedItem.

- #number DETECTION_BASE.DetectedItemMax @@ -2547,7 +2557,7 @@ The index of the DetectedItem.

- + #number DETECTION_BASE.DetectionInterval @@ -2682,6 +2692,33 @@ cs.DCSUnit#Unit> FilterCategories The Categories entries

#DETECTION_BASE: self

+ +
+
+
+ + +DETECTION_BASE:ForgetDetectedUnit(UnitName) + +
+
+ +

Forget a Unit from a DetectionItem

+ +

Parameter

+
    +
  • + +

    #string UnitName : +The UnitName that needs to be forgotten from the DetectionItem Sets.

    + +
  • +
+

Return value

+ +

#DETECTION_BASE:

+ +
diff --git a/docs/Documentation/DetectionManager.html b/docs/Documentation/DetectionManager.html index 691620d5b..ffff150e6 100644 --- a/docs/Documentation/DetectionManager.html +++ b/docs/Documentation/DetectionManager.html @@ -17,6 +17,11 @@ index
+
+
+ + +DETECTION_MANAGER:OnAfterStart(From, Event, To) + +
+
+ +

Start Handler OnAfter for DETECTION_MANAGER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+
+
+
+
+ + +DETECTION_MANAGER:OnAfterStop(From, Event, To) + +
+
+ +

Stop Handler OnAfter for DETECTION_MANAGER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+
+
+
+
+ + +DETECTION_MANAGER:OnBeforeStart(From, Event, To) + +
+
+ +

Start Handler OnBefore for DETECTION_MANAGER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+

Return value

+ +

#boolean:

+ + +
+
+
+
+ + +DETECTION_MANAGER:OnBeforeStop(From, Event, To) + +
+
+ +

Stop Handler OnBefore for DETECTION_MANAGER

+ +

Parameters

+
    +
  • + +

    #string From :

    + +
  • +
  • + +

    #string Event :

    + +
  • +
  • + +

    #string To :

    + +
  • +
+

Return value

+ +

#boolean:

+ +
@@ -476,6 +663,32 @@ The interval in seconds when a report needs to be done.

#DETECTION_MANAGER: self

+ +
+
+
+ + +DETECTION_MANAGER:Start() + +
+
+ +

Start Trigger for DETECTION_MANAGER

+ +
+
+
+
+ + +DETECTION_MANAGER:Stop() + +
+
+ +

Stop Trigger for DETECTION_MANAGER

+
@@ -504,6 +717,48 @@ self

+ +
+
+
+ + +DETECTION_MANAGER:__Start(Delay) + +
+
+ +

Start Asynchronous Trigger for DETECTION_MANAGER

+ +

Parameter

+
    +
  • + +

    #number Delay :

    + +
  • +
+
+
+
+
+ + +DETECTION_MANAGER:__Stop(Delay) + +
+
+ +

Stop Asynchronous Trigger for DETECTION_MANAGER

+ +

Parameter

+
    +
  • + +

    #number Delay :

    + +
  • +
diff --git a/docs/Documentation/Escort.html b/docs/Documentation/Escort.html index 03f1da661..ebf59fcc1 100644 --- a/docs/Documentation/Escort.html +++ b/docs/Documentation/Escort.html @@ -17,6 +17,11 @@ index + +
+
+
+ + + +GROUPTEMPLATE + +
+
+ + +

Type Group

@@ -1985,6 +2044,20 @@ The country ID.

#table:

+ +
+
+
+ + #GROUP.Takeoff + +GROUP.Takeoff + +
+
+ + +
@@ -2011,6 +2084,68 @@ The country ID.

#GROUP:

+ +
+ +

Type GROUP.Takeoff

+ +

Enumerator for location at airbases

+ +

Field(s)

+
+
+ + #number + +GROUP.Takeoff.Air + +
+
+ + + +
+
+
+
+ + #number + +GROUP.Takeoff.Cold + +
+
+ + + +
+
+
+
+ + #number + +GROUP.Takeoff.Hot + +
+
+ + + +
+
+
+
+ + #number + +GROUP.Takeoff.Runway + +
+
+ + +
diff --git a/docs/Documentation/Identifiable.html b/docs/Documentation/Identifiable.html index 1e4978c18..bb4e93bce 100644 --- a/docs/Documentation/Identifiable.html +++ b/docs/Documentation/Identifiable.html @@ -17,6 +17,11 @@ index

Return value

-

Core.Point#COORDINATE:

+

#COORDINATE:

@@ -1744,7 +1749,7 @@ The Vec3 point.

Return value

-

Core.Point#COORDINATE:

+

#COORDINATE:

diff --git a/docs/Documentation/Positionable.html b/docs/Documentation/Positionable.html index b12cb6974..b38e91bd3 100644 --- a/docs/Documentation/Positionable.html +++ b/docs/Documentation/Positionable.html @@ -17,6 +17,11 @@ index
    +
  • AI_A2A
  • +
  • AI_A2A_Cap
  • +
  • AI_A2A_Dispatcher
  • +
  • AI_A2A_GCI
  • +
  • AI_A2A_Patrol
  • AI_Bai
  • AI_Balancer
  • AI_Cap
  • @@ -368,7 +373,8 @@ Nothing of this code should be modified without testing it thoroughly.

    -

    or {}

    +

    Initialize the ObjectSchedulers array, which is a weakly coupled table. + If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.

    diff --git a/docs/Documentation/Scheduler.html b/docs/Documentation/Scheduler.html index 66da19f32..64e0a878f 100644 --- a/docs/Documentation/Scheduler.html +++ b/docs/Documentation/Scheduler.html @@ -17,6 +17,11 @@ index
diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html index 78ec01d83..d8aa5e633 100644 --- a/docs/Documentation/SpawnStatic.html +++ b/docs/Documentation/SpawnStatic.html @@ -17,6 +17,11 @@ index