Gameplay Rally
Main extension for the rally gameplay system. Manages rally mission loading/unloading, co-driver timing, recce app, rally toolbox debug UI, and integration with race pathnode events.
Main extension for the rally gameplay system. Manages rally mission loading/unloading, co-driver timing, recce app, rally toolbox debug UI, and integration with race pathnode events.
Public API
| Function | Signature | Returns | Description |
|---|---|---|---|
M.loadMission | (missionId, missionDir, drivelineMode) | nil | Loads a rally mission from the given directory |
M.unloadMission | () | nil | Unloads the current rally mission |
M.isReady | () | bool | Returns true if a rally manager is loaded |
M.getRallyManager | () | RallyManager/nil | Returns the active rally manager |
M.getErrorMsgForUser | () | string/nil | Returns any user-facing error message |
M.enableRecceApp | (val) | nil | Enables/disables the recce app |
M.toggleDebug | () | nil | Toggles the Rally Toolbox imgui debug window |
M.getRallyToolbox | () | RallyToolbox/nil | Returns the toolbox instance |
M.isRallyToolboxVisible | () | bool | Whether the debug toolbox is visible |
M.getRace | () | table/nil | Returns the registered race data |
M.getDebugLogging | () | bool | Returns debug logging state |
M.setDebugLogging | (val) | nil | Enables/disables debug logging |
Input Actions
| Action | Description |
|---|---|
M.actionToggleMouseLikeVehicle | Toggles mouse-as-vehicle for recce debugging |
M.actionTranscribeRecordingCut | Triggers cut recording in recce mode |
M.actionRecceMoveVehicleForward | Moves recce vehicle forward |
M.actionRecceMoveVehicleBackward | Moves recce vehicle backward |
M.actionCodriverCallsEarlier | Decreases co-driver timing by 0.1s |
M.actionCodriverCallsLater | Increases co-driver timing by 0.1s |
Hooks
| Hook | Purpose |
|---|---|
M.onUpdate | Updates recce app, rally manager, and debug toolbox |
M.onVehicleResetted | Forwards vehicle reset to rally manager |
M.onExtensionLoaded | Loads helper extensions, triggers UI event |
M.onExtensionUnloaded | Unloads helper extensions |
M.onRacePathnodeReached | Records split times in rally manager |
M.onRallyRegisterRace | Stores race data and passes to rally manager |
M.recceApp | value |
Dependencies (requires)
gameplay/rally/utilgameplay/rally/rallyManagergameplay/rally/recceAppgameplay/rally/tools/rallyToolboxgameplay/rally/extHelper
How It Works
loadMission()creates aRallyManagerfor the specified mission directory and validates it viareload()- On each frame,
onUpdate()ticks the recce app (if active) and the rally manager (if loaded and not recording) - Co-driver timing is controlled via the
rallyCodriverTimingsetting (1.0–10.0 seconds), adjustable with input actions onRacePathnodeReachedforwards pathnode events to the rally manager for split recording- The Rally Toolbox provides an imgui debug window (hidden when the menu or editor is active)
- Input actions are bound to controller/keyboard for recce operations and co-driver timing
Usage Examples
-- Load a rally mission
extensions.load("gameplay_rally")
gameplay_rally.loadMission("myStage", "/levels/west_coast/rally/stage1/")
-- Check readiness
if gameplay_rally.isReady() then
local mgr = gameplay_rally.getRallyManager()
end
-- Adjust co-driver timing
settings.setValue('rallyCodriverTiming', 4.0)
-- Toggle debug toolbox
gameplay_rally.toggleDebug()Notes
- Co-driver timing range: 1.0–10.0s, stored in
rallyCodriverTimingsetting - The recce app and rally manager are mutually exclusive in
onUpdate(recce recording suppresses rally manager updates) - Many race/rally lifecycle hooks are defined but commented out, ready for future use
- The rally toolbox only renders when menu and editor are inactive
See Also
- Gameplay Achievement - Related reference
- Gameplay City - Related reference
- discover - Discover / Experience System - Related reference
- Gameplay Systems Guide - Guide
Gameplay Police
Manages police pursuit logic including suspect tracking, arrest/evade timers, roadblock placement, and pursuit mode escalation. Tightly integrated with the traffic system.
Gameplay Rally Loop
Extension (`gameplay_rallyLoop`) that manages rally loop gameplay - a looping multi-stage rally system. Wraps a `RallyLoopManager` and handles lifecycle, UI streaming, debug toolbox, and mission trans