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
Locations DetectorMission ManagerMissionsMission Screen UIPOI TestProgressMission Start TriggerUnlocks
Bus Mode MissionsTime Trial Missions

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 ExtensionsgameplaymissionsproceduralMissionGenerators

Time Trial Missions

Reference for the time trial procedural mission generator that converts quickrace tracks into playable time trial missions.

Reference for the time trial procedural mission generator that converts quickrace tracks into playable time trial missions.


Module Exports (M)

FunctionSignatureDescription
generate() → tableGenerates time trial missions from quickrace data

How It Works

local function generate()
  -- 1. Load quickrace track list via scenario_quickRaceLoader
  local data = scenario_quickRaceLoader.getQuickraceList()

  for _, level in ipairs(data) do
    for _, race in ipairs(level.tracks) do
      if not race.ignoreAsMission then
        -- 2. Get race file (or convert from track editor format via cache)
        local raceFile = race.raceFile
        if not raceFile and not race.isTrackEditorTrack then
          race, raceFile = getCachedRacefile(level, race)
        end

        -- 3. Build mission from race data
        mission.id = "timeTrials/"..levelName..'/'..trackName.."-procedural"
        mission.missionType = "generatedTimeTrial"

        mission.missionTypeData = {
          raceFile = raceFile,
          closed = race.closed,
          reversible = race.reversible,
          allowRollingStart = race.allowRollingStart,
          defaultLaps = race.defaultLaps,
          prefabs = race.prefabs,        -- always loaded
          reversePrefabs = race.reversePrefabs,  -- reverse direction only
          forwardPrefabs = race.forwardPrefabs,  -- forward direction only
        }

        -- 4. Set start trigger from default start position
        for _, sp in ipairs(race.startPositions) do
          if sp.oldId == race.defaultStartPosition then
            mission.startTrigger.pos = sp.pos
            mission.startTrigger.rot = sp.rot
          end
        end
      end
    end
  end
end

Race File Caching

Tracks without .race.json files are converted and cached:

local cachePath = "gameplay/temp/timeTrials/"
local function getCachedRacefile(level, race)
  -- 1. Check cache at cachePath/id.json
  -- 2. If missing, convert via race path:fromTrack()
  -- 3. Save to cache (or mark as {invalid=true})
  -- 4. Return cached data + cache file path
end

Prefab Auto-Discovery

For each prefab list (prefabs, reversePrefabs, forwardPrefabs):

  1. Check if file exists as-is
  2. Try levels/{level}/{name}.prefab and .prefab.json extensions
  3. Auto-discover levels/{level}/quickrace/{trackName}.prefab and variants (_reverse, _forward)

Generated Mission Structure

FieldValue
missionType"generatedTimeTrial"
retryBehaviour"infiniteRetries"
careerSetup.defaultStarKeys{'justFinish'}
careerSetup.showInCareerfalse
careerSetup.showInFreeroamtrue
startCondition{type = "vehicleDriven"}
M.generate()

Key Behaviors

  • Tracks with ignoreAsMission = true are skipped
  • Tracks hidden by real (file-based) missions via hidesOriginalTimeTrialFile are filtered out
  • Preview images searched with .jpg, .png, .jpeg extensions in levels/{level}/quickrace/
  • Invalid race conversions are cached as {invalid=true} to avoid repeated failures
  • Contains WIP conversion code (disabled) to save procedural missions as real file-based missions
  • Official status determined by isOfficialContentVPath(raceFile)

See Also

  • proceduralMissionGenerators/busModeMissions - Bus Route Mission Generator - Related reference
  • Gameplay Systems Guide - Guide

Bus Mode Missions

Reference for the bus mode procedural mission generator that creates missions from bus route data files.

Career Conditions

Reference for career-specific unlock condition types used by the mission unlock system.

On this page

Module Exports (M)How It WorksRace File CachingPrefab Auto-DiscoveryGenerated Mission StructureKey BehaviorsSee Also