Heads-Up Drag Race
Reference for `gameplay_drag_dragTypes_headsUpDrag`, which implements a two-racer heads-up drag race with no handicap.
Reference for gameplay_drag_dragTypes_headsUpDrag, which implements a two-racer heads-up drag race with no handicap.
Overview
Heads-up racing is the classic drag format - both vehicles launch simultaneously from a shared tree with no dial offset. The first to cross the finish line wins (unless disqualified). Phase progression uses dependency-based synchronisation identical to the bracket race type.
Dependencies
gameplay_drag_general, gameplay_drag_utils
Exports
| Function | Signature | Description |
|------
| M.dependencies | table | {"gameplay_drag_general", "gameplay_drag_utils"} |----|-----------|-------------|
| onExtensionLoaded | () | Caches module references, clears state |
| onUpdate | (dtReal, dtSim, dtRaw) | Main loop - updates racers, runs phase logic |
| startDebugPhase | (pIndex, dData) | Jump all racers to a specific phase for testing |
| startActivity | () | Begin the race; sets dial = 0 for all racers |
| resetDragRace | () | Delegates to general reset, clears local flags |
Internals
| Symbol | Purpose |
|---|---|
hasActivityStarted | Gate for the update loop |
debugStart | Flag for debug-phase jumping |
How It Works
-- Start a heads-up race (both racers get dial = 0)
gameplay_drag_dragTypes_headsUpDrag.startActivity()
-- Phase progression:
-- 1. updateRacer(racer) - position, speed, wheels
-- 2. Execute phase function: dUtils[phase.name](phase, racer, dtSim)
-- 3. Non-dependency phases: advance racer individually
-- 4. Dependency phases: wait for ALL racers, then advance all togetherThe key difference from bracket race:
- Bracket: dials come from
racer.timers.dial.value(staggered start) - Heads-up: all dials are forced to
0(simultaneous start)
Key Behaviors
- Dependency phases (
stage,countdown) synchronise both racers - Independent phases (
race,stop) let each racer finish at their own pace - Activity is finished when every racer has
isFinished == true dragData.isCompletedis set on finish- Phase functions (
stage,countdown,race,stop) are defined ingameplay_drag_utils - Win condition uses
headsUpWin()in utils - sorted by raw time, disqualified last
Module Variables
| Variable | Type | Description |
|---|---|---|
M.dependencies | table | {"gameplay_drag_general", "gameplay_drag_utils"} |
M.onExtensionLoaded | () | - |
M.onUpdate | (dtReal, dtSim, dtRaw) | - |
M.resetDragRace | () | - |
M.startActivity | () | - |
M.startDebugPhase | (pIndex, dData) | - |
See Also
- drag/dragTypes/bracketRace - Bracket Race Type - Related reference
- drag/dragTypes/dragPracticeRace - Solo Practice Drag Race - Related reference
- Gameplay Systems Guide - Guide
Drag Practice Race
Reference for `gameplay_drag_dragTypes_dragPracticeRace`, which implements a single-player practice drag race with automatic cleanup.
Drift Zone Bounds
Reference for `gameplay_drift_bounds`, which detects whether the drift vehicle is inside defined zone boundaries and optionally draws them.