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

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 Extensionsgameplay

Parking System

Reference for `gameplay_parking`, which manages spawning, positioning, and recycling of AI parked vehicles using parking spot site data and vehicle active pooling.

Reference for gameplay_parking, which manages spawning, positioning, and recycling of AI parked vehicles using parking spot site data and vehicle active pooling.


Module Exports (M)

State & Setup

FunctionSignatureDescription
setState(val)Activates or deactivates the parking system
getState() → boolReturns active state
setSites(data)Sets custom sites data (filepath string or table)
setupVehicles(amount, options) → boolSpawns parked vehicles via multiSpawn
activate(vehIds, ignoreScatter)Activates vehicles as parked cars
deactivate()Deactivates all parked vehicles
deleteVehicles(amount?)Deletes parked vehicles
resetAll()Full reset of parking system

Vehicle Management

FunctionSignatureDescription
insertVehicle(id)Registers a vehicle as parked
removeVehicle(id)Unregisters a vehicle
getParkedCarsAmount(activeOnly?) → numberCount of parked vehicles
getParkedCarsList() → tableArray of parked vehicle IDs
getParkedCarsData() → tablePer-vehicle parking data
moveToParkingSpot(vehId, parkingSpot, lowPrecision)Teleports vehicle to a parking spot
forceTeleport(vehId, psList, minDist, maxDist)Forces vehicle to a new spot
scatterParkedCars(vehIds, minDist, maxDist)Randomly redistributes all parked cars

Parking Spots

FunctionSignatureDescription
getParkingSpots() → tableReturns all parking spots from sites data
findParkingSpots(pos, minRadius, maxRadius) → tableFinds spots sorted by distance
filterParkingSpots(psList, filters) → tableFilters by probability, time-of-day, vehicles
getRandomParkingSpots(originPos, min, max, count, filters) → tableRandom selection with distance bias
checkParkingSpot(vehId, parkingSpot) → boolChecks if spot is available and fits vehicle
getCurrentParkingSpot(vehId) → id|nilReturns spot ID if vehicle is properly parked

Tracking (Player Vehicle)

FunctionSignatureDescription
enableTracking(vehId, autoDisable)Starts tracking parking status for a driven vehicle
disableTracking(vehId)Stops tracking
getTrackingData() → tableReturns all tracked vehicle data

Configuration

FunctionSignatureDescription
setParkingVars(data, reset?)Sets parking variables
getParkingVars() → tableGets current parking variables
setActiveAmount(amount)Sets max visible parked vehicles

Aliases

FunctionSignatureDescription
processVehicles(vehIds, ignoreScatter)Alias for activate

Hooks / Lifecycle

FunctionDescription
onUpdatePer-frame: tracks parking status, recycles parked vehicles
onVehicleActiveChangedHandles teleport flags when vehicles activate/deactivate in pool
onVehicleDestroyedRemoves destroyed vehicle from parking data
onVehicleGroupSpawnedActivates parking after autoParking multiSpawn completes
onClientStartMissionSets worldLoaded flag
onClientEndMissionFull reset of parking system
onSerializeSerializes parking state for hot-reload
onDeserializedRestores parking state after hot-reload

Module Fields

FieldTypeDefaultDescription
debugLevelnumber0Debug visualization level (0=off, 1=spots, 2=corners, 3=full)

Parking Variables

VariableDefaultDescription
precision0.8Required parking accuracy for valid park
neatness0How precisely AI parks (0 = sloppy, 1 = perfect)
parkingDelay0.5Seconds before a parked position is confirmed
baseProbability0.75Spawn probability per spot (0–1)
activeAmount∞Max simultaneously visible parked cars

Vehicle Placement Logic

