RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Bus DriverDamage GoalDemolition DerbyDistance GoalDrift GoalFinish Race GoalNo-Move GoalPosition GoalQuick RaceQuick Race LoaderRace MarkersRace DebugRace Goals ManagerRace UIScenario HelperScenario EngineScenarios LoaderSpeed GoalTime Limit GoalWaypoint ActionScenario Waypoints

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 Extensionsscenario

Quick Race

Handles the runtime logic for quick race scenarios: vehicle spawning, prefab loading, waypoint generation from race paths, lap timing, highscore recording, and time-of-day setup.

Handles the runtime logic for quick race scenarios: vehicle spawning, prefab loading, waypoint generation from race paths, lap timing, highscore recording, and time-of-day setup.


Internal State

FieldTypeDescription
M.addCheckPointvariesAssigned as addCheckPoint
M.loadCheckpointsvariesAssigned as loadCheckpoints

Public API

FunctionSignatureDescription
M.onLoadCustomPrefabs(sc)Loads flowgraph, race file, spawns vehicle
M.onCustomWaypoints(sc)Converts race path into lap config waypoints
M.onScenarioLoaded(sc)Sets vehicle lights for night, reverses normals if needed
M.loadVehicle(scenario)Spawns the player vehicle at spawn position
M.onCountdownEnded()Unfreezes vehicle, resets lap times
M.onRaceWaypointReached(wpInfo)Records lap times, submits single-lap highscores
M.onRaceResult(final)Records final race highscore, prepares results for UI
M.getConfigKey(rolling, reverse, laps) → stringGenerates highscore key like "standingReverse2"
M.onClientEndMission()Cleans up flowgraph
M.changeTimeTrialConfig()Toggles time trial overview screen
M.onUiChangedState(curUIState, prevUIState)Handles UI navigation from quickrace overview
M.getNodesOnBranch(segment, config) → tableRecursively extracts waypoint names from race graph
M.getVehicleBrand(scenario) → stringReturns vehicle brand name
M.getVehicleName(scenario) → stringReturns vehicle model name

Waypoint Generation

The onCustomWaypoints function converts a race path into scenario lap config:

  1. Optionally reverses the path
  2. Auto-configures the path graph
  3. Generates node names like __generated_from_path__<id>
  4. Recursively traverses the graph via depth-first search
  5. Handles branching paths (split waypoints stored in lapConfigBranches)
  6. Sets startTimerCheckpoint from the path's start node

Vehicle Spawning

loadVehicle determines spawn position based on track config:

ModeSpawn Sphere
Standing + ForwardspawnSpheres.standing
Standing + ReversespawnSpheres.standingReverse
Rolling + ForwardspawnSpheres.rolling
Rolling + ReversespawnSpheres.rollingReverse

For .race.json tracks, spawn is derived from startPositions in the path.


Highscore Keys

Generated by getConfigKey():

RollingReverseLapsKey
falsefalse3"standing3"
truefalse1"rolling1"
falsetrue2"standingReverse2"

How It Works

  1. UI calls startQuickrace with scenario/track/vehicle data
  2. onLoadCustomPrefabs loads flowgraph (if any) and race file, spawns vehicle
  3. onCustomWaypoints generates lap configuration from race path
  4. Scenario system handles countdown, race logic via scenario_scenarios
  5. onRaceWaypointReached records per-lap times and submits to highscores
  6. onRaceResult records final time and prepares detailed results for UI

Key Notes

  • Supports both legacy spawn sphere and modern .race.json path formats
  • Flowgraph-based tracks load via core_flowgraphManager
  • Headlights auto-enabled for TOD values 0, 1, or 8 (nighttime)
  • Time trial UI can be toggled from pause menu via changeTimeTrialConfig
  • Per-lap and full-race highscores tracked separately

Additional Exports

  • M.timeTrialOpen - (undocumented)

See Also

  • Scenario Bus Driver - Bus Route Scenario Logic - Related reference
  • Scenario Damage Goal - Damage-Based Win/Fail Condition - Related reference
  • Scenario Demolition Derby - Last Vehicle Moving Wins - Related reference
  • Scenario System Guide - Guide

Position Goal

A scenario goal that checks if a vehicle is within range of a target scene object at race end. Used for parking/braking scenarios.

Quick Race Loader

Discovers available quick race tracks across all levels, loads track configurations, supports track editor tracks, and assembles complete scenario data for the quick race system.

On this page

Internal StatePublic APIWaypoint GenerationVehicle SpawningHighscore KeysHow It WorksKey NotesAdditional ExportsSee Also