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

Levels

Level discovery, metadata, and loading system. Scans `/levels/` for available maps, enriches data with previews/spawn points/mod info, and provides the API for starting levels.

Level discovery, metadata, and loading system. Scans /levels/ for available maps, enriches data with previews/spawn points/mod info, and provides the API for starting levels.


Public Functions

FunctionSignatureDescription
M.getList() → tableReturns cached array of all level info objects
M.getListWithStats() → {levels, uiStats}Returns levels with UI stats from freeroam_levelStats
M.getLevelNames() → tableReturns array of level name strings
M.getSimpleList() → tableAlias for getLevelNames (backward compat)
M.getLevelByName(levelName) → infoFinds a level by name (case-insensitive)
M.getLevelTitle(levelName) → stringReturns the display title (cached)
M.getLevelPreview(levelName) → stringReturns the first preview image path (cached)
M.getTimeOfDayOptions(levelName) → tableReturns time-of-day presets for a level
M.getLevelPaths() → tableReturns array of level directory paths
M.startLevel(levelPath, delayedStart, customLoadFn, spawnVehicle)Loads a level with optional vehicle spawn
M.expandMissionFileName(missionFileName) → stringResolves .mis/.level.json file paths
M.getLevelName(path) → stringExtracts level name from a file path
M.requestData()Sends level list to UI via onLevelsChanged
M.maybeSpawnDefaultVehicle()Spawns the default or requested vehicle after level load
M.onFilesChanged(files)Invalidates cache when level files change
M.onClientPostStartMission()Regenerates DecalRoads after mission start
M.onGetRawPoiListForLevel(levelId, elements)Provides spawn point POIs for the bigmap
M.dependenciesTable. Required extensions: {'freeroam_levelStats'}
M.levelsDirString. Levels directory path ('/levels/'). Backward compatibility.

Level Info Object

FieldTypeDescription
levelNamestringDirectory name of the level
dirstringFull directory path
fullfilenamestringEntry point file path
titlestringDisplay name
previewstableArray of preview image paths
spawnPointstableArray of spawn point definitions
modIDstringMod identifier (nil for official)
officialbooleanWhether the level is official content
supportsTrafficbooleanTraffic support (default true)
supportsTimeOfDaybooleanTime-of-day support (default true)

Module State

VariableTypeDefault
dependenciestable{ "freeroam_levelStats" }

Usage Example

-- Get all levels
local levels = core_levels.getList()
for _, level in ipairs(levels) do
  print(level.levelName .. ": " .. (level.title or "untitled"))
end

-- Find a specific level
local gridmap = core_levels.getLevelByName("gridmap")
if gridmap then
  print("Found: " .. gridmap.dir)
end

-- Start a level with default vehicle
core_levels.startLevel("levels/gridmap/main/", false, nil, nil)

-- Start a level without spawning a vehicle
core_levels.startLevel("levels/utah/main/", false, nil, false)

Dependencies

  • freeroam_levelStats - Provides UI stats for getListWithStats

Notes

  • Levels with both .mis and .level.json formats automatically prefer the JSON version.
  • The cache is invalidated when any file under /levels/ changes.
  • Spawn points can be filtered by career discovery status.
  • levelsDir is exposed as /levels/ for backward compatibility.

See Also

  • loadMapCmd - URL-based map loading
  • globals - FS, scenetree, path utilities

Lap Times

Lap and segment timing system for races. Tracks current time, lap/segment splits, best times, and diffs. Streams formatted timing data to the UI via `guihooks.queueStream`.

Load Map Command

Handles deep-link/startup commands to load a specific map with optional camera position. Parses level paths and camera transforms from structured command data.

On this page

Public FunctionsLevel Info ObjectModule StateUsage ExampleDependenciesNotesSee Also