local function moveToParkingSpot(vehId, parkingSpot, lowPrecision)
  -- 1. Determine facing: forwards/backwards tag, or random (75%+ forwards)
  -- 2. Unless "perfect" tag: randomize position offset within gap
  --    and rotation offset, scaled by (1 - neatness²)
  -- 3. Teleport to spot via parkingSpot:moveResetVehicleTo()
  -- 4. Set ignition to 0
  -- 5. Enable/disable map tracking based on "street" tag
  -- 6. Optionally randomize paint
end

Recycling System (onUpdate)

Each frame, one parked vehicle is checked for recycling:

  1. Check if vehicle is far enough from all non-parked vehicles
  2. Account for player direction and speed for activeRadius
  3. If too far: processNextSpawn() cycles the vehicle pool and teleports to a new spot ahead of the player
  4. Parking spot search is throttled: only re-queries when the look-ahead point moves far enough from the last check

Tracking Events

EventTrigger
enterVehicle corners enter a parking spot
exitVehicle leaves the parking spot area
validVehicle properly parked for parkingDelay seconds
invalidPreviously parked vehicle moved out of position
M.activate(vehIds, ignoreScatter)
M.checkParkingSpot(vehId, parkingSpot)
M.deactivate()
M.debugLevelvalue
M.deleteVehicles(amount)
M.dependenciesvalue
M.disableTracking(vehId)
M.enableTracking(vehId, autoDisable)
M.filterParkingSpots(psList, filters)
M.findParkingSpots(pos, minRadius, maxRadius)
M.forceTeleport(vehId, psList, minDist, maxDist)
M.getCurrentParkingSpot(vehId)
M.getParkedCarsAmount(activeOnly)
M.getParkedCarsData()
M.getParkedCarsList()
M.getParkingSpots()
M.getParkingVars()
M.getRandomParkingSpots(originPos, minDist, maxDist, minCount, filters)
M.getState()
M.getTrackingData()
M.insertVehicle(id)
M.moveToParkingSpot(vehId, parkingSpot, lowPrecision)
M.onClientEndMission()
M.onClientStartMission()
M.onDeserialized(data)
M.onSerialize()
M.onUpdate(dt, dtSim)
M.onVehicleActiveChanged(vehId, active)
M.onVehicleDestroyed(id)
M.onVehicleGroupSpawned(vehList, groupId, groupName)
M.processVehicles(vehIds, ignoreScatter)
M.removeVehicle(id)
M.resetAll()
M.scatterParkedCars(vehIds, minDist, maxDist)
M.setActiveAmount(amount)
M.setParkingVars(data, reset)
M.setSites(data)
M.setState(val)
M.setupVehicles(amount, options)

Hook: onVehicleParkingStatus(vehId, trackingData)


Key Behaviors

  • Sites data loaded from city.sites.json in the current level (via gameplay_city)
  • Uses core_vehicleActivePooling for efficient vehicle show/hide management
  • Probability filtering accounts for time-of-day (day spots more likely at noon, night spots at midnight)
  • Spawned vehicles use propparked filter and level region for vehicle selection
  • Default parking spot size check: 2.5 × 6 × 3 meters
  • Free camera height increases the look-ahead distance for parking spot search
  • Vehicles tagged with ignoreForceTeleport won't be recycled

See Also

  • Gameplay Achievement - Related reference
  • Gameplay City - Related reference
  • discover - Discover / Experience System - Related reference
  • Gameplay Systems Guide - Guide

Marker Interaction

Central system for rendering and interacting with playmode markers (mission markers, parking spots, gas stations, etc.). Manages marker visibility, speed-based interaction gating, activity prompts, na

Gameplay Playmode Markers

Clusters POI data into playmode marker groups (missions, parking, zones, walking, gas stations, drift lines, etc.) and provides spatial queries via a KD-tree for efficient visibility lookups.

On this page

Module Exports (M)State & SetupVehicle ManagementParking SpotsTracking (Player Vehicle)ConfigurationAliasesHooks / LifecycleModule FieldsParking VariablesVehicle Placement LogicRecycling System (onUpdate)Tracking EventsKey BehaviorsSee Also