Crash Test Scoring
Reference for `gameplay_crashTest_crashTestScoring`, which calculates and aggregates scores for crash test mission steps based on time, speed, damage, and impact location accuracy.
Reference for gameplay_crashTest_crashTestScoring, which calculates and aggregates scores for crash test mission steps based on time, speed, damage, and impact location accuracy.
Overview
Each crash test step can be scored on multiple criteria. This extension computes individual scores per step and provides a total score across all steps. Depends on gameplay_util_damageAssessment.
Exports
| Function | Signature | Description |
|------
| M.dependencies | table | { |----|-----------|-------------|
| calculateStepScore | (stepData, stepCrashData) | Calculate all score components for a completed step |
| getTotalScoreData | () | Get cumulative score data across all steps |
| getStepScoreData | (stepIndex) | Get score data for a specific step |
| calculateIndividualDamageScore | (damageGoal, damageCondition, vehId) | Score a single vehicle's damage against the goal |
| calculateDamageLocationScore | (damageLocationGoal, damageLocationData) | Score impact location accuracy |
| reset | () | Clear all stored scoring data |
Score Parameters
| Parameter | Max Score | Description |
|---|---|---|
maxDamageLocationScore | 1000 | Impact at the correct vehicle location |
maxTimeScore | 1000 | Hitting within the time goal |
minTimeScore | 500 | Minimum time score (within 30% over goal) |
maxSpeedScore | 1000 | Matching the target impact speed |
maxSpeedOffset | 3 kph | Speed difference beyond which score is 0 |
sameStepDamageScore | 1000 | Damage matches the goal exactly |
oneStepDifferentDamageScore | 500 | Damage is one severity step off |
twoStepsDifferentDamageScore | 200 | Damage is two severity steps off |
succesfullyCrashedTargetInZoneScore | 1000 | Target crashed in the designated zone |
How It Works
- When a step completes successfully,
calculateStepScore()is called - It computes applicable scores: time, speed, damage assessment, impact location
- Scores are stored per step in
scoringDataPerStep getTotalScoreData()sums all step scores into atotalScorefield
Damage Severity Levels
| Level | ID |
|---|---|
| Minor | 1 |
| Moderate | 2 |
| A lot | 3 |
Damage conditions can be "At least" or "No more than", and scoring is based on how close the actual severity is to the goal.
-- After a step completes successfully
gameplay_crashTest_crashTestScoring.calculateStepScore(stepData, crashData[stepIndex])
-- Get final results
local totalData = gameplay_crashTest_crashTestScoring.getTotalScoreData()
print("Total Score: " .. totalData.totalScore)Key Behaviors
- Speed scores use
linearScaleto interpolate between max and 0 based on offset - Time scores give full marks if under goal, scale down to
minTimeScorewithin 30% overshoot - Damage location score is proportional: damage at target location / total damage
- The
"Crash target vehicle into target area"objective skips time and speed scoring
Module Variables
| Variable | Type | Description |
|---|---|---|
M.dependencies | table | { |
M.calculateDamageLocationScore | (damageLocationGoal, damageLocationData) | - |
M.calculateIndividualDamageScore | (damageGoal, damageCondition, vehId) | - |
M.calculateStepScore | (stepData, stepCrashData) | - |
M.getStepScoreData | (stepIndex) | - |
M.getTotalScoreData | () | - |
M.reset | () | - |
See Also
- crashTestBoundaries - Crash Test Boundary Checking - Related reference
- crashTestCountdown - Crash Test Countdown Timer - Related reference
- crashTestTaskList - Crash Test UI Task List - Related reference
- Gameplay Systems Guide - Guide
Crash Test Countdown
Reference for `gameplay_crashTest_crashTestCountdown`, a simple countdown timer that displays a visual countdown and plays audio cues before a crash test step begins.
Crash Test Task List
Reference for `gameplay_crashTest_crashTestTaskList`, which manages the in-game task list UI for crash test missions, showing step objectives and their completion status.