RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorVehicle ExporterFollow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track GeneratorRectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot CreatorShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files SyntaxVehicle Rope DebugBatch WorkerWebSocket Test

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 Extensionsutil

Rich Presence

Manages Steam and Discord rich presence status, showing what the player is doing (level, vehicle, activity).

Manages Steam and Discord rich presence status, showing what the player is doing (level, vehicle, activity).


Overview

util_richPresence updates Steam rich presence text and Discord activity based on the current game state - which level is loaded, which vehicle is active, whether the player is in a scenario, mission, editor, or freeroam. Also integrates with Steam Timeline for event markers (crashes, laps, drifts).

Extension path: lua/ge/extensions/util/richPresence.lua


Exports (M)

FunctionSignatureDescription
set(v) → bool|nilSets Steam rich presence string. Returns success.
onExtensionLoaded()Initializes Steam/Discord presence, registers timeline callbacks.
onExtensionUnloaded()Clears presence and removes timeline callbacks.
onSettingsChanged()Responds to rich presence toggle in settings.
onVehicleSwitched(oldId, newId, player)Updates vehicle name in presence.
onClientPostStartMission(levelPath)Updates level name in presence.
onGameStateUpdate(state)Refreshes presence on game state changes.
onAnyMissionChanged()Refreshes presence when missions change.
onEditorActivated()Updates presence and sets Steam timeline to editor mode.
onEditorDeactivated()Reverts presence from editor mode.
onUiReady()Sets Steam timeline game mode on UI load.
onUiChangedState(toState, fromState)Updates timeline game mode on UI state transitions.
onResetGameplay()Adds "reset" timeline event.
onNewAttempt(data)Adds "New attempt" timeline event.
onAttemptFailed(data)Adds "Failed" timeline event.
onAttemptCompleted(data)Adds "Completed" timeline event.
onRaceWaypointReached(data)Adds race waypoint timeline event.
onRaceLap(data)Adds lap timeline event with time string.
onRaceBranchChosen(data)Adds race branch timeline event.
onRaceResult(data)Adds race result timeline event.
onMissionAttemptAggregated(attempt, mission)Adds mission result timeline event.
M.clientEndMission(levelpath)-
M.clientPreStartMission(levelpath)-

Internals

State

M.state = {
  levelName = "",         -- Human-readable level name
  vehicleName = "",       -- "Brand Model" string
  levelIdentifier = ""    -- Lowercase level ID for Discord asset matching
}

Message Formatting (msgFormat)

Builds a presence string like:

  • "Playing Freeroam on East Coast Usa with Gavril D-Series"
  • "Using World Editor on Italy"
  • "Walking around on Grid Map"

Sets both Steam (timelineSetStateDescription) and Discord (setActivity) with level images and vehicle info.

Discord Assets

Level images are matched against lvlAssets (e.g., lvl_east_coast_usa). Unmatched levels use missingnormaltexture.

Steam Timeline Events

Registered via gameplay_statistic.callbackRegister:

Stat KeyIconTitleType
vehicle/crashsteam_deathCrashinstant
vehicle/airtime.timesteam_effectAirrange
vehicle/rolloversteam_starburstRolloverinstant
vehicle/jturnsteam_trianglejturninstant
drift/crashessteam_boltdrift crashinstant

| M.onDeserialized | varies | Assigned as nop -- do not remove | | M.richPresenceEnabled | varies | Assigned as true |

Toggleable Functions

Rich presence can be disabled via settings. When disabled, the internal set function is replaced with nop. Internal builds disable presence by default.


How It Works

  1. On load, initializes Steam/Discord presence and registers timeline stat callbacks.
  2. Vehicle switches and level loads update M.state and call msgFormat().
  3. msgFormat() builds a descriptive string and pushes it to Steam and Discord.
  4. Game events (crashes, laps) are reported to Steam Timeline for replay highlights.

Lua Examples

-- Manually set presence text
extensions.util_richPresence.set("Testing mods")

-- Check current state
local state = extensions.util_richPresence.state
print(state.levelName, state.vehicleName)

Additional Exports

  • M.onAnyMissionChanged - (undocumented)
  • M.onAttemptCompleted - (undocumented)
  • M.onAttemptFailed - (undocumented)
  • M.onClientPostStartMission - (undocumented)
  • M.onEditorActivated - (undocumented)
  • M.onEditorDeactivated - (undocumented)
  • M.onExtensionLoaded - (undocumented)
  • M.onExtensionUnloaded - (undocumented)
  • M.onGameStateUpdate - (undocumented)
  • M.onMissionAttemptAggregated - (undocumented)
  • M.onNewAttempt - (undocumented)
  • M.onPursuitOffense - (undocumented)
  • M.onRaceBranchChosen - (undocumented)
  • M.onRaceLap - (undocumented)
  • M.onRaceResult - (undocumented)
  • M.onRaceWaypointReached - (undocumented)
  • M.onResetGameplay - (undocumented)
  • M.onScenarioChange - (undocumented)
  • M.onScenarioFinished - (undocumented)
  • M.onScenarioRestarted - (undocumented)
  • M.onScenarioUIReady - (undocumented)
  • M.onSettingsChanged - (undocumented)
  • M.onUiChangedState - (undocumented)
  • M.onUiReady - (undocumented)
  • M.onVehicleSwitched - (undocumented)
  • M.set - (undocumented)

See Also

  • Auto Annotation - Related reference
  • Booster - Related reference
  • Calibrate ESC - Related reference
  • Game Engine Overview - Guide

Resave Materials

Batch-converts legacy TorqueScript material files (`materials.cs`) to the new JSON format.

Save Dynamic Data

Automated tool that iterates all vehicle configs, spawns each, and runs dynamic data tests to generate vehicle info files.

On this page

OverviewExports (M)InternalsStateMessage Formatting (msgFormat)Discord AssetsSteam Timeline EventsToggleable FunctionsHow It WorksLua ExamplesAdditional ExportsSee Also