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
Drag Race DebugDrag Tree DisplayDrag Race APIDrag Racing ManagerDrag Strip Save SystemDrag Race TimingDrag Race Phases

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 Extensionsgameplaydrag

Drag Strip Save System

Reference for `gameplay_drag_saveSystem`, which handles loading drag strip data from JSON, converting legacy formats, managing dial times / race history, and spawning prefabs.

Reference for gameplay_drag_saveSystem, which handles loading drag strip data from JSON, converting legacy formats, managing dial times / race history, and spawning prefabs.


Overview

Central persistence layer for drag racing. Loads strip definitions from level directories, converts between legacy and modular JSON formats, saves/loads dial times with full race history, and manages Christmas tree / display sign / decoration prefabs.


Exports

Data Loading

| Function | Signature | Description | |--------- | M.saveWaypoint | (waypoint, filePath) | boolean | saveWaypoint | | M.saveLane | (lane, filePath) | boolean | saveLane | | M.saveStrip | (strip, filePath) | boolean | saveStrip |-| | M.onCareerActive | onCareerActive handler |-----------|-------------| | loadCompleteDragRaceData | (stripId) → table\|nil | Load and construct complete race data from strip JSON | | loadDragStripData | (filepath) → table\|nil | Load strip (new modular or legacy with auto-conversion) | | convertLegacyData | (legacyData) → table\|nil | Convert old-format data to current structure | | getCurrentLevelDragPath | () → string\|nil | /levels/<level>/dragstrips/ | | loadDriftData | - | Not present; drift uses separate saveLoad |

Mission Data

FunctionSignatureDescription
createMissionData(stripId, dragType, context, phases, prefabs, canBeReseted, canBeTeleported) → tableBuild mission reference structure

Dial Times & History

FunctionSignatureDescription
saveDialTimes(dragData, timeslip?)Save best times + append history per config hash
getDialTimes() → table{configHash = {time_1_4 = number}}
generateHashFromFile(vehicleId?) → stringHash vehicle's .pc config file via FS:hashFile
getHistory(id?) → {history = table}Get race history, optionally filtered by facility/strip ID
saveDialFile(dir) → boolCopy dial times to a specific directory
getCurrentSavePath() → stringCareer save path
onSaveCurrentSaveSlot(path)Hook to persist dial data on career save
onCareerActive()Career activation hook (empty)

Prefab Management

FunctionSignatureDescription
loadPrefabs(data)Spawn Christmas tree, display sign, decorations, paths
unloadPrefabs(data)Delete spawned prefab objects

Editor Functions

FunctionSignatureDescription
getAllFacilities() → tableScan for *.facility.json in drag path
getAllStrips() → tableScan for *.strip.json
getAllLanes() → tableExtract lanes from all strips
getAllWaypoints() → tableExtract waypoints from all lanes
saveFacility/Strip/Lane/Waypoint(data, path) → boolWrite JSON
saveFacilities(facilities, path) → boolBatch save

Complete Data Structure

loadCompleteDragRaceData constructs:

{
  strip = {
    id = "...", name = "...", description = "...",
    lanes = {
      {
        id, shortName, longName, color, laneOrder,
        waypoints = {
          stage = {transform = {position, rotation, scale, pos, rot, scl, x, y, z}},
          endLine = {...}, spawn = {...}
        },
        boundary = {transform = {position, rotation, scale}},
        stageToEndNormalized = vec3  -- computed direction vector
      }
    }
  },
  phases = {
    {name="stage", dependency=true},
    {name="countdown", dependency=true},
    {name="race", dependency=false},
    {name="stop", dependency=false}
  },
  prefabs = {
    christmasTree = {isUsed=false, treeType=".400"},
    displaySign = {isUsed=false},
    paths = {isUsed=false},
    decorations = {isUsed=false}
  },
  dragType = "dragPracticeRace",
  context = "freeroam",
  racers = {}
}

How It Works

-- Load a strip and get complete data
local data = gameplay_drag_saveSystem.loadCompleteDragRaceData("/levels/west_coast_usa/dragstrips/main.strip.json")

-- Hash the player's current config for dial lookup
local hash = gameplay_drag_saveSystem.generateHashFromFile(be:getPlayerVehicleID(0))

-- Get their best time
local times = gameplay_drag_saveSystem.getDialTimes()
local best = times[hash] and times[hash].time_1_4 or 10

Key Behaviors

  • Dial times are saved to settings/dragDialTimes.json with structure {configHash: {time_1_4, history: [...]}}
  • generateHashFromFile uses FS:hashFile on the vehicle's .pc config file for unique identification
  • History entries contain full timeslip data plus config hashes per racer
  • Legacy format detection: if JSON contains stripId field, it's treated as modular; otherwise legacy conversion runs
  • Prefabs are spawned at origin ("0 0 0") - their internal transforms position them correctly
  • getHistory(id) supports facility IDs (resolves strip IDs via facility's stripIds array) and direct strip ID matching
FunctionSignatureReturnsDescription
M.onCareerActive()nilonCareerActive
M.saveStrip(strip, filePath)nilsaveStrip
M.saveLane(lane, filePath)nilsaveLane
M.saveWaypoint(waypoint, filePath)nilsaveWaypoint
M.convertLegacyData(legacyData)-convertLegacyData handler
M.createMissionData(stripId, dragType, context, phases, prefabs, canBeReseted, canBeTeleported)-Mission data structure (minimal, references facility data)
M.generateHashFromFile(vehicleId)-generateHashFromFile handler
M.getAllFacilities()-Editor compatibility functions (for drag race editor)
M.getAllLanes()-Returns AllLanes
M.getAllStrips()-Returns AllStrips
M.getAllWaypoints()-Returns AllWaypoints
M.getCurrentLevelDragPath()-Returns CurrentLevelDragPath
M.getCurrentSavePath()-Additional functions expected by general.lua
M.getDialTimes()-Returns DialTimes
M.getHistory(id)-Returns History
M.loadCompleteDragRaceData(stripId)-loadCompleteDragRaceData handler
M.loadDragStripData(filepath)-Compatibility functions for old format
M.loadPrefabs(data)-Prefab management functions
M.onSaveCurrentSaveSlot(currentSavePath)-Callback for SaveCurrentSaveSlot event
M.saveDialFile(dir)-saveDialFile handler
M.saveDialTimes(dragData, timeslip)-saveDialTimes handler
M.saveFacilities(facilities, filePath)-saveFacilities handler
M.saveFacility(facility, filePath)-saveFacility handler
M.unloadPrefabs(data)-unloadPrefabs handler

See Also

  • drag/debug - Drag Race Debug Menu - Related reference
  • drag/display - Christmas Tree & Display Signs - Related reference
  • drag/dragBridge - Flowgraph / External API Bridge - Related reference
  • Gameplay Systems Guide - Guide

Drag Racing Manager

Reference for `gameplay_drag_general`, which is the central state manager for the entire drag racing subsystem. Owns `dragData`, manages extension loading/unloading, racer setup, race lifecycle, times

Drag Race Timing

Reference for `gameplay_drag_times`, which tracks all distance-based, velocity-based, and time-based measurements during a drag race.

On this page

OverviewExportsData LoadingMission DataDial Times & HistoryPrefab ManagementEditor FunctionsComplete Data StructureHow It WorksKey BehaviorsSee Also