Drift Scoreboard
Reference for `gameplay_drift_scoreboard`, which accumulates detailed performance statistics during formal drift challenges for end-screen display.
Reference for gameplay_drift_scoreboard, which accumulates detailed performance statistics during formal drift challenges for end-screen display.
Overview
Tracks per-tier score breakdowns, quick message counts, and raw performance metrics (average speed, angle, distance, combo, etc.) during a challenge. Provides formatted data for the challenge results screen.
Exports
| Function | Signature | Description |
|---|---|---|
onUpdate | () | Debug display, first-frame init |
reset | () | Clear all stats and repopulate tier/message names |
onDriftCompletedScored | (data) | Attribute chain score to tier, confirm quick messages |
onDriftActiveDataFinished | (data) | Accumulate single-drift raw stats |
onDriftQuickMessageReached | (data) | Queue quick message for tier attribution |
onDriftCrash / onDriftSpinout | () | Discard unconfirmed quick messages |
getPerformanceStats | () → table | Formatted performance statistics |
getTiersStats | () → table | Per-tier score and count |
getDriftEventStats | () → table | Quick message counts and totals |
getDriftDebugInfo | () → table | Debug toggle |
M.getDriftDebugInfo | () | - |
M.getDriftEventStats | () | - |
M.getPerformanceStats | () | - |
M.getTiersStats | () | - |
M.onDriftActiveDataFinished | (data) | - |
M.onDriftCompletedScored | (data) | - |
M.onDriftCrash | () | - |
M.onDriftQuickMessageReached | (data) | - |
M.onDriftSpinout | () | - |
M.onUpdate | () | - |
M.reset | () | - |
Performance Stats Output
local stats = gameplay_drift_scoreboard.getPerformanceStats()
-- Returns ordered table:
-- {
-- avrgDriftPerformanceFactor = {order=1, value="0.750", name="..."},
-- avrgDriftSpeed = {order=2, value="85 km/h", name="..."},
-- avrgDriftAngle = {order=3, value="42 °", name="..."},
-- maxDriftAngle = {order=4, value="95 °", name="..."},
-- maxDriftCombo = {order=5, value=12, name="..."},
-- totalDriftDist = {order=6, value="450 m", name="..."},
-- totalIndividualDrifts = {order=7, value=8, name="..."},
-- totalDriftDuration = {order=8, value="1 minute 23 seconds", name="..."},
-- }Tier Stats
local tiers = gameplay_drift_scoreboard.getTiersStats()
-- {
-- drift = {totalScore=200, count=5, name="Drift", order=1},
-- greatDrift = {totalScore=800, count=3, name="Great Drift", order=2},
-- ...
-- }How It Works
-- When a drift chain completes and is scored:
-- 1. Quick messages queued during that chain are confirmed
-- 2. Quick message scores (× combo) are subtracted from tier attribution
-- 3. Remaining score attributed to current tier
-- 4. Max combo updated
-- When individual drift ends:
-- 1. Speed, angle, performance factor averages updated
-- 2. Total drift count, duration, distance accumulatedQuick Message Attribution
-- Quick messages are queued in quickMessagesToBeConfirmed during a drift chain
-- On onDriftCompletedScored, they're multiplied by the chain combo and
-- subtracted from the tier score to avoid double-counting
-- Then moved to the permanent quickMessages tracking tableKey Behaviors
- Stats only accumulate when not paused and not frozen
- Uses
translateVelocity()andtranslateDistance()for unit-aware formatting - Time formatting handles hours, minutes, seconds with proper pluralisation
- Tier names are translated via
translateLanguage("missions.drift.tiers.<id>") - Stat names translated via
translateLanguage("missions.drift.stats.<key>") - Quick messages discarded on crash/spinout (via
driftFailed())
See Also
- drift/bounds - Drift Zone Boundary Detection - Related reference
- drift/destination - Race Path & Wrong-Way Detection - Related reference
- drift/display - Drift UI & HUD Management - Related reference
- Gameplay Systems Guide - Guide
Drift Save/Load
Reference for `gameplay_drift_saveLoad`, which loads drift spot definitions from level directories, manages per-spot score persistence, and handles career save integration.
Drift Scoring System
Reference for `gameplay_drift_scoring`, which calculates continuous drift scores, manages the combo system, tracks tier progression, handles stunt zone bonuses, and determines career rewards.