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

Game State

Manages the high-level game state (freeroam, campaign, etc.), loading screen lifecycle, and main menu visibility. Coordinates between Lua systems and the UI layer during level transitions.

Manages the high-level game state (freeroam, campaign, etc.), loading screen lifecycle, and main menu visibility. Coordinates between Lua systems and the UI layer during level transitions.


Public API - Game State

FunctionSignatureDescription
M.setGameState(state, appLayout?, menuItems?, options?)Sets the current game state and notifies UI + extensions via GameStateUpdate.
M.requestGameState()Re-sends the current game state to UI and extensions.
M.requestMainMenuState() → boolSends ShowEntertainingBackground to UI. Returns true if no mission is loaded (main menu).

Public API - Loading Screen

FunctionSignatureDescription
M.requestEnterLoadingScreen(tagName, func?)Requests entering the loading screen. tagName identifies the requester. Optional func is called once the loading screen is active. Multiple requesters are tracked.
M.requestExitLoadingScreen(tagName, ignoreMenuswitch?)Marks tagName as done loading. When all requesters are done, hides the loading screen and shows main menu if appropriate.
M.loading() → boolReturns true if any loading screen request is still active. ⚠️ Don't use inside loading process.
M.getLoadingStatus(tagName) → bool|nilReturns the loading status for a specific tag.
M.loadingScreenActive()Called by UI to signal the loading screen is fully rendered; triggers queued callbacks.

Public API - UI

FunctionSignatureDescription
M.onUIInitialised()Called when the UI finishes loading. Triggers ChangeState to loading if waiting.
M.onUiChangedState(toState, fromState)Pushes/pops pause requests for menu-related UI states (main menu, photo mode, options, etc.).

Hooks

FunctionDescription
M.onExtensionLoadedRequests UI initialization state.
M.onUpdateWatchdog: forces loading screen activation after 1 second if UI hasn't responded.
M.onDeserializedNo-op placeholder.

State Fields

M.state = {
  state     = "freeroam",  -- game mode identifier
  appLayout = {...},        -- UI app layout config
  menuItems = {...},        -- menu item config
  options   = {...},        -- additional options
}

Loading Screen Flow

  1. System calls requestEnterLoadingScreen("levelLoad", callback).
  2. UI receives LoadingScreen { active = true } and renders the loading screen.
  3. UI calls loadingScreenActive() → queued callbacks fire.
  4. When done, system calls requestExitLoadingScreen("levelLoad").
  5. If all tags are cleared, UI receives LoadingScreen { active = false, gotoMainMenu = bool }.

Paused UI States

These UI states automatically pause the simulation: menu.mainmenu, menu.photomode, menu.options, menu.vehiclesnew, menu.appedit, menu.levels, menu.mods, menu.appselect

Usage Example

-- Enter a loading screen for custom level transition
core_gamestate.requestEnterLoadingScreen("myMod", function()
  -- Load level assets here
  core_gamestate.requestExitLoadingScreen("myMod")
end)

Game Context

Provides game context information for the UI, including mission state change notifications and WIP (Work In Progress) warning labels for experimental features.

Ground Marker Arrows

Manages 3D floating arrow indicators that appear at intersections along a navigation route, guiding the player through turns. Uses a pooled TSStatic approach with smooth fade/scale transitions.

On this page

Public API - Game StatePublic API - Loading ScreenPublic API - UIHooksState FieldsLoading Screen FlowPaused UI StatesUsage Example