mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #716 from FlightControl-Master/FC-Spawn-Optimization
Fc spawn optimization
This commit is contained in:
commit
93ba003e5b
@ -2610,7 +2610,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
if Cap then
|
if Cap then
|
||||||
|
|
||||||
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Functional.Spawn#SPAWN
|
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Core.Spawn#SPAWN
|
||||||
local DefenderGrouping = DefenderSquadron.Grouping or self.DefenderDefault.Grouping
|
local DefenderGrouping = DefenderSquadron.Grouping or self.DefenderDefault.Grouping
|
||||||
Spawn:InitGrouping( DefenderGrouping )
|
Spawn:InitGrouping( DefenderGrouping )
|
||||||
|
|
||||||
@ -2783,7 +2783,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
while ( DefendersNeeded > 0 ) do
|
while ( DefendersNeeded > 0 ) do
|
||||||
|
|
||||||
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Functional.Spawn#SPAWN
|
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Core.Spawn#SPAWN
|
||||||
local DefenderGrouping = ( DefenderGrouping < DefendersNeeded ) and DefenderGrouping or DefendersNeeded
|
local DefenderGrouping = ( DefenderGrouping < DefendersNeeded ) and DefenderGrouping or DefendersNeeded
|
||||||
if DefenderGrouping then
|
if DefenderGrouping then
|
||||||
Spawn:InitGrouping( DefenderGrouping )
|
Spawn:InitGrouping( DefenderGrouping )
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
--- @type AI_BALANCER
|
--- @type AI_BALANCER
|
||||||
-- @field Core.Set#SET_CLIENT SetClient
|
-- @field Core.Set#SET_CLIENT SetClient
|
||||||
-- @field Functional.Spawn#SPAWN SpawnAI
|
-- @field Core.Spawn#SPAWN SpawnAI
|
||||||
-- @field Wrapper.Group#GROUP Test
|
-- @field Wrapper.Group#GROUP Test
|
||||||
-- @extends Core.Fsm#FSM_SET
|
-- @extends Core.Fsm#FSM_SET
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ AI_BALANCER = {
|
|||||||
--- Creates a new AI_BALANCER object
|
--- Creates a new AI_BALANCER object
|
||||||
-- @param #AI_BALANCER self
|
-- @param #AI_BALANCER self
|
||||||
-- @param Core.Set#SET_CLIENT SetClient A SET\_CLIENT object that will contain the CLIENT objects to be monitored if they are alive or not (joined by a player).
|
-- @param Core.Set#SET_CLIENT SetClient A SET\_CLIENT object that will contain the CLIENT objects to be monitored if they are alive or not (joined by a player).
|
||||||
-- @param Functional.Spawn#SPAWN SpawnAI The default Spawn object to spawn new AI Groups when needed.
|
-- @param Core.Spawn#SPAWN SpawnAI The default Spawn object to spawn new AI Groups when needed.
|
||||||
-- @return #AI_BALANCER
|
-- @return #AI_BALANCER
|
||||||
function AI_BALANCER:New( SetClient, SpawnAI )
|
function AI_BALANCER:New( SetClient, SpawnAI )
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
-- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
|
-- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
|
||||||
-- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
|
-- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
|
||||||
-- @field Functional.Spawn#SPAWN CoordTest
|
-- @field Core.Spawn#SPAWN CoordTest
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- # AI_PATROL_ZONE class, extends @{Fsm#FSM_CONTROLLABLE}
|
--- # AI_PATROL_ZONE class, extends @{Fsm#FSM_CONTROLLABLE}
|
||||||
|
|||||||
@ -1354,7 +1354,7 @@ ZONE_POLYGON = {
|
|||||||
ClassName="ZONE_POLYGON",
|
ClassName="ZONE_POLYGON",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Group#GROUP} defined within the Mission Editor.
|
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the @{Group#GROUP} defined within the Mission Editor.
|
||||||
-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
|
-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
|
||||||
-- @param #ZONE_POLYGON self
|
-- @param #ZONE_POLYGON self
|
||||||
-- @param #string ZoneName Name of the zone.
|
-- @param #string ZoneName Name of the zone.
|
||||||
@ -1370,3 +1370,22 @@ function ZONE_POLYGON:New( ZoneName, ZoneGroup )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the **name** of the @{Group#GROUP} defined within the Mission Editor.
|
||||||
|
-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
|
||||||
|
-- @param #ZONE_POLYGON self
|
||||||
|
-- @param #string ZoneName Name of the zone.
|
||||||
|
-- @param #string GroupName The group name of the GROUP defining the waypoints within the Mission Editor to define the polygon shape.
|
||||||
|
-- @return #ZONE_POLYGON self
|
||||||
|
function ZONE_POLYGON:NewFromGroupName( ZoneName, GroupName )
|
||||||
|
|
||||||
|
local ZoneGroup = GROUP:FindByName( GroupName )
|
||||||
|
|
||||||
|
local GroupPoints = ZoneGroup:GetTaskRoute()
|
||||||
|
|
||||||
|
local self = BASE:Inherit( self, ZONE_POLYGON_BASE:New( ZoneName, GroupPoints ) )
|
||||||
|
self:F( { ZoneName, ZoneGroup, self._.Polygon } )
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|||||||
@ -112,7 +112,7 @@
|
|||||||
-- @field #string livery Livery of the aircraft set by user.
|
-- @field #string livery Livery of the aircraft set by user.
|
||||||
-- @field #string skill Skill of AI.
|
-- @field #string skill Skill of AI.
|
||||||
-- @field #boolean ATCswitch Enable/disable ATC if set to true/false.
|
-- @field #boolean ATCswitch Enable/disable ATC if set to true/false.
|
||||||
-- @extends Functional.Spawn#SPAWN
|
-- @extends Core.Spawn#SPAWN
|
||||||
|
|
||||||
---# RAT class, extends @{Spawn#SPAWN}
|
---# RAT class, extends @{Spawn#SPAWN}
|
||||||
-- The RAT class implements an easy to use way to randomly fill your map with AI aircraft.
|
-- The RAT class implements an easy to use way to randomly fill your map with AI aircraft.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Spawn dynamically new GROUPs in your missions.
|
--- **Core** -- SPAWN class dynamically spawns new groups of units in your missions.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@ -55,8 +55,12 @@
|
|||||||
|
|
||||||
--- # SPAWN class, extends @{Base#BASE}
|
--- # SPAWN class, extends @{Base#BASE}
|
||||||
--
|
--
|
||||||
|
-- -- 
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
-- The SPAWN class allows to spawn dynamically new groups.
|
-- The SPAWN class allows to spawn dynamically new groups.
|
||||||
-- Each SPAWN object needs to be have a related **template group** setup in the Mission Editor (ME),
|
-- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME),
|
||||||
-- which is a normal group with the **Late Activation** flag set.
|
-- which is a normal group with the **Late Activation** flag set.
|
||||||
-- This template group will never be activated in your mission.
|
-- This template group will never be activated in your mission.
|
||||||
-- SPAWN uses that **template group** to reference to all the characteristics
|
-- SPAWN uses that **template group** to reference to all the characteristics
|
||||||
@ -521,6 +525,73 @@ function SPAWN:InitRandomizeTemplate( SpawnTemplatePrefixTable )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object.
|
||||||
|
-- This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor,
|
||||||
|
-- but they will all follow the same Template route and have the same prefix name.
|
||||||
|
-- In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param Core.Set#SET_GROUP SpawnTemplateSet A SET_GROUP object set, that contains the groups that are possible unit representatives of the group to be spawned.
|
||||||
|
-- @return #SPAWN
|
||||||
|
-- @usage
|
||||||
|
-- -- NATO Tank Platoons invading Gori.
|
||||||
|
--
|
||||||
|
-- -- Choose between different 'US Tank Platoon Template' configurations to be spawned for the
|
||||||
|
-- -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.
|
||||||
|
--
|
||||||
|
-- -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
|
||||||
|
-- -- with a limit set of maximum 12 Units alive simulteneously and 150 Groups to be spawned during the whole mission.
|
||||||
|
--
|
||||||
|
-- Spawn_US_PlatoonSet = SET_GROUP:New():FilterPrefixes( "US Tank Platoon Templates" ):FilterOnce()
|
||||||
|
--
|
||||||
|
-- --- Now use the Spawn_US_PlatoonSet to define the templates using InitRandomizeTemplateSet.
|
||||||
|
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
|
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
|
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
|
function SPAWN:InitRandomizeTemplateSet( SpawnTemplateSet ) -- R2.3
|
||||||
|
self:F( { self.SpawnTemplatePrefix } )
|
||||||
|
|
||||||
|
self.SpawnTemplatePrefixTable = SpawnTemplateSet:GetSetNames()
|
||||||
|
self.SpawnRandomizeTemplate = true
|
||||||
|
|
||||||
|
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
||||||
|
self:_RandomizeTemplate( SpawnGroupID )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names.
|
||||||
|
-- This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor,
|
||||||
|
-- but they will all follow the same Template route and have the same prefix name.
|
||||||
|
-- In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #string SpawnTemplatePrefixes A string or a list of string that contains the prefixes of the groups that are possible unit representatives of the group to be spawned.
|
||||||
|
-- @return #SPAWN
|
||||||
|
-- @usage
|
||||||
|
-- -- NATO Tank Platoons invading Gori.
|
||||||
|
--
|
||||||
|
-- -- Choose between different 'US Tank Platoon Templates' configurations to be spawned for the
|
||||||
|
-- -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.
|
||||||
|
--
|
||||||
|
-- -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
|
||||||
|
-- -- with a limit set of maximum 12 Units alive simulteneously and 150 Groups to be spawned during the whole mission.
|
||||||
|
--
|
||||||
|
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
|
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
|
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
|
function SPAWN:InitRandomizeTemplatePrefixes( SpawnTemplatePrefixes ) --R2.3
|
||||||
|
self:F( { self.SpawnTemplatePrefix } )
|
||||||
|
|
||||||
|
local SpawnTemplateSet = SET_GROUP:New():FilterPrefixes( SpawnTemplatePrefixes ):FilterOnce()
|
||||||
|
|
||||||
|
self:InitRandomizeTemplateSet( SpawnTemplateSet )
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- When spawning a new group, make the grouping of the units according the InitGrouping setting.
|
--- When spawning a new group, make the grouping of the units according the InitGrouping setting.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #number Grouping Indicates the maximum amount of units in the group.
|
-- @param #number Grouping Indicates the maximum amount of units in the group.
|
||||||
|
|||||||
@ -17,6 +17,7 @@ Core/Point.lua
|
|||||||
Core/Message.lua
|
Core/Message.lua
|
||||||
Core/Fsm.lua
|
Core/Fsm.lua
|
||||||
Core/Radio.lua
|
Core/Radio.lua
|
||||||
|
Core/Spawn.lua
|
||||||
Core/SpawnStatic.lua
|
Core/SpawnStatic.lua
|
||||||
Core/Goal.lua
|
Core/Goal.lua
|
||||||
Core/Cargo.lua
|
Core/Cargo.lua
|
||||||
@ -35,7 +36,6 @@ Wrapper/Scenery.lua
|
|||||||
|
|
||||||
Functional/Scoring.lua
|
Functional/Scoring.lua
|
||||||
Functional/CleanUp.lua
|
Functional/CleanUp.lua
|
||||||
Functional/Spawn.lua
|
|
||||||
Functional/Movement.lua
|
Functional/Movement.lua
|
||||||
Functional/Sead.lua
|
Functional/Sead.lua
|
||||||
Functional/Escort.lua
|
Functional/Escort.lua
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20171010_1107' )
|
env.info( 'Moose Generation Timestamp: 20171010_2132' )
|
||||||
|
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ __Moose.Include( 'Core/Point.lua' )
|
|||||||
__Moose.Include( 'Core/Message.lua' )
|
__Moose.Include( 'Core/Message.lua' )
|
||||||
__Moose.Include( 'Core/Fsm.lua' )
|
__Moose.Include( 'Core/Fsm.lua' )
|
||||||
__Moose.Include( 'Core/Radio.lua' )
|
__Moose.Include( 'Core/Radio.lua' )
|
||||||
|
__Moose.Include( 'Core/Spawn.lua' )
|
||||||
__Moose.Include( 'Core/SpawnStatic.lua' )
|
__Moose.Include( 'Core/SpawnStatic.lua' )
|
||||||
__Moose.Include( 'Core/Goal.lua' )
|
__Moose.Include( 'Core/Goal.lua' )
|
||||||
__Moose.Include( 'Core/Cargo.lua' )
|
__Moose.Include( 'Core/Cargo.lua' )
|
||||||
@ -55,7 +56,6 @@ __Moose.Include( 'Wrapper/Airbase.lua' )
|
|||||||
__Moose.Include( 'Wrapper/Scenery.lua' )
|
__Moose.Include( 'Wrapper/Scenery.lua' )
|
||||||
__Moose.Include( 'Functional/Scoring.lua' )
|
__Moose.Include( 'Functional/Scoring.lua' )
|
||||||
__Moose.Include( 'Functional/CleanUp.lua' )
|
__Moose.Include( 'Functional/CleanUp.lua' )
|
||||||
__Moose.Include( 'Functional/Spawn.lua' )
|
|
||||||
__Moose.Include( 'Functional/Movement.lua' )
|
__Moose.Include( 'Functional/Movement.lua' )
|
||||||
__Moose.Include( 'Functional/Sead.lua' )
|
__Moose.Include( 'Functional/Sead.lua' )
|
||||||
__Moose.Include( 'Functional/Escort.lua' )
|
__Moose.Include( 'Functional/Escort.lua' )
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info('*** MOOSE DYNAMIC INCLUDE START *** ')
|
env.info('*** MOOSE DYNAMIC INCLUDE START *** ')
|
||||||
env.info('Moose Generation Timestamp: 20171010_1107')
|
env.info('Moose Generation Timestamp: 20171010_2132')
|
||||||
local base=_G
|
local base=_G
|
||||||
__Moose={}
|
__Moose={}
|
||||||
__Moose.Include=function(IncludeFile)
|
__Moose.Include=function(IncludeFile)
|
||||||
@ -34,6 +34,7 @@ __Moose.Include('Core/Point.lua')
|
|||||||
__Moose.Include('Core/Message.lua')
|
__Moose.Include('Core/Message.lua')
|
||||||
__Moose.Include('Core/Fsm.lua')
|
__Moose.Include('Core/Fsm.lua')
|
||||||
__Moose.Include('Core/Radio.lua')
|
__Moose.Include('Core/Radio.lua')
|
||||||
|
__Moose.Include('Core/Spawn.lua')
|
||||||
__Moose.Include('Core/SpawnStatic.lua')
|
__Moose.Include('Core/SpawnStatic.lua')
|
||||||
__Moose.Include('Core/Goal.lua')
|
__Moose.Include('Core/Goal.lua')
|
||||||
__Moose.Include('Core/Cargo.lua')
|
__Moose.Include('Core/Cargo.lua')
|
||||||
@ -50,7 +51,6 @@ __Moose.Include('Wrapper/Airbase.lua')
|
|||||||
__Moose.Include('Wrapper/Scenery.lua')
|
__Moose.Include('Wrapper/Scenery.lua')
|
||||||
__Moose.Include('Functional/Scoring.lua')
|
__Moose.Include('Functional/Scoring.lua')
|
||||||
__Moose.Include('Functional/CleanUp.lua')
|
__Moose.Include('Functional/CleanUp.lua')
|
||||||
__Moose.Include('Functional/Spawn.lua')
|
|
||||||
__Moose.Include('Functional/Movement.lua')
|
__Moose.Include('Functional/Movement.lua')
|
||||||
__Moose.Include('Functional/Sead.lua')
|
__Moose.Include('Functional/Sead.lua')
|
||||||
__Moose.Include('Functional/Escort.lua')
|
__Moose.Include('Functional/Escort.lua')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user