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
Rally Audio ManagerRally Camera Path PlayerRally ClientRally Cut CaptureRally EnumsRally Extension HelperRally GeometryRally ManagerRecce ManagerRecce AppRecce SettingsRally Settings ManagerSnap-to-RoadTraffic Exclusion ZonesRally UtilityRally Vehicle CaptureRally Vehicle Tracker
Rally Driveline MeasurementRally Driveline RouteRally Driveline V3Rally Driveline Point ListRally Driveline Utility

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 Extensionsgameplayrallydriveline

Rally Driveline V3

Third-generation driveline system for rally stages. Loads recorded driveline data from recce sessions, simplifies it using RDP algorithm, generates smooth Catmull-Rom splines, and produces final drive

Third-generation driveline system for rally stages. Loads recorded driveline data from recce sessions, simplifies it using RDP algorithm, generates smooth Catmull-Rom splines, and produces final driveline points. Supports editing, rendering, and saving.


Constructor

local DrivelineV3 = require('/lua/ge/extensions/gameplay/rally/driveline/drivelineV3')
local dv3 = DrivelineV3(missionDir)

Public API

MethodSignatureReturnsDescription
init(missionDir)nilInitializes with mission directory
loadFromRecording()boolFull pipeline: load → simplify → smooth → finalize
loadRecceRecording()boolLoads raw driveline points from recce recording
loadFinalDrivelineFromFile()boolLoads a pre-saved final driveline JSON
convertDrivelineToSpline(drivelinePoints?)boolRDP-simplifies points into a spline structure
updateSplineGeometry()boolComputes smooth Catmull-Rom subdivisions
createDrivelineFromSpline()boolGenerates final points from spline
getFinalPointList()PointList/nilReturns final points as a PointList object
deepCopySpline()table/nilDeep copies spline data (for undo/redo)
getSpeedLimitKph()numberReturns configured speed limit (default 100)
calculateDistanceBetweenPoints(p1, p2)numberDistance along the final driveline between two world positions
renderRawDriveline()nilDraws raw points as pink cylinders
renderSmoothCurve()nilDraws subdivided spline as blue cylinders
renderFinalDriveline()nilDraws final points as red cylinders
renderSpline(selectedNodeIdx)nilDraws editable spline nodes

Internals

FieldTypeDescription
missionDirstringMission directory path
rawDrivelinePointstable/nilOriginal recorded driveline points
splinetable/nilEditable spline structure (nodes, widths, normals, subdivisions)
finalDrivelinePointstable/nilGenerated output points
simplificationTolerancenumberRDP tolerance (default 1.0)
properties.speedLimitKphnumberSpeed limit for the driveline (default 100)

Processing Pipeline

  1. Load: loadRecceRecording() reads recorded points from the mission's recce directory
  2. Simplify: convertDrivelineToSpline() applies RDP (Ramer-Douglas-Peucker) algorithm to reduce node count while preserving shape
  3. Smooth: updateSplineGeometry() runs geom.catmullRomRaycast to generate subdivided points with terrain conformance
  4. Finalize: createDrivelineFromSpline() converts subdivided positions to full point structures with quaternions, normals, and linked-list relationships

Final Point Structure

Each final point contains: pos, quat, ts, normal, prev, next, id, pacenoteDistances, cachedPacenotes

How It Works

  1. Raw driveline is recorded during recce (driving the stage slowly)
  2. RDP simplification reduces thousands of points to key shape-defining nodes
  3. Catmull-Rom spline interpolation creates smooth subdivisions between nodes
  4. Terrain raycasting (catmullRomRaycast) snaps subdivisions to ground height
  5. Final points get direction quaternions and terrain-aligned normals
  6. The result can be saved as JSON or used directly by DrivelineRoute

Usage Examples

-- Full loading pipeline
local dv3 = DrivelineV3("/levels/west_coast/rally/stage1/")
if dv3:loadFromRecording() then
  local pointList = dv3:getFinalPointList()
  -- use with DrivelineRoute
end

-- Load pre-saved final driveline
local dv3 = DrivelineV3(missionDir)
if dv3:loadFinalDrivelineFromFile() then
  -- ready to use
end

-- Calculate distance between two positions along the driveline
local dist = dv3:calculateDistanceBetweenPoints(posA, posB)

Notes

  • Uses editor/toolUtilities/rdp for RDP simplification
  • Uses editor/toolUtilities/geom for Catmull-Rom spline computation
  • Default simplification tolerance: 1.0 meters (configurable)
  • Minimum spline divisions: 10; minimum spacing: 2.0 meters
  • calculateDistanceBetweenPoints uses xnorm projection for sub-segment precision
  • Rendering methods use debugDrawer for visualization in the editor
FunctionSignatureReturnsDescription
M.createDrivelinePointsFromPositions(positions)nilcreateDrivelinePointsFromPositions

See Also

  • Rally Driveline Measurement - Related reference
  • Rally Driveline Route - Related reference
  • Rally Driveline Point List - Related reference
  • Gameplay Systems Guide - Guide

Rally Driveline Route

The core driveline routing system for rally stages. Merges race pathnodes and pacenote waypoints into a navigable route, tracks the vehicle's position along it, and triggers pacenote audio events base

Rally Driveline Point List

Container class for a series of points along a rally driveline path. Provides point creation, relationship management, normal calculation, length computation, nearest-point search, and debug rendering

On this page

ConstructorPublic APIInternalsProcessing PipelineFinal Point StructureHow It WorksUsage ExamplesNotesSee Also