Merge pull request #261 from FlightControl-Master/master-scoring

Master scoring
This commit is contained in:
Sven Van de Velde 2017-03-02 17:45:14 +01:00 committed by GitHub
commit fbec9519ee
22 changed files with 268 additions and 205 deletions

Binary file not shown.

View File

@ -13,26 +13,36 @@
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
-- which can be @{Unit}, @{Static) and @{Scenery} objects.
--
-- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
-- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
-- This brings a lot of dynamism in the scoring, where players need to take care to inflict damage on the right target.
-- By default, penalties weight heavier in the scoring, to ensure that players don't commit fratricide.
-- The total score of the player is calculated by **adding the scores minus the penalties**.
--
-- The score value is calculated based on the **threat level of the player** and the **threat level of the target**.
-- The threat level of an object can be a value between 0 and 10.
-- A calculated score takes the threat level of the target divided by the threat level of the player unit.
-- This provides a value between 0.1 and 10.
-- As such, if the threat level of the target is high, and the player threat level is low, a high score will be given.
-- However, the **stronger or the higher** the threat level of the player unit, the **less score** will be given in enemy target destroys.
-- ![Banner Image](..\Presentations\SCORING\Dia4.JPG)
--
-- If multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
-- The score value is calculated based on the **threat level of the player** and the **threat level of the target**.
-- A calculated score takes the threat level of the target divided by a balanced threat level of the player unit.
-- As such, if the threat level of the target is high, and the player threat level is low, a higher score will be given than
-- if the threat level of the player would be high too.
--
-- ![Banner Image](..\Presentations\SCORING\Dia5.JPG)
--
-- When multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
-- destruction, will receive a score. This is important for targets that require significant damage before it can be destroyed, like
-- ships or heavy planes.
--
-- Optionally, the score values can be **scaled** by a **multiplier**. Specific multipliers can be set for positive cores or negative penalties.
-- ![Banner Image](..\Presentations\SCORING\Dia13.JPG)
--
-- Optionally, the score values can be **scaled** by a **scale**. Specific scales can be set for positive cores or negative penalties.
-- The default range of the scores granted is a value between 0 and 10. The default range of penalties given is a value between 0 and 30.
--
-- ![Banner Image](..\Presentations\SCORING\Dia7.JPG)
--
-- **Additional scores** can be granted to **specific objects**, when the player(s) destroy these objects.
--
-- ![Banner Image](..\Presentations\SCORING\Dia9.JPG)
--
-- **Various @{Zone}s** can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
-- This is **specifically useful** to designate **scenery targets on the map** that will generate points when destroyed.
--
@ -47,17 +57,17 @@
-- Use the radio menu F10 to consult the scores while running the mission.
-- Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission.
--
-- ## 1.1) Set the destroy score or penalty multiplier
-- ## 1.1) Set the destroy score or penalty scale
--
-- Score multipliers can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetMultiplierDestroyScore}() to set the multiplier of enemy destroys (positive destroys).
-- Use the method @{#SCORING.SetMultiplierDestroyPenalty}() to set the multiplier of friendly destroys (negative destroys).
-- Score scales can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetScaleDestroyScore}() to set the scale of enemy destroys (positive destroys).
-- Use the method @{#SCORING.SetScaleDestroyPenalty}() to set the scale of friendly destroys (negative destroys).
--
-- local Scoring = SCORING:New( "Scoring File" )
-- Scoring:SetMultiplierDestroyScore( 10 )
-- Scoring:SetMultiplierDestroyPenalty( 40 )
-- Scoring:SetScaleDestroyScore( 10 )
-- Scoring:SetScaleDestroyPenalty( 40 )
--
-- The above sets the multiplier for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The penalties will be given in a scale from 0 to 40.
--
-- ## 1.2) Define special targets that will give extra scores.
@ -99,7 +109,7 @@
--
-- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty multiplier.
-- By default, the penalty for changing coalition is the default penalty scale.
--
-- ## 1.8) Define output CSV files.
--
@ -210,9 +220,6 @@ function SCORING:New( GameName )
error( "A game name must be given to register the scoring results" )
end
-- Multipliers
self.MultiplierDestroyScore = 10
self.MultiplierDestroyPenalty = 20
-- Additional Object scores
self.ScoringObjects = {}
@ -226,12 +233,16 @@ function SCORING:New( GameName )
self:SetMessagesDestroy( true )
self:SetMessagesScore( true )
self:SetMessagesZone( true )
-- Scales
self:SetScaleDestroyScore( 10 )
self:SetScaleDestroyPenalty( 30 )
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
self:SetFratricide( self.MultiplierDestroyPenalty * 2 )
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
-- Default penalty when a player changes coalition.
self:SetCoalitionChangePenalty( self.MultiplierDestroyPenalty )
self:SetCoalitionChangePenalty( self.ScaleDestroyPenalty )
-- Event handlers
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
@ -247,27 +258,27 @@ function SCORING:New( GameName )
end
--- Set the multiplier for scoring valid destroys (enemy destroys).
-- A calculated score is a value between 0.1 and 10.
-- The multiplier magnifies the scores given to the players.
--- Set the scale for scoring valid destroys (enemy destroys).
-- A default calculated score is a value between 1 and 10.
-- The scale magnifies the scores given to the players.
-- @param #SCORING self
-- @param #number Multiplier The multiplier of the score given.
function SCORING:SetMultiplierDestroyScore( Multiplier )
-- @param #number Scale The scale of the score given.
function SCORING:SetScaleDestroyScore( Scale )
self.MultiplierDestroyScore = Multiplier
self.ScaleDestroyScore = Scale
return self
end
--- Set the multiplier for scoring penalty destroys (friendly destroys).
-- A calculated score is a value between 0.1 and 10.
-- The multiplier magnifies the scores given to the players.
--- Set the scale for scoring penalty destroys (friendly destroys).
-- A default calculated penalty is a value between 1 and 10.
-- The scale magnifies the scores given to the players.
-- @param #SCORING self
-- @param #number Multiplier The multiplier of the score given.
-- @param #number Scale The scale of the score given.
-- @return #SCORING
function SCORING:SetMultiplierDestroyPenalty( Multiplier )
function SCORING:SetScaleDestroyPenalty( Scale )
self.MultiplierDestroyPenalty = Multiplier
self.ScaleDestroyPenalty = Scale
return self
end
@ -505,7 +516,7 @@ end
--- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty multiplier.
-- By default, the penalty for changing coalition is the default penalty scale.
-- @param #SCORING self
-- @param #number CoalitionChangePenalty The amount of penalty that is given.
-- @return #SCORING
@ -571,7 +582,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 then
if self.Players[PlayerName].PenaltyWarning < 1 then
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than 150, you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
30
):ToAll()
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
@ -947,8 +958,8 @@ function SCORING:_EventOnDeadOrCrash( Event )
if TargetCoalition then
if InitCoalition == TargetCoalition then
local ThreatLevelTarget, ThreatTypeTarget = TargetDestroy.UNIT:GetThreatLevel()
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel()
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierDestroyPenalty )
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() / 10 + 1
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyPenalty / 10 )
self:E( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Penalty = Player.Penalty + ThreatPenalty
@ -978,8 +989,9 @@ function SCORING:_EventOnDeadOrCrash( Event )
else
local ThreatLevelTarget, ThreatTypeTarget = TargetDestroy.UNIT:GetThreatLevel()
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel()
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierDestroyScore )
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() / 10 + 1
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyScore / 10 )
self:E( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Score = Player.Score + ThreatScore

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170302_1226' )
env.info( 'Moose Generation Timestamp: 20170302_1741' )
local base = _G
Include = {}
@ -17872,26 +17872,36 @@ end
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
-- which can be @{Unit}, @{Static) and @{Scenery} objects.
--
-- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
-- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
-- This brings a lot of dynamism in the scoring, where players need to take care to inflict damage on the right target.
-- By default, penalties weight heavier in the scoring, to ensure that players don't commit fratricide.
-- The total score of the player is calculated by **adding the scores minus the penalties**.
--
-- The score value is calculated based on the **threat level of the player** and the **threat level of the target**.
-- The threat level of an object can be a value between 0 and 10.
-- A calculated score takes the threat level of the target divided by the threat level of the player unit.
-- This provides a value between 0.1 and 10.
-- As such, if the threat level of the target is high, and the player threat level is low, a high score will be given.
-- However, the **stronger or the higher** the threat level of the player unit, the **less score** will be given in enemy target destroys.
-- ![Banner Image](..\Presentations\SCORING\Dia4.JPG)
--
-- If multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
-- The score value is calculated based on the **threat level of the player** and the **threat level of the target**.
-- A calculated score takes the threat level of the target divided by a balanced threat level of the player unit.
-- As such, if the threat level of the target is high, and the player threat level is low, a higher score will be given than
-- if the threat level of the player would be high too.
--
-- ![Banner Image](..\Presentations\SCORING\Dia5.JPG)
--
-- When multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
-- destruction, will receive a score. This is important for targets that require significant damage before it can be destroyed, like
-- ships or heavy planes.
--
-- Optionally, the score values can be **scaled** by a **multiplier**. Specific multipliers can be set for positive cores or negative penalties.
-- ![Banner Image](..\Presentations\SCORING\Dia13.JPG)
--
-- Optionally, the score values can be **scaled** by a **scale**. Specific scales can be set for positive cores or negative penalties.
-- The default range of the scores granted is a value between 0 and 10. The default range of penalties given is a value between 0 and 30.
--
-- ![Banner Image](..\Presentations\SCORING\Dia7.JPG)
--
-- **Additional scores** can be granted to **specific objects**, when the player(s) destroy these objects.
--
-- ![Banner Image](..\Presentations\SCORING\Dia9.JPG)
--
-- **Various @{Zone}s** can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
-- This is **specifically useful** to designate **scenery targets on the map** that will generate points when destroyed.
--
@ -17906,17 +17916,17 @@ end
-- Use the radio menu F10 to consult the scores while running the mission.
-- Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission.
--
-- ## 1.1) Set the destroy score or penalty multiplier
-- ## 1.1) Set the destroy score or penalty scale
--
-- Score multipliers can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetMultiplierDestroyScore}() to set the multiplier of enemy destroys (positive destroys).
-- Use the method @{#SCORING.SetMultiplierDestroyPenalty}() to set the multiplier of friendly destroys (negative destroys).
-- Score scales can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetScaleDestroyScore}() to set the scale of enemy destroys (positive destroys).
-- Use the method @{#SCORING.SetScaleDestroyPenalty}() to set the scale of friendly destroys (negative destroys).
--
-- local Scoring = SCORING:New( "Scoring File" )
-- Scoring:SetMultiplierDestroyScore( 10 )
-- Scoring:SetMultiplierDestroyPenalty( 40 )
-- Scoring:SetScaleDestroyScore( 10 )
-- Scoring:SetScaleDestroyPenalty( 40 )
--
-- The above sets the multiplier for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The penalties will be given in a scale from 0 to 40.
--
-- ## 1.2) Define special targets that will give extra scores.
@ -17958,7 +17968,7 @@ end
--
-- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty multiplier.
-- By default, the penalty for changing coalition is the default penalty scale.
--
-- ## 1.8) Define output CSV files.
--
@ -18069,9 +18079,6 @@ function SCORING:New( GameName )
error( "A game name must be given to register the scoring results" )
end
-- Multipliers
self.MultiplierDestroyScore = 10
self.MultiplierDestroyPenalty = 20
-- Additional Object scores
self.ScoringObjects = {}
@ -18085,12 +18092,16 @@ function SCORING:New( GameName )
self:SetMessagesDestroy( true )
self:SetMessagesScore( true )
self:SetMessagesZone( true )
-- Scales
self:SetScaleDestroyScore( 10 )
self:SetScaleDestroyPenalty( 30 )
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
self:SetFratricide( self.MultiplierDestroyPenalty * 2 )
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
-- Default penalty when a player changes coalition.
self:SetCoalitionChangePenalty( self.MultiplierDestroyPenalty )
self:SetCoalitionChangePenalty( self.ScaleDestroyPenalty )
-- Event handlers
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
@ -18106,27 +18117,27 @@ function SCORING:New( GameName )
end
--- Set the multiplier for scoring valid destroys (enemy destroys).
-- A calculated score is a value between 0.1 and 10.
-- The multiplier magnifies the scores given to the players.
--- Set the scale for scoring valid destroys (enemy destroys).
-- A default calculated score is a value between 1 and 10.
-- The scale magnifies the scores given to the players.
-- @param #SCORING self
-- @param #number Multiplier The multiplier of the score given.
function SCORING:SetMultiplierDestroyScore( Multiplier )
-- @param #number Scale The scale of the score given.
function SCORING:SetScaleDestroyScore( Scale )
self.MultiplierDestroyScore = Multiplier
self.ScaleDestroyScore = Scale
return self
end
--- Set the multiplier for scoring penalty destroys (friendly destroys).
-- A calculated score is a value between 0.1 and 10.
-- The multiplier magnifies the scores given to the players.
--- Set the scale for scoring penalty destroys (friendly destroys).
-- A default calculated penalty is a value between 1 and 10.
-- The scale magnifies the scores given to the players.
-- @param #SCORING self
-- @param #number Multiplier The multiplier of the score given.
-- @param #number Scale The scale of the score given.
-- @return #SCORING
function SCORING:SetMultiplierDestroyPenalty( Multiplier )
function SCORING:SetScaleDestroyPenalty( Scale )
self.MultiplierDestroyPenalty = Multiplier
self.ScaleDestroyPenalty = Scale
return self
end
@ -18364,7 +18375,7 @@ end
--- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty multiplier.
-- By default, the penalty for changing coalition is the default penalty scale.
-- @param #SCORING self
-- @param #number CoalitionChangePenalty The amount of penalty that is given.
-- @return #SCORING
@ -18430,7 +18441,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 then
if self.Players[PlayerName].PenaltyWarning < 1 then
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than 150, you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
30
):ToAll()
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
@ -18806,8 +18817,8 @@ function SCORING:_EventOnDeadOrCrash( Event )
if TargetCoalition then
if InitCoalition == TargetCoalition then
local ThreatLevelTarget, ThreatTypeTarget = TargetDestroy.UNIT:GetThreatLevel()
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel()
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierDestroyPenalty )
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() / 10 + 1
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyPenalty / 10 )
self:E( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Penalty = Player.Penalty + ThreatPenalty
@ -18837,8 +18848,9 @@ function SCORING:_EventOnDeadOrCrash( Event )
else
local ThreatLevelTarget, ThreatTypeTarget = TargetDestroy.UNIT:GetThreatLevel()
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel()
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierDestroyScore )
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() / 10 + 1
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyScore / 10 )
self:E( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Score = Player.Score + ThreatScore

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170302_1226' )
env.info( 'Moose Generation Timestamp: 20170302_1741' )
local base = _G
Include = {}
@ -17872,26 +17872,36 @@ end
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
-- which can be @{Unit}, @{Static) and @{Scenery} objects.
--
-- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
-- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
-- This brings a lot of dynamism in the scoring, where players need to take care to inflict damage on the right target.
-- By default, penalties weight heavier in the scoring, to ensure that players don't commit fratricide.
-- The total score of the player is calculated by **adding the scores minus the penalties**.
--
-- The score value is calculated based on the **threat level of the player** and the **threat level of the target**.
-- The threat level of an object can be a value between 0 and 10.
-- A calculated score takes the threat level of the target divided by the threat level of the player unit.
-- This provides a value between 0.1 and 10.
-- As such, if the threat level of the target is high, and the player threat level is low, a high score will be given.
-- However, the **stronger or the higher** the threat level of the player unit, the **less score** will be given in enemy target destroys.
-- ![Banner Image](..\Presentations\SCORING\Dia4.JPG)
--
-- If multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
-- The score value is calculated based on the **threat level of the player** and the **threat level of the target**.
-- A calculated score takes the threat level of the target divided by a balanced threat level of the player unit.
-- As such, if the threat level of the target is high, and the player threat level is low, a higher score will be given than
-- if the threat level of the player would be high too.
--
-- ![Banner Image](..\Presentations\SCORING\Dia5.JPG)
--
-- When multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
-- destruction, will receive a score. This is important for targets that require significant damage before it can be destroyed, like
-- ships or heavy planes.
--
-- Optionally, the score values can be **scaled** by a **multiplier**. Specific multipliers can be set for positive cores or negative penalties.
-- ![Banner Image](..\Presentations\SCORING\Dia13.JPG)
--
-- Optionally, the score values can be **scaled** by a **scale**. Specific scales can be set for positive cores or negative penalties.
-- The default range of the scores granted is a value between 0 and 10. The default range of penalties given is a value between 0 and 30.
--
-- ![Banner Image](..\Presentations\SCORING\Dia7.JPG)
--
-- **Additional scores** can be granted to **specific objects**, when the player(s) destroy these objects.
--
-- ![Banner Image](..\Presentations\SCORING\Dia9.JPG)
--
-- **Various @{Zone}s** can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
-- This is **specifically useful** to designate **scenery targets on the map** that will generate points when destroyed.
--
@ -17906,17 +17916,17 @@ end
-- Use the radio menu F10 to consult the scores while running the mission.
-- Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission.
--
-- ## 1.1) Set the destroy score or penalty multiplier
-- ## 1.1) Set the destroy score or penalty scale
--
-- Score multipliers can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetMultiplierDestroyScore}() to set the multiplier of enemy destroys (positive destroys).
-- Use the method @{#SCORING.SetMultiplierDestroyPenalty}() to set the multiplier of friendly destroys (negative destroys).
-- Score scales can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetScaleDestroyScore}() to set the scale of enemy destroys (positive destroys).
-- Use the method @{#SCORING.SetScaleDestroyPenalty}() to set the scale of friendly destroys (negative destroys).
--
-- local Scoring = SCORING:New( "Scoring File" )
-- Scoring:SetMultiplierDestroyScore( 10 )
-- Scoring:SetMultiplierDestroyPenalty( 40 )
-- Scoring:SetScaleDestroyScore( 10 )
-- Scoring:SetScaleDestroyPenalty( 40 )
--
-- The above sets the multiplier for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The penalties will be given in a scale from 0 to 40.
--
-- ## 1.2) Define special targets that will give extra scores.
@ -17958,7 +17968,7 @@ end
--
-- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty multiplier.
-- By default, the penalty for changing coalition is the default penalty scale.
--
-- ## 1.8) Define output CSV files.
--
@ -18069,9 +18079,6 @@ function SCORING:New( GameName )
error( "A game name must be given to register the scoring results" )
end
-- Multipliers
self.MultiplierDestroyScore = 10
self.MultiplierDestroyPenalty = 20
-- Additional Object scores
self.ScoringObjects = {}
@ -18085,12 +18092,16 @@ function SCORING:New( GameName )
self:SetMessagesDestroy( true )
self:SetMessagesScore( true )
self:SetMessagesZone( true )
-- Scales
self:SetScaleDestroyScore( 10 )
self:SetScaleDestroyPenalty( 30 )
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
self:SetFratricide( self.MultiplierDestroyPenalty * 2 )
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
-- Default penalty when a player changes coalition.
self:SetCoalitionChangePenalty( self.MultiplierDestroyPenalty )
self:SetCoalitionChangePenalty( self.ScaleDestroyPenalty )
-- Event handlers
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
@ -18106,27 +18117,27 @@ function SCORING:New( GameName )
end
--- Set the multiplier for scoring valid destroys (enemy destroys).
-- A calculated score is a value between 0.1 and 10.
-- The multiplier magnifies the scores given to the players.
--- Set the scale for scoring valid destroys (enemy destroys).
-- A default calculated score is a value between 1 and 10.
-- The scale magnifies the scores given to the players.
-- @param #SCORING self
-- @param #number Multiplier The multiplier of the score given.
function SCORING:SetMultiplierDestroyScore( Multiplier )
-- @param #number Scale The scale of the score given.
function SCORING:SetScaleDestroyScore( Scale )
self.MultiplierDestroyScore = Multiplier
self.ScaleDestroyScore = Scale
return self
end
--- Set the multiplier for scoring penalty destroys (friendly destroys).
-- A calculated score is a value between 0.1 and 10.
-- The multiplier magnifies the scores given to the players.
--- Set the scale for scoring penalty destroys (friendly destroys).
-- A default calculated penalty is a value between 1 and 10.
-- The scale magnifies the scores given to the players.
-- @param #SCORING self
-- @param #number Multiplier The multiplier of the score given.
-- @param #number Scale The scale of the score given.
-- @return #SCORING
function SCORING:SetMultiplierDestroyPenalty( Multiplier )
function SCORING:SetScaleDestroyPenalty( Scale )
self.MultiplierDestroyPenalty = Multiplier
self.ScaleDestroyPenalty = Scale
return self
end
@ -18364,7 +18375,7 @@ end
--- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty multiplier.
-- By default, the penalty for changing coalition is the default penalty scale.
-- @param #SCORING self
-- @param #number CoalitionChangePenalty The amount of penalty that is given.
-- @return #SCORING
@ -18430,7 +18441,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 then
if self.Players[PlayerName].PenaltyWarning < 1 then
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than 150, you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
30
):ToAll()
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
@ -18806,8 +18817,8 @@ function SCORING:_EventOnDeadOrCrash( Event )
if TargetCoalition then
if InitCoalition == TargetCoalition then
local ThreatLevelTarget, ThreatTypeTarget = TargetDestroy.UNIT:GetThreatLevel()
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel()
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierDestroyPenalty )
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() / 10 + 1
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyPenalty / 10 )
self:E( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Penalty = Player.Penalty + ThreatPenalty
@ -18837,8 +18848,9 @@ function SCORING:_EventOnDeadOrCrash( Event )
else
local ThreatLevelTarget, ThreatTypeTarget = TargetDestroy.UNIT:GetThreatLevel()
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel()
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierDestroyScore )
local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() / 10 + 1
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyScore / 10 )
self:E( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Score = Player.Score + ThreatScore

Binary file not shown.

View File

@ -2425,6 +2425,7 @@ The UNIT carrying the package.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(AI_CARGO_UNIT).CargoCarrier" >
<strong>AI_CARGO_UNIT.CargoCarrier</strong>
</a>

View File

@ -82,16 +82,48 @@ and create a CSV file logging the scoring events for use at team or squadron web
<h1>1) <a href="Scoring.html##(SCORING)">Scoring#SCORING</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The <a href="##(SCORING)">#SCORING</a> class administers the scoring of player achievements,
and creates a CSV file logging the scoring events for use at team or squadron websites.</p>
and creates a CSV file logging the scoring events and results for use at team or squadron websites.</p>
<p>The scores are calculated by scoring the hits and destroys of objects that players make,
which are <a href="Unit.html">Unit</a> and <a href="Static.html">Static</a>s** can be defined for which scores are also granted when objects in that <a href="Zone.html">Zone</a> are destroyed.
<p>SCORING automatically calculates the threat level of the objects hit and destroyed by players,
which can be <a href="Unit.html">Unit</a>, <a href="Static.html">Static</a> objects.</p>
<p>Positive score points are granted when enemy or neutral targets are destroyed.
Negative score points or penalties are given when a friendly target is hit or destroyed.
This brings a lot of dynamism in the scoring, where players need to take care to inflict damage on the right target.
By default, penalties weight heavier in the scoring, to ensure that players don't commit fratricide.
The total score of the player is calculated by <strong>adding the scores minus the penalties</strong>.</p>
<p><img src="..\Presentations\SCORING\Dia4.JPG" alt="Banner Image"/></p>
<p>The score value is calculated based on the <strong>threat level of the player</strong> and the <strong>threat level of the target</strong>.
A calculated score takes the threat level of the target divided by a balanced threat level of the player unit. <br/>
As such, if the threat level of the target is high, and the player threat level is low, a higher score will be given than
if the threat level of the player would be high too.</p>
<p><img src="..\Presentations\SCORING\Dia5.JPG" alt="Banner Image"/></p>
<p>When multiple players hit the same target, and finally succeed in destroying the target, then each player who contributed to the target
destruction, will receive a score. This is important for targets that require significant damage before it can be destroyed, like
ships or heavy planes.</p>
<p><img src="..\Presentations\SCORING\Dia13.JPG" alt="Banner Image"/></p>
<p>Optionally, the score values can be <strong>scaled</strong> by a <strong>scale</strong>. Specific scales can be set for positive cores or negative penalties.
The default range of the scores granted is a value between 0 and 10. The default range of penalties given is a value between 0 and 30.</p>
<p><img src="..\Presentations\SCORING\Dia7.JPG" alt="Banner Image"/></p>
<p><strong>Additional scores</strong> can be granted to <strong>specific objects</strong>, when the player(s) destroy these objects.</p>
<p><img src="..\Presentations\SCORING\Dia9.JPG" alt="Banner Image"/></p>
<p>**Various <a href="Zone.html">Zone</a>s** can be defined for which scores are also granted when objects in that <a href="Zone.html">Zone</a> are destroyed.
This is <strong>specifically useful</strong> to designate <strong>scenery targets on the map</strong> that will generate points when destroyed.</p>
<p>With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file. <br/>
The CSV files can be used to:</p>
<p>With a small change in MissionScripting.lua, the scoring results can also be logged in a <strong>CSV file</strong>. <br/>
These CSV files can be used to:</p>
<ul>
<li>Upload scoring to a database or a BI tool to publish the scoring results to the player community.</li>
@ -99,22 +131,22 @@ The CSV files can be used to:</p>
<li>Share scoring amoung players after the mission to discuss mission results.</li>
</ul>
<p>Scores can be reported. Menu options are automatically added to each group when a player joins a client slot or a CA unit.
<p>Scores can be <strong>reported</strong>. <strong>Menu options</strong> are automatically added to <strong>each player group</strong> when a player joins a client slot or a CA unit.
Use the radio menu F10 to consult the scores while running the mission.
Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission.</p>
<h2>1.1) Set the destroy score or penalty multiplier</h2>
<h2>1.1) Set the destroy score or penalty scale</h2>
<p>Score multipliers can be set for scores granted when enemies or friendlies are destroyed.
Use the method <a href="##(SCORING).SetMultiplierDestroyScore">SCORING.SetMultiplierDestroyScore</a>() to set the multiplier of enemy destroys (positive destroys).
Use the method <a href="##(SCORING).SetMultiplierDestroyPenalty">SCORING.SetMultiplierDestroyPenalty</a>() to set the multiplier of friendly destroys (negative destroys).</p>
<p>Score scales can be set for scores granted when enemies or friendlies are destroyed.
Use the method <a href="##(SCORING).SetScaleDestroyScore">SCORING.SetScaleDestroyScore</a>() to set the scale of enemy destroys (positive destroys).
Use the method <a href="##(SCORING).SetScaleDestroyPenalty">SCORING.SetScaleDestroyPenalty</a>() to set the scale of friendly destroys (negative destroys).</p>
<pre><code> local Scoring = SCORING:New( "Scoring File" )
Scoring:SetMultiplierDestroyScore( 10 )
Scoring:SetMultiplierDestroyPenalty( 40 )
Scoring:SetScaleDestroyScore( 10 )
Scoring:SetScaleDestroyPenalty( 40 )
</code></pre>
<p>The above sets the multiplier for valid scores to 10. So scores will be given in a scale from 0 to 10.
<p>The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10.
The penalties will be given in a scale from 0 to 40.</p>
<h2>1.2) Define special targets that will give extra scores.</h2>
@ -158,7 +190,7 @@ By default, the fratricide level is the default penalty mutiplier * 2 for the pe
<p>When a player changes the coalition, he can receive a penalty score.
Use the method <a href="##(SCORING).SetCoalitionChangePenalty">SCORING.SetCoalitionChangePenalty</a>() to define the penalty when a player changes coalition.
By default, the penalty for changing coalition is the default penalty multiplier. </p>
By default, the penalty for changing coalition is the default penalty scale. </p>
<h2>1.8) Define output CSV files.</h2>
@ -390,18 +422,6 @@ Various methods exist to configure:</p>
<td class="name" nowrap="nowrap"><a href="##(SCORING).MessagesZone">SCORING.MessagesZone</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).MultiplierDestroyPenalty">SCORING.MultiplierDestroyPenalty</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).MultiplierDestroyScore">SCORING.MultiplierDestroyScore</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -498,6 +518,18 @@ Various methods exist to configure:</p>
<td class="name" nowrap="nowrap"><a href="##(SCORING).RunTime">SCORING.RunTime</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).ScaleDestroyPenalty">SCORING.ScaleDestroyPenalty</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).ScaleDestroyScore">SCORING.ScaleDestroyScore</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -579,15 +611,15 @@ Various methods exist to configure:</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).SetMultiplierDestroyPenalty">SCORING:SetMultiplierDestroyPenalty(Multiplier)</a></td>
<td class="name" nowrap="nowrap"><a href="##(SCORING).SetScaleDestroyPenalty">SCORING:SetScaleDestroyPenalty(Scale)</a></td>
<td class="summary">
<p>Set the multiplier for scoring penalty destroys (friendly destroys).</p>
<p>Set the scale for scoring penalty destroys (friendly destroys).</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).SetMultiplierDestroyScore">SCORING:SetMultiplierDestroyScore(Multiplier)</a></td>
<td class="name" nowrap="nowrap"><a href="##(SCORING).SetScaleDestroyScore">SCORING:SetScaleDestroyScore(Scale)</a></td>
<td class="summary">
<p>Set the multiplier for scoring valid destroys (enemy destroys).</p>
<p>Set the scale for scoring valid destroys (enemy destroys).</p>
</td>
</tr>
<tr>
@ -1090,37 +1122,6 @@ The Score value.</p>
</dd>
</dl>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(SCORING).MultiplierDestroyPenalty" >
<strong>SCORING.MultiplierDestroyPenalty</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(SCORING).MultiplierDestroyScore" >
<strong>SCORING.MultiplierDestroyScore</strong>
</a>
</dt>
<dd>
<p> Multipliers</p>
</dd>
</dl>
<dl class="function">
@ -1512,6 +1513,34 @@ The player group.</p>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SCORING).ScaleDestroyPenalty" >
<strong>SCORING.ScaleDestroyPenalty</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SCORING).ScaleDestroyScore" >
<strong>SCORING.ScaleDestroyScore</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
@ -1689,7 +1718,7 @@ self</p>
<p>Use the method <a href="##(SCORING).SetCoalitionChangePenalty">SCORING.SetCoalitionChangePenalty</a>() to define the penalty when a player changes coalition.
By default, the penalty for changing coalition is the default penalty multiplier. </p>
By default, the penalty for changing coalition is the default penalty scale. </p>
<h3>Parameter</h3>
<ul>
@ -1885,24 +1914,24 @@ If true is given, the messages are sent. </p>
<dl class="function">
<dt>
<a id="#(SCORING).SetMultiplierDestroyPenalty" >
<strong>SCORING:SetMultiplierDestroyPenalty(Multiplier)</strong>
<a id="#(SCORING).SetScaleDestroyPenalty" >
<strong>SCORING:SetScaleDestroyPenalty(Scale)</strong>
</a>
</dt>
<dd>
<p>Set the multiplier for scoring penalty destroys (friendly destroys).</p>
<p>Set the scale for scoring penalty destroys (friendly destroys).</p>
<p>A calculated score is a value between 0.1 and 10.
The multiplier magnifies the scores given to the players.</p>
<p>A default calculated penalty is a value between 1 and 10.
The scale magnifies the scores given to the players.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#number Multiplier </em></code>:
The multiplier of the score given.</p>
<p><code><em>#number Scale </em></code>:
The scale of the score given.</p>
</li>
</ul>
@ -1916,24 +1945,24 @@ The multiplier of the score given.</p>
<dl class="function">
<dt>
<a id="#(SCORING).SetMultiplierDestroyScore" >
<strong>SCORING:SetMultiplierDestroyScore(Multiplier)</strong>
<a id="#(SCORING).SetScaleDestroyScore" >
<strong>SCORING:SetScaleDestroyScore(Scale)</strong>
</a>
</dt>
<dd>
<p>Set the multiplier for scoring valid destroys (enemy destroys).</p>
<p>Set the scale for scoring valid destroys (enemy destroys).</p>
<p>A calculated score is a value between 0.1 and 10.
The multiplier magnifies the scores given to the players.</p>
<p>A default calculated score is a value between 1 and 10.
The scale magnifies the scores given to the players.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#number Multiplier </em></code>:
The multiplier of the score given.</p>
<p><code><em>#number Scale </em></code>:
The scale of the score given.</p>
</li>
</ul>

View File

@ -1765,9 +1765,6 @@ The group that was spawned. You can use this group for further actions.</p>
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
</dd>
</dl>
<dl class="function">

View File

@ -351,7 +351,7 @@ and create a CSV file logging the scoring events for use at team or squadron web
<h1>1) <a href="Scoring.html##(SCORING)">Scoring#SCORING</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The <a href="##(SCORING)">#SCORING</a> class administers the scoring of player achievements,
and creates a CSV file logging the scoring events for use at team or squadron websites.</p>
and creates a CSV file logging the scoring events and results for use at team or squadron websites.</p>
</td>
</tr>
<tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB