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
C2 WebSocket Handler
C2 Tile ManagerC2 Vehicle Manager

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 Extensionsc2panelPlugins

C2 Vehicle Manager

Real-time vehicle data streaming plugin for the C2 WebSocket system. Subscribers receive position, rotation, and velocity updates each frame.

Real-time vehicle data streaming plugin for the C2 WebSocket system. Subscribers receive position, rotation, and velocity updates each frame.


Overview

WebSocket panel plugin that streams vehicle telemetry to connected peers. Supports single-vehicle (player) subscriptions and all-vehicle broadcasts including traffic/parked status detection.


Public API

FunctionArgsReturnsDescription
M.onC2WebSocketHandlerMessageparams-Handles subscribe/unsubscribe WebSocket messages
M.onUpdatedt-Sends vehicle data to all active subscribers each frame

WebSocket Messages (Inbound)

Message TypeFieldsDescription
subscribePlayervid (optional)Subscribe peer to a specific vehicle (default: player 0)
subscribeAllVehicles-Subscribe peer to all vehicle data
unsubscribePlayer-Unsubscribe peer from vehicle data

WebSocket Messages (Outbound)

Message TypeFieldsDescription
playerDatapos, rot, vel, isPlayer, isTraffic, isParkedSingle vehicle data (legacy format)
allVehiclesDatavehicles[]Array of all vehicle data objects

Vehicle Data Fields

FieldTypeDescription
idnumberVehicle object ID
pos{x, y, z}World position
rot{x, y, z, w}Quaternion rotation (computed from direction + up vectors)
vel{x, y, z}Velocity vector
isPlayerbooleanWhether this is the player's active vehicle
isTrafficbooleanWhether vehicle is AI traffic (via gameplay_traffic)
isParkedbooleanWhether vehicle is parked (via gameplay_parking)

Usage Example

-- Subscribe to player vehicle via WebSocket:
-- Send: {"type": "subscribePlayer", "vid": 12345}
-- Receive each frame: {"type": "playerData", "pos": {...}, "rot": {...}, ...}

-- Subscribe to all vehicles:
-- Send: {"type": "subscribeAllVehicles"}
-- Receive: {"type": "allVehiclesData", "vehicles": [{...}, {...}]}

Notes

  • Data is only gathered when there are active subscribers (performance optimization)
  • If any subscriber wants all vehicles, the full vehicle list is fetched once and shared
  • Duplicate vehicle data is avoided when multiple peers watch the same vehicle
  • Traffic detection uses gameplay_traffic.getTrafficList()
  • Parking detection uses gameplay_parking.getParkedCarsData()
  • Rotation is computed from getDirectionVectorXYZ() and getDirectionVectorUpXYZ()
  • Sends are wrapped in pcall for resilience against disconnected peers

See Also

  • C2 WebSocket Handler - WebSocket server routing
  • C2 Tile Manager - Scene tile data streaming

C2 Tile Manager

Spatial hash tile index for scene objects, forest items, decals, road markings, and AI graph nodes. Provides tile-based scene queries with debug visualization and WebSocket data export.

Campaign System

Core campaign orchestration module. Manages campaign lifecycle, scenario sequencing, location status tracking, rewards, achievements, and UI flow between campaign scenarios and exploration.

On this page

OverviewPublic APIWebSocket Messages (Inbound)WebSocket Messages (Outbound)Vehicle Data FieldsUsage ExampleNotesSee Also