SCO-500 Demo Mission for SCORING system demonstration on a MP server

This commit is contained in:
FlightControl 2017-03-05 14:37:18 +01:00
parent a6c596f724
commit 2cf27b3b0f
4 changed files with 141 additions and 2 deletions

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170305_1422' )
env.info( 'Moose Generation Timestamp: 20170305_1434' )
local base = _G
Include = {}

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170305_1422' )
env.info( 'Moose Generation Timestamp: 20170305_1434' )
local base = _G
Include = {}

View File

@ -0,0 +1,139 @@
---
-- Name: SCO-500 - Scoring Multi Player Demo Mission 1
-- Author: Pikey and FlightControl
-- Date Created: 1 Mar 2017
--
-- # Situation:
--
-- A demo mission for the scoring. Read the briefing and have fun.
--
-- # Test cases:
--
-- 1. Observe the scoring granted to your flight when you hit and kill targets.
-- Define the patrol zones
local BlueCapZone = ZONE_POLYGON:New( "BlueCapZone", GROUP:FindByName( "Blue CAP Zone Patrol" ) )
local RedCapZone = ZONE_POLYGON:New( "RedCapZone", GROUP:FindByName( "Red CAP Zone Patrol" ) )
-- Define the engage zones
local BlueEngageZone = ZONE_POLYGON:New( "BlueEngageZone", GROUP:FindByName( "Blue CAP Zone Engage" ) )
local RedEngageZone = ZONE_POLYGON:New( "RedEngageZone", GROUP:FindByName( "Red CAP Zone Engage" ) )
-- Define the Spawn zones for ground vehicles
local BlueSpawnGroundZone = ZONE_POLYGON:New( "BlueSpawnGroundZone", GROUP:FindByName( "Blue Spawn Zone" ) )
--local RedSpawnGroundZone = ZONE_POLYGON:New( "RedSpawnGroundZone", GROUP:FindByName( "Red Spawn Zone" ) )
local RedSpawnGroundZone = ZONE:New( "Red Spawn Zone" )
-- Define the Scoring zones that define the shelters
local BlueShelterZone = ZONE_POLYGON:New( "Blue Shelters", GROUP:FindByName( "Blue Shelters" ) )
local RedShelterZone = ZONE_POLYGON:New( "Red Shelters", GROUP:FindByName( "Red Shelters" ) )
-- Define the Set of Clients that are used for the AI Balancers
local BluePlanesClientSet = SET_CLIENT:New():FilterCoalitions( "blue" ):FilterCategories( "plane" ):FilterPrefixes( "Blue Player")
local RedPlanesClientSet = SET_CLIENT:New():FilterCoalitions( "red" ):FilterCategories( "plane" ):FilterPrefixes( "Red Player")
-- Define the Spawn objects for the AI planes
local BluePlanesSpawn = SPAWN:New( "BlueAICAP" ):InitCleanUp( 120 ):InitLimit( 5, 0 )
local RedPlanesSpawn = SPAWN:New( "RedAICAP" ):InitCleanUp( 120 ):InitLimit( 5, 0 )
-- Define the AI Balancers for the planes
local BlueAIB = AI_BALANCER:New( BluePlanesClientSet, BluePlanesSpawn ):InitSpawnInterval( 60, 1200 )
local RedAIB = AI_BALANCER:New( RedPlanesClientSet, RedPlanesSpawn ):InitSpawnInterval( 60, 1200 )
-- Define the Spawn objects for the airbase defenses
local BlueAirbaseDefense1Spawn = SPAWN:New( "Blue Airbase Defense 1" ):InitLimit( 10, 10 ):SpawnScheduled( 60, 0 )
local BlueAirbaseDefense2Spawn = SPAWN:New( "Blue Airbase Defense 2" ):InitLimit( 2, 10 ):SpawnScheduled( 60, 0 )
local RedAirbaseDefense1Spawn = SPAWN:New( "Red Airbase Defense 1" ):InitLimit( 10, 10 ):SpawnScheduled( 60, 0 )
local RedAirbaseDefense2Spawn = SPAWN:New( "Red Airbase Defense 2" ):InitLimit( 2, 10 ):SpawnScheduled( 60, 0 )
-- Define the ground forces spawning engines...
-- First define the template arrays.
local BlueGroundTemplates = { "Blue Ground Forces 1", "Blue Ground Forces 2", "Blue Ground Forces 3" }
local RedGroundTemplates = { "Red Ground Forces 2", "Red Ground Forces 2", "Red Ground Forces 3" }
-- New we are using these templates to define the spawn objects for the ground forces.
-- We spawn them at random places into the define zone.
local BlueGroundSpawn = SPAWN
:New( "Blue Ground Forces" )
:InitLimit( 12, 30 )
:InitRandomizeZones( { BlueSpawnGroundZone } )
:InitRandomizeTemplate( BlueGroundTemplates )
:SpawnScheduled( 60, 0.2 )
local RedGroundSpawn = SPAWN
:New( "Red Ground Forces" )
:InitLimit( 12, 30 )
:InitRandomizeTemplate( RedGroundTemplates )
:InitRandomizeZones( { RedSpawnGroundZone } )
:SpawnScheduled( 60, 0.2 )
local BlueCap = {}
local RedCap = {}
-- Define the OnAfterSpawned events of the AI balancer Spawn Groups
function BlueAIB:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
if AIGroup then
BlueCap[AIGroup] = BlueCap[AIGroup] or AI_CAP_ZONE:New( BlueCapZone, 500, 3000, 450, 1200 )
local Cap = BlueCap[AIGroup] -- AI.AI_CAP#AI_CAP_ZONE
Cap:ManageFuel( 0.4, 180 )
Cap:SetEngageZone( BlueEngageZone )
Cap:SetControllable( AIGroup )
Cap:Start()
end
end
function RedAIB:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
if AIGroup then
RedCap[AIGroup] = RedCap[AIGroup] or AI_CAP_ZONE:New( RedCapZone, 500, 3000, 450, 1200 )
local Cap = RedCap[AIGroup] -- AI.AI_CAP#AI_CAP_ZONE
Cap:ManageFuel( 0.4, 180 )
Cap:SetEngageZone( BlueEngageZone )
Cap:SetControllable( AIGroup )
Cap:Start()
end
end
-- Okay, now that we defined all this stuff, now make the SCORING setup ...
-- First define a Scoring object
local Scoring = SCORING:New( "SCO-500 - Scoring Demonstration Mission" )
-- Define within the scoring the shelter designated targets.
Scoring:AddZoneScore( BlueShelterZone, 50 ) -- Per shelter destroyed, 50 extra points are granted.
Scoring:AddZoneScore( RedShelterZone, 50 ) -- Per shelter destroyed, 50 extra points are granted.
-- Define the static objects that give extra scores
Scoring:AddStaticScore( STATIC:FindByName( "Red Factory 1"), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Factory 2"), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Factory 3"), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Factory 4"), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Truck #001"), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Truck #002"), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Truck #003"), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Red Truck #004"), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Factory 1" ), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Factory 2" ), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Factory 3" ), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Factory 4" ), 100 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Truck #001" ), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Truck #002" ), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Truck #003" ), 80 )
Scoring:AddStaticScore( STATIC:FindByName( "Blue Truck #004" ), 80 )
-- Scale the scoring rewarded.
Scoring:SetScaleDestroyScore( 30 )
Scoring:SetScaleDestroyPenalty( 90 ) -- Penalties are punished more than normal destroys.