RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
G2G Activity

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 ExtensionsgameplaybackgroundActivities

G2G Activity

Background activity that spawns random vehicles into the world. Uses a step-based sequence with fade-to-black transitions for vehicle spawning.

Background activity that spawns random vehicles into the world. Uses a step-based sequence with fade-to-black transitions for vehicle spawning.


Public API

| Function | Signature | Returns | Description | |------ | M.dependencies | table | {"util_stepHandler"} |---- | M.activateFinished | () | nil | activateFinished ||-----------| | M.onVehicleSwitched | onVehicleSwitched handler |---------|-------------| | M.activate | () | nil | Starts the background activity, spawns vehicles | | M.deactivate | () | nil | Removes all spawned vehicles | | M.toggleActive | () | nil | Toggles activation state | | M.isActive | () | boolean | Returns whether the activity is active | | M.getVehicleOptions | () | table | Returns filtered list of eligible vehicle models/configs | | M.onDeserialized | onDeserialized handler |

Dependencies

  • util_stepHandler

Vehicle Selection

getVehicleOptions() filters the vehicle list with these criteria:

  • Type: Cars and Trucks only (no buses, no auxiliary)
  • Performance: Must have top speed > 10 (excludes static/broken configs)
  • Mode filters (hardcoded to Default):
    • Old Cars: max year ≤ 1985
    • New Cars: min year > 1985
    • Race and Rally: Config type Race or Rally
    • RWD Only: Drivetrain == RWD
    • Off-road: Off-Road Score ≥ 50

Returns array of {model, configs[], paints[]} entries.

How It Works

  1. activate() builds a step sequence: fade-to-black → spawn N vehicles → fade-from-black
  2. Each vehicle is randomly selected from getVehicleOptions() with random config
  3. Spawned vehicle IDs stored in vehicleIds for cleanup
  4. deactivate() deletes all spawned objects from scene tree
  5. Auto-deactivates on mission end and career start

Spawn Sequence

local sequence = {
  stepper.makeStepFadeToBlack(),
  stepper.makeStepSpawnVehicleSimple(model, config, callback),
  -- ... repeat for vehicleCount
  stepper.makeStepFadeFromBlack()
}
stepper.startStepSequence(sequence, finishedCallback)

Hooks

HookPurpose
M.onUpdate(empty - reserved for future updates)
M.onClientEndMissionDeactivates on level unload
M.onSerializeDeactivates before Lua reload
M.onCareerActiveDeactivates when career starts
M.onVehicleSwitchedonVehicleSwitched handler
M.onDeserializedonDeserialized handler

Notes

  • Default vehicleCount is 1
  • Vehicle options cached after first call
  • Uses editor.onRemoveSceneTreeObjects for clean editor integration
  • Not persistent across serialization - always deactivates on save
FunctionSignatureReturnsDescription
M.activateFinished()nilactivateFinished

Module Variables

VariableTypeDescription
M.dependenciestable{"util_stepHandler"}

See Also

  • Gameplay Systems Guide - Guide

Walking

Reference for `gameplay_walk`, which manages the walking mode (first-person on-foot via the "unicycle" vehicle). Handles toggling between walking and driving, entering/exiting vehicles, proximity dete

Crash Test Boundaries

Reference for `gameplay_crashTest_crashTestBoundaries`, which manages spatial boundaries for crash test missions. Checks whether the player vehicle is inside designated zones and triggers out-of-bound

On this page

Public APIDependenciesVehicle SelectionHow It WorksSpawn SequenceHooksNotesModule VariablesSee Also