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 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.

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.


Overview

Builds a lightweight spatial index by dividing the game world into square tiles. Objects are assigned to tiles based on their world-space bounding boxes. Supports debug visualization via ImGui and serves tile data over WebSocket for external tools.


Public API

FunctionArgsReturnsDescription
M.onExtensionLoaded--Builds initial tile index on extension load
M.onMissionLoaded--Rebuilds tile index when a mission loads
M.onPreRenderdt-ImGui debug window and debug drawing each frame
M.onSerialize-tableSerializes debug state for hot-reload
M.onDeserializeddata-Restores debug state after hot-reload
M.showWindow--Opens the ImGui debug window
M.onC2WebSocketHandlerMessageargs-Handles WebSocket tile data requests

WebSocket Messages

Message TypeDirectionDescription
buildTileDataInRebuild tile index (optional tileSize param)
getTileCacheInfoInRequest tile grid metadata (bounds, size)
getSceneTileInRequest detailed data for tile at (tileX, tileY)
tileCacheInfoOutResponse with tile grid bounds and size
sceneTileDataOutFull tile data (objects, forest, decals, markings, AI nodes)

Tile Data Structure

Each tile contains:

FieldTypeDescription
objectsarrayScene objects with pos, rot, scale, bounding box
forestItemsarrayForest vegetation items with mesh path
decalsarrayDecal instances with material info
roadMarkingsarrayDecalRoad line/parking/crossing markings with node positions
aiNodesarrayAI navigation graph nodes with links and lane data
metadatatableTile coordinates, size, estimated data size in KB

Debug Visualization

The ImGui window (showWindow) provides toggles for:

  • Tile borders and stats overlay
  • Object spheres and OBB wireframes
  • Forest item visualization
  • Decal quads with material text
  • Road marking prisms (parking, crossings, gutters)
  • AI graph with optional lane arrows and drivability coloring
  • 3D tile grid volume rendering

Usage Example

-- Open debug window
extensions.c2_panelPlugins_tileManager.showWindow()

-- Request tile data via WebSocket
-- Send: {"type": "getSceneTile", "tileX": 5, "tileY": -3}
-- Receive: {"type": "sceneTileData", "tileX": 5, "tileY": -3, "data": {...}}

Notes

  • Default tile size is 50 meters (configurable 10–2000)
  • Position data in tiles is stored relative to tile origin for compactness
  • Rotation stored as quaternion {x, y, z, w}
  • Objects spanning >50 tiles in any axis are clamped to prevent degenerate cases
  • Forest items are indexed by radius coverage across tiles
  • Road markings filter for line_*, gutter*, and crossing_* materials
  • Cache is automatically cleared when tile count exceeds 50

See Also

  • C2 WebSocket Handler - WebSocket server that routes messages
  • C2 Vehicle Manager - Real-time vehicle data streaming

C2 WebSocket Handler

Core WebSocket server for the C2 (Command & Control) system. Provides a JSON message bus on localhost for external tools to communicate with the game engine.

C2 Vehicle Manager

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

On this page

OverviewPublic APIWebSocket MessagesTile Data StructureDebug VisualizationUsage ExampleNotesSee Also