API Reference GE Extensions scenario Drift Goal A scenario goal that calculates drift scores from vehicle angle and speed, supports combo chains, and triggers win/fail based on minimum drift score thresholds.
A scenario goal that calculates drift scores from vehicle angle and speed, supports combo chains, and triggers win/fail based on minimum drift score thresholds.
Field Type Description M.instancesvaries Assigned as {}
Function Signature Description M.init(scenario)Parses drift goals, initializes scoring state M.processState(scenario, state, stateData)Calculates drift score each tick, handles session end M.updateFinalStatus(scenario, instance)Reports final drift score to statistics system
{
"goal" : {
"drift" : {
"minDrift" : 500 ,
"maxDrift" : 10000 ,
"timeAllowance" : 60 ,
"msg" : "scenarios.drift.customWin" ,
"failMsg" : "scenarios.drift.customFail"
}
}
}
Field Type Description minDriftnumber Minimum score to pass maxDriftnumber Maximum reportable score (clamped) timeAllowancenumber Optional time limit in seconds msglocalizedString Win message failMsglocalizedString Fail message
angleBonus = distance(directionVector, normalizedVelocity) × 10
speedBonus = velocity.length × 0.15
driftBonus = floor(angleBonus × speedBonus)
angleBonus clamped to 2–10 (excludes spinouts > 10, shallow drifts < 2)
speedBonus must be > 1 (excludes very low speed)
Combo multiplier : Chaining drifts within a cooldown grace period increases (combo + 1)×
Score Range Description √(pts/30) = 1 "Tiny Drift" 2 "Small Drift" 3 "Nice Drift" 4 "Great Drift!" 5 "Awesome Drift!" 6 "Spectacular Drift!" 7 "Incredible Drift!" 8+ "Absurd Drift!"
Each tick, computes angle between direction and velocity vectors
Multiplies by speed to get instantaneous drift points
Accumulates into total driftScore with combo multiplier
Grace period (1s cooldown) allows chaining drifts into combos
On race result or time expiry, calls sessionEnd to finish scenario
Score is compared against minDrift to determine pass/fail
-- Scenario JSON: score at least 1000 drift points
{
"vehicles" : {
"scenario_player0" : {
"goal" : {
"drift" : {
"minDrift" : 1000 ,
"maxDrift" : 50000 ,
"timeAllowance" : 120
}
}
}
}
}
Uses map.objects for vehicle velocity and direction data
Cooldown between drifts is 1 second (decrements by 0.25/tick)
Messages displayed via helper.realTimeUiDisplay
Score clamped to maxDrift on session end
Re-tracks vehicle if map object data is missing