Rally Manager
Central runtime manager for a rally stage. Coordinates the notebook, driveline route, audio manager, vehicle tracker, and pacenote queue during gameplay.
Central runtime manager for a rally stage. Coordinates the notebook, driveline route, audio manager, vehicle tracker, and pacenote queue during gameplay.
Constructor
local RallyManager = require('/lua/ge/extensions/gameplay/rally/rallyManager')
local rm = RallyManager(missionDir, missionId)Public API
| Function | Signature | Returns | Description |
|---|---|---|---|
C:reload | () | boolean | Full reload: loads race path, notebook, driveline, audio manager |
C:softReload | () | boolean | Clears visual pacenotes, resets audio queue, triggers driveline recalc |
C:onUpdate | (dtReal, dtSim, dtRaw) | nil | Per-frame update for vehicle tracker, driveline, audio, and queue |
C:onVehicleResetted | () | nil | Handles vehicle reset (calls softReload) |
C:triggerPacenote | (pacenote) | nil | Sends pacenote to audio manager and/or visual HUD |
C:enqueuePacenote | (pacenote) | nil | Adds pacenote to the processing queue |
C:enqueueHold | () | nil | Adds a HOLD marker to pause queue processing |
C:clearQueueHold | () | nil | Removes HOLD from queue front if present |
C:enqueueRandomSystemPacenote | (name) | nil | Queues a random system pacenote (e.g., "finish") |
C:enqueuePauseSecs | (secs) | nil | Queues a timed pause in audio playback |
C:playFirstPacenote | () | nil | Plays the first pacenote in the notebook |
C:getNextPacenotes | () | table | Returns array with next pacenote from driveline route |
C:closestPacenoteToVehicle | () | pacenote | Finds nearest pacenote to vehicle position |
C:drawPacenotesForDriving | () | nil | Debug draws next pacenote text at corner start |
M.getErrorMsgForUser | () | nil | getErrorMsgForUser |
M.getPacenoteProcessingEnabled | () | nil | getPacenoteProcessingEnabled |
M.setPacenoteProcessingEnabled | (enabled) | nil | setPacenoteProcessingEnabled |
M.getMissionStartTrigger | () | nil | getMissionStartTrigger |
M.setupDrivelineRouteHooks | () | nil | setupDrivelineRouteHooks |
M.codriver | () | nil | codriver |
M.getPointDistanceFromStartMeters | (point) | nil | getPointDistanceFromStartMeters |
M.getPointDistanceFromStartKm | (point) | nil | getPointDistanceFromStartKm |
M.getTimeAllocationString | () | nil | getTimeAllocationString |
M.getSplitDataIndex | () | nil | getSplitDataIndex |
M.triggerShowVisualPacenote | (pacenote) | nil | triggerShowVisualPacenote |
M.triggerClearVisualPacenote | (pacenote) | nil | triggerClearVisualPacenote |
M.triggerClearAllVisualPacenotes | () | nil | triggerClearAllVisualPacenotes |
M.sendPacenoteToAudioManager | (pacenote) | nil | sendPacenoteToAudioManager |
M.resetAudioQueue | () | nil | resetAudioQueue |
M.getStartAndFinishStartPositions | () | nil | getStartAndFinishStartPositions |
M.recordSplit | (pathnodeId, time) | nil | recordSplit |
M.getLoopPrefabPath | () | nil | getLoopPrefabPath |
Mission & Race Data
| Function | Signature | Returns | Description |
|---|---|---|---|
C:getMissionId | () | string | Mission identifier |
C:getMissionDir | () | string | Mission folder path |
C:getMissionName | () | string | Translated mission name |
C:getNotebookPath | () | notebook | Current notebook object |
C:getRacePath | () | path | Race path object |
C:getRaceData | () | table | Race timing data |
C:setRaceData | (raceData) | nil | Sets race timing data |
C:getDrivelineRoute | () | DrivelineRoute | Driveline route object |
C:getSpeedLimitKph | () | number | Speed limit from DrivelineV3 |
C:getRaceDistanceMeters | () | number | Total race distance |
C:getRaceCompletionData | () | table | Distance and percentage completion |
C:getActiveStageData | () | table | Live stage dashboard data |
C:getTimeAllocationSecs | () | number | Allocated time based on distance and speed limit |
C:hasAnyPacenotes | () | boolean | Whether notebook has pacenotes |
Start Positions
| Function | Signature | Returns | Description |
|---|---|---|---|
C:getStartPositionByName | (name) | startPos | Lookup by name |
C:getTCInPos | () | startPos | Time control in position |
C:getTCOutPos | () | startPos | Time control out position |
C:getSSStartLinePos | () | startPos | Special stage start line |
C:getSSStopControlPos | () | startPos | Special stage stop control |
C:getSplitDataList | () | table | Split timing data list |
How It Works
Reload Flow
- Loads
MissionSettingsfrom mission directory - Creates
VehicleTrackerwith damage threshold - Loads race path from
race.json - Loads notebook and caches compiled pacenotes
- Creates
AudioManager - Creates
DrivelineRouteand sets up hook callbacks - Loads driveline via
DrivelineV3(recorded driveline file) - Calls
softReload()to initialize route state
Pacenote Queue (Dequeue)
- Pacenotes are enqueued by driveline route hit callbacks
HOLDvalues pause queue processing (used for slow corners)processPacenoteQueue()runs each frame, popping and triggering pacenotes- Queue cleared on vehicle reset or soft reload
Driveline Route Hooks
The rally manager registers callbacks on the driveline route for various trigger points:
onPacenoteCsDynamicHit- Dynamic corner start triggeronPacenoteCsImmediateHit- Immediate corner startonPacenoteCsStaticHit- Static corner start (also clears visual)onPacenoteCeStaticHit- Static corner endonPacenoteCsOffsetHit/onPacenoteCeOffsetHit- Offset triggers (e.g., -5m)onPacenoteCornerPercentHit- Percentage-based triggers (e.g., 50%)
-- Typical usage in a mission extension
local rm = RallyManager(missionDir, missionId)
if rm:reload() then
-- In update loop:
rm:onUpdate(dtReal, dtSim, dtRaw)
endSee Also
- Rally Audio Manager - Related reference
- Rally Camera Path Player - Related reference
- Rally Client - Related reference
- Gameplay Systems Guide - Guide
Rally Geometry
Early work-in-progress rally co-driver system. Generates pacenotes from a route by analyzing road geometry - computing turn radius, velocity, severity, and direction for each node, then splitting and
Recce Manager
High-level manager for rally recce (reconnaissance) recordings. Coordinates loading driveline recordings and voice cut markers, then converts them into pacenote data for the notebook.