RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsgameplay

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

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 transitions.


Public API

| Function | Signature | Returns | Description | |---------- | M.getLoopToolbox | () | any | getLoopToolbox | | M.getSSRescheduleCount | () | number | getSSRescheduleCount | | M.setDrawFlag | (flagName, value) | nil | setDrawFlag | | M.getDrawFlag | (flagName) | boolean | getDrawFlag | | M.isLoopToolboxVisible | () | any | isLoopToolboxVisible | | M.setDebugLogging | (val) | nil | setDebugLogging | | M.getDebugLogging | () | any | getDebugLogging ||-----------|---------|-------------| | setup | (missionId, missionDir) | nil | Initialize rally loop manager | | unload | () | nil | Destroy manager | | isReady | () | bool | Manager is initialized | | toggleDebug | () | nil | Toggle loop toolbox ImGui window | | drawDebug | (zOnTop, drawRoute, drawLabels) | nil | Draw debug visualization | | setupForNewMission | () | nil | Prepare for next mission in loop | | setMissionExecutionTransferFlag | (val) | nil | Set transfer flag for mission handoff | | getMissionExecutionTransferFlag | () | bool | Get transfer flag | | getNextMissionId | () | string? | Next mission in the loop | | startNextMission | () | bool | Start next mission | | handleGOTO | (gotoRallyLoop) | nil | Handle navigation: restart, abandon, postServiceIn | | getManager | () | object? | Direct access to RallyLoopManager |

Extension Hooks

HookPurpose
onUpdatePer-frame update, streams data to UI
onGuiUpdateGUI-specific update pass
onExtensionLoadedLog load event
onExtensionUnloadedSend inactive state, log unload
onRallyDataUpdatedForward rally data changes
onGameplayInteractHandle player interact input
onUIStartButtonClickedUI start button handler
onRecalculatedRouteRoute recalculation event
onCreatedRallyGroundMarkerRouteGround marker route created
onRallyVehicleRecoveryTrack vehicle recovery events
onAnyMissionWillChangeHandle mission stop/abandon (DNF tracking)

Internals

  • rallyLoopManager: Core RallyLoopManager instance
  • loopToolbox: Optional ImGui debug window (LoopToolbox)
  • streamData: Data streamed to UI via guihooks.queueStream("rallyLoop", data)
  • Active states: inactive, vehicleProximity, stageActive, countdown

How It Works

  1. Flowgraph calls setup(missionId, missionDir) to initialize the rally loop
  2. onUpdate calls manager update, then streams state data to the UI layer
  3. UI receives rallyLoop stream with activeState and other loop data
  4. handleGOTO routes navigation commands: restart loop, abandon, or advance to next mission
  5. onAnyMissionWillChange records DNF attempts when a mission is abandoned mid-stage
-- Setup from flowgraph
gameplay_rallyLoop.setup(missionId, missionDir)

-- Check state
if gameplay_rallyLoop.isReady() then
  local mgr = gameplay_rallyLoop.getManager()
end

-- Handle navigation
gameplay_rallyLoop.handleGOTO('restart')

Dependencies

  • gameplay/rally/tools/loopToolbox - debug ImGui window
  • gameplay/rally/loop/rallyLoopManager - core loop logic
  • gameplay/rally/loop/rallyAttempts - DNF/attempt tracking
  • gameplay/rally/util - constants and utilities
FunctionSignatureReturnsDescription
M.getDebugLogging()nilgetDebugLogging
M.setDebugLogging(val)nilsetDebugLogging
M.isLoopToolboxVisible()nilisLoopToolboxVisible
M.getDrawFlag(flagName)nilgetDrawFlag
M.setDrawFlag(flagName, value)nilsetDrawFlag
M.getSSRescheduleCount()nilgetSSRescheduleCount
M.getLoopToolbox()nilgetLoopToolbox
M.drawDebug(zOnTop, drawRoute, drawLabels)-drawDebug handler
M.getManager()-Returns Manager
M.getMissionExecutionTransferFlag()-Returns MissionExecutionTransferFlag
M.getNextMissionId()-Returns NextMissionId
M.handleGOTO(gotoRallyLoop)-handleGOTO handler
M.isReady()-Checks if Ready
M.onAnyMissionWillChange(state, mission, abandoned)-Callback for AnyMissionWillChange event
M.onCreatedRallyGroundMarkerRoute()-Callback for CreatedRallyGroundMarkerRoute event
M.onExtensionLoaded()-M.onVehicleActiveChanged = onVehicleActiveChanged
M.onExtensionUnloaded()-Callback for ExtensionUnloaded event
M.onGameplayInteract()-Callback for GameplayInteract event
M.onGuiUpdate(dtReal, dtSim, dtRaw)-Callback for GuiUpdate event
M.onRallyDataUpdated(data)-Callback for RallyDataUpdated event
M.onRallyVehicleRecovery(recoveryType)-Callback for RallyVehicleRecovery event
M.onRecalculatedRoute()-Callback for RecalculatedRoute event
M.onUIStartButtonClicked()-Callback for UIStartButtonClicked event
M.onUpdate(dtReal, dtSim, dtRaw)-Callback for Update event
M.setMissionExecutionTransferFlag(val)-Sets MissionExecutionTransferFlag
M.setup(missionId, missionDir)-Sets up
M.setupForNewMission()-Sets upForNewMission
M.startNextMission()-startNextMission handler
M.toggleDebug()-toggleDebug handler
M.unload()-unload handler

See Also

  • Gameplay Achievement - Related reference
  • Gameplay City - Related reference
  • discover - Discover / Experience System - Related reference
  • Gameplay Systems Guide - Guide

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.

Gameplay Raw POIs

Extension that manages raw Point of Interest (POI) lists used by the bigmap/minimap. Aggregates POIs from all gameplay systems (missions, facilities, gas stations) with special handling for career tut

On this page

Public APIExtension HooksInternalsHow It WorksDependenciesSee Also