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
Race PacenoteRace PathRace PathnodeRaceRace SegmentRace Start Position

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 Extensionsgameplayrace

Race Path

Core class representing a complete race path. Contains sorted lists of pathnodes, segments, start positions, and pacenotes. Handles auto-configuration, AI path generation, serialization, and importing

Core class representing a complete race path. Contains sorted lists of pathnodes, segments, start positions, and pacenotes. Handles auto-configuration, AI path generation, serialization, and importing from tracks/scenarios.


Constructor

local Path = require('/lua/ge/extensions/gameplay/race/path')
local path = Path("My Race")

Public API

MethodSignatureReturnsDescription
init(name)nilInitializes path with sorted lists and default fields
autoConfig()nilBuilds graph of segments with successors, predecessors, visibility info
findSegments(from, to)tableFinds segments matching from/to node IDs
getAiPath(verbose)aiPath, aiDetailedPathGenerates AI navigation path from navgraph
findStartPositionByName(name)startPos/nilLooks up a start position by name
onSerialize()tableFull serialization of path data
onDeserialized(data)nilRestores path from serialized data
reverse()nilSwaps start/end nodes and reverses all segments
classify()tableReturns classification: {closed, branching, reversible, allowRollingStart}
fromLapConfig(lapConfig, closed)nilImports from scenario lap config
fromCheckpointList(list, closed)nilImports from scene checkpoint objects
fromTrack(trackInfo, usePrefabs)boolImports from track info with optional prefab spawning
recalculateSegments()nilRebuilds segments from sequential pathnodes
getLastPathnode()pathnodeReturns the last sorted pathnode
drawDebug(drawMode)nilDraws all pathnodes, segments, start positions, pacenotes
getNextUniqueIdentifier()numberReturns next unique ID for child objects

Internals

FieldTypeDescription
pathnodessortedListManaged list of pathnode objects
segmentssortedListManaged list of segment objects
startPositionssortedListManaged list of start position objects
pacenotessortedListManaged list of pacenote objects
startNodenumberID of the starting pathnode
endNodenumberID of the ending pathnode
defaultStartPositionnumberID of the default start position
configtableAuto-generated graph config (see below)
defaultLapsnumberDefault number of laps
hideMissionboolWhether to hide the mission marker

Config Structure (from autoConfig)

FieldTypeDescription
startNodenumberStart pathnode ID
startSegmentstableSegment IDs starting from start node
finalSegmentstableSegment IDs that end a lap
graphtablePer-segment graph data (successors, predecessors, visibility)
closedboolWhether path loops back to start
branchingboolWhether path has branches
linearSegmentstableOrdered pathnode IDs for non-branching paths
segmentToPacenotestableMap of segment ID → pacenote IDs

How It Works

  1. Path contains sorted lists of pathnodes, segments, start positions, and pacenotes
  2. autoConfig() builds a directed graph from segments, computing successors, predecessors, and visibility coloring
  3. Visibility "coloring" propagates backwards from visible pathnodes to mark which upcoming checkpoints are visible from each segment
  4. getAiPath() converts pathnodes to navgraph waypoints for AI driving using map.findClosestRoad
  5. Import methods (fromTrack, fromLapConfig, etc.) convert legacy formats into the path structure

Usage Examples

-- Create and configure a path
local path = Path("Circuit Race")
local pn1 = path.pathnodes:create("Start")
pn1:setManual(vec3(0,0,0), 10, vec3(0,1,0))
local pn2 = path.pathnodes:create("Turn 1")
pn2:setManual(vec3(100,0,0), 10, nil)

local seg = path.segments:create("Seg 1")
seg:setFrom(pn1.id)
seg:setTo(pn2.id)

path:autoConfig()

-- Save to file
jsonWriteFile("myrace.path.json", path:onSerialize(), true)

Notes

  • Child objects (pathnodes, segments, etc.) use sortedList from gameplay/util/sortedList
  • The _uid counter provides unique IDs across all child object types
  • Prefab fields (prefabs, forwardPrefabs, reversePrefabs) store paths to decorative prefabs
FunctionSignatureReturnsDescription
M.drawAiRouteDebug()nildrawAiRouteDebug
M.copy()nilcopy
M.init(name)nilinit

See Also

  • Race Pacenote - Related reference
  • Race Pathnode - Related reference
  • Race - Related reference
  • Gameplay Systems Guide - Guide

Race Pacenote

Object class representing a pacenote (audio/visual cue) along a race path. Pacenotes have a position, radius, directional normal, and associated text note. Used for co-driver callouts.

Race Pathnode

Object class representing a checkpoint (pathnode) along a race path. Defines a trigger sphere with optional directional normal, side padding, visibility, and recovery positions.

On this page

ConstructorPublic APIInternalsConfig Structure (from autoConfig)How It WorksUsage ExamplesNotesSee Also