RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Bus DriverDamage GoalDemolition DerbyDistance GoalDrift GoalFinish Race GoalNo-Move GoalPosition GoalQuick RaceQuick Race LoaderRace MarkersRace DebugRace Goals ManagerRace UIScenario HelperScenario EngineScenarios LoaderSpeed GoalTime Limit GoalWaypoint ActionScenario Waypoints

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 Extensionsscenario

Bus Driver

M.dependencies = {'scenario_scenarios', 'core_groundMarkers'}

Dependencies

M.dependencies = {'scenario_scenarios', 'core_groundMarkers'}

Implements bus driving scenario logic: route following, bus stop detection, door/kneel requirements, passenger simulation, scoring (damage, smoothness, stop accuracy), and ground marker navigation.


Internal State

FieldTypeDescription
M.enabledLineDebugvariesAssigned as false

Public API

FunctionSignatureDescription
M.onRaceStart()Initializes bus line, markers, nav helpers, unfreezes player
M.onBeamNGTrigger(data)Handles bus stop enter/exit triggers
M.onBusUpdate(state)Processes stop approach, timer countdown, door/kneel checks
M.onPreRender(dt, dtSim)Updates markers, ground path, computes live ratings
M.onVehicleSwitched(oldId, newId, player)Resets and reinitializes for new vehicle
M.onScenarioRestarted(scenario)Resets state and reinitializes bus line
M.onScenarioLoaded(scenario)Configures seat ballast and traffic
M.onExtensionUnloaded()Clears markers and ground path, unfreezes player
M.fail(reason)Fails the scenario with a message
M.requestState()Sends current bus route state to UI
M.onPhysicsPaused()Pauses stop timer
M.onPhysicsUnpaused()Resumes stop timer
M.onClientEndMission()Clears marker references
M.onRaceResult(final)-

Dependencies

scenario_scenarios, core_groundMarkers


Scoring System

MetricCalculationRating
DamageBinary per-stop: any damage increase = 100% penalty0–100 per stop
SmoothnessLateral acceleration + jerk, temporally smoothed0–100 per stop
Stop DistanceLongitudinal offset from bus stop center0–100 via smoothstep
Stop AngleDot product of bus forward vs stop forward direction0–100 via power curve

How It Works

  1. Route setup: Loads bus line config from scenario JSON via core_busRouteManager.setLine
  2. Navigation: Sets ground markers path to next stop using nav helper waypoints
  3. Stop detection: onBeamNGTrigger detects enter/exit of bus stop triggers
  4. Stop sequence: Vehicle must stop, kneel, open doors, wait 5 seconds, close doors, raise
  5. Camera: Switches between rider/external cameras during stop sequence
  6. Markers: Four corner markers (TSStatic) placed around each bus stop, color-coded red→green
  7. Scoring: Real-time smoothness/damage/position tracking per stop, aggregated at finish

Bus Stop Flow

Enter trigger → Stop moving → Kneel → Open doors → Wait 5s → Close doors → Raise → Exit trigger
                                                                                         ↓
                                                                               Next stop / Success

Key Notes

  • Strict mode requires sequential stop visits - skipping a stop fails the scenario
  • Bus stats display is temporarily disabled (issue #2783)
  • Uses core_groundMarkers for GPS-style navigation path
  • Player vehicle is frozen on reset and unfrozen on race start
  • Supports passenger simulation via seat ballast parts and traffic spawning

Additional Exports

  • M.onVehicleStoppedMoving - (undocumented)

See Also

  • Scenario Damage Goal - Damage-Based Win/Fail Condition - Related reference
  • Scenario Demolition Derby - Last Vehicle Moving Wins - Related reference
  • Scenario Distance Goal - Distance-Based Win/Fail Condition - Related reference
  • Scenario System Guide - Guide

Offscreen View Demo

A minimal example extension demonstrating how to create and display an offscreen render view in an ImGui window. The camera orbits the origin.

Damage Goal

A scenario goal that monitors vehicle damage and triggers win or fail when damage exceeds a configurable limit. Supports threshold-based progress notifications.

On this page

DependenciesInternal StatePublic APIDependenciesScoring SystemHow It WorksBus Stop FlowKey NotesAdditional ExportsSee Also