RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
Activity ManagerAudio Bank ManagerAudio Ribbon SystemBus Route ManagerCamera SystemCore Chat (IRC)Core CheckpointsCore Command HandlerCoupler Camera ModifierDevices (RGB Peripherals)Dynamic PropsEnvironmentFlowgraph ManagerForestFun StuffGame ContextGame StateGround Marker ArrowsGround MarkersHardware InfoHighscoresHotlappingInventoryJob SystemLap TimesLevelsLoad Map CommandMetricsMod ManagerMultiseatMultiseat CameraMulti SpawnOnlinePaths (Camera Paths)Quick Access (Radial Menu)Recovery PromptRemote ControllerReplayRepositoryRope Visual TestScheme Command ServerCore SnapshotCore SoundsCore TerrainTraffic SignalsTrailer RespawnVehicle Active PoolingVehicle Bridge (GE ↔ VLua Communication)Vehicle MirrorsVehicle PaintsCore VehiclesVehicle TriggersVersion UpdateWeather SystemWindows Console

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 Extensionscore

Hotlapping

Full hotlapping / lap timing system. Supports creating custom circuits in freeroam (edit mode), running timed laps with checkpoint splits, best-lap tracking, and integration with both the old scenario

Full hotlapping / lap timing system. Supports creating custom circuits in freeroam (edit mode), running timed laps with checkpoint splits, best-lap tracking, and integration with both the old scenario race system and the new race system.


Public API - Lifecycle

FunctionSignatureDescription
M.startHotlapping()Enters edit mode: initializes path data, places first checkpoint at player position.
M.stopHotlapping()Stops timer, clears path/race/marker data, exits edit mode.
M.start()Starts the race timer. In edit mode, validates path, creates race+marker objects, plays checkpoint audio.
M.stopTimer()Stops the timer and clears race/marker state. Returns to edit mode.
M.skipLap(keepLapProgress?)Skips the current lap in the race data.

Public API - Checkpoints

FunctionSignatureDescription
M.addCheckPoint(cpPos?, cpDir?, cpRadius?)Adds a checkpoint. Defaults to player position/direction and auto-radius from nearby road width.
M.clearAllCP()Removes all checkpoints and stops AI.
M.changeRadius(sign)Changes all checkpoint radii: +1 increases, -1 decreases, 0 resets to auto-radius. Range: 1–15.
M.setVisible(value)Shows/hides race markers and enables/disables waypoint audio.
M.onCheckPointPassed(index)Hook: processes checkpoint passage, updates lap/CP counters.

Public API - AI

FunctionSignatureDescription
M.startAi()Sets up non-player vehicles to race along the path with AI.
M.stopAi(respawn?)Stops AI vehicles; optionally respawns them to home position.

Public API - Timing

FunctionSignatureDescription
M.setTime()Records current time data for the active lap/checkpoint, calculates diffs vs best lap.
M.setEndTime()Finalizes timing for a completed lap.
M.getTimeInfo() → tableReturns formatted normal + detail time info for UI display.
M.getTimeInfoRaw() → tableReturns raw times table.
M.formatMillis(ms, addSign?) → stringFormats milliseconds as MM:SS.mmm, optionally with +/- sign.
M.getDiffColor(val) → stringReturns "red", "green", or "" based on diff sign.
M.passTimeToGUI()Sends timing data to UI via HotlappingTimer guihook.

Public API - Save/Load

FunctionSignatureDescription
M.save(filePath?)Saves path data as .race.json to gameplay/hotlapping/{level}/.
M.load(filename)Loads a hotlap config from file. Supports old format migration.
M.rename(oldName, newName)Renames a saved hotlap file.
M.refreshTracklist() → tableReturns list of saved track names for the current level.

New Race System Hooks

FunctionDescription
M.newRaceStartInitializes hotlapping from a new-style race object.
M.newRacePathnodeReachedProcesses checkpoint/lap completion from new race events.
M.newRaceLapSkippedMarks the current lap as skipped.
M.newRaceStopStops the timer.

Old Scenario Hooks

FunctionDescription
M.onRaceStartInitializes from scenario race with lap config.
M.onRaceWaypointReachedProcesses waypoint passage from old scenario system.
M.onRaceResultStores detailed times in scenario data.

Hooks

HookPurpose
M.onGameStateUpdateCalled on GameStateUpdate event
M.onMenuToggledCalled on MenuToggled event
M.onScreenFadeStateCalled on ScreenFadeState event
M.onPreRenderCalled on PreRender event
M.onVehicleResettedCalled on VehicleResetted event
M.onClientStartMissionresets the app on level load
M.onClientEndMissionCalled on ClientEndMission event
M.onExtensionUnloadedCalled on ExtensionUnloaded event
M.onUpdate(dtReal, dtSim, dtRaw)Hook: per-frame update.

Usage Example

-- Start hotlapping in freeroam
core_hotlapping.startHotlapping()

-- Add checkpoints at specific positions
core_hotlapping.addCheckPoint(vec3(100, 200, 30), vec3(1, 0, 0), 8)
core_hotlapping.addCheckPoint(vec3(150, 250, 30))

-- Drive through first checkpoint to start timing
-- Times are automatically tracked via onUpdate

-- Save the track
core_hotlapping.save()

Key Internals

  • Path data uses gameplay/race/path module.
  • Race logic uses gameplay/race/race module.
  • Markers use scenario/race_marker module.
  • Supports branching scenarios (disables lap/CP comparisons).
  • Pause time is tracked and excluded from timing.
  • Auto-radius uses map.findClosestRoad() to match road width.

Highscores

Persistent highscore storage for scenario races. Stores per-scenario, per-config lap times with player and vehicle info, sorted by fastest time.

Inventory

Simple key-value inventory system for tracking items (vehicles, parts, currency) during campaigns/scenarios. Supports adding, removing, and querying items by type, with campaign save/resume hooks.

On this page

Public API - LifecyclePublic API - CheckpointsPublic API - AIPublic API - TimingPublic API - Save/LoadNew Race System HooksOld Scenario HooksHooksUsage ExampleKey Internals