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
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorExport (glTF)Follow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track (Gymkhana Generator)Rectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot Creator (Vehicle Thumbnails)ShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files Syntaxutil/vehicleRopeDebug - Rope Physics Debug UIutil/worker - Batch Job Workerutil/wsTest - WebSocket Test Server

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 Extensionsutil

Node Stream

WebSocket server that streams real-time vehicle node positions to connected clients. Also serves initial node positions and flexbody mapping data on request.

WebSocket server that streams real-time vehicle node positions to connected clients. Also serves initial node positions and flexbody mapping data on request.


Overview

util_nodeStream creates a WebSocket server on port 8088 that broadcasts vehicle node positions at a configurable interval (default 100ms). Clients can request initial node positions, flexbody mapping data, or load extensions remotely. Designed for external visualization tools.

Extension path: lua/ge/extensions/util/nodeStream.lua


Exports (M)

FunctionSignatureDescription
onExtensionLoaded()Creates WebSocket server on port 8088.
onExtensionUnloaded()Destroys the WebSocket server.
onUpdate(dt)Processes WebSocket events and broadcasts node data.

Internals

WebSocket Protocol

Clients send JSON messages with a type field:

Message TypeDirectionDescription
startNodeStreamClient → ServerActivates periodic node broadcasting.
stopNodeStreamClient → ServerDeactivates node broadcasting.
getInitialNodePositionsClient → ServerRequests initial (undeformed) node positions.
getFlexbodyMappingDataClient → ServerRequests flexbody mesh mapping parameters.
loadExtensionClient → ServerLoads a GE extension by name.
vehicleNodesServer → ClientPeriodic node position broadcast.
initialNodePositionsServer → ClientInitial positions relative to ref node.
flexbodyMappingDataServer → ClientFlexbody mesh/node mapping info.

Node Position Format

Positions are converted to Z-up coordinates:

{
  "type": "vehicleNodes",
  "nodes": {
    "0": {"x": 1.0, "y": 0.5, "z": -0.3},
    "1": {"x": 1.2, "y": 0.6, "z": -0.2}
  }
}

Conversion: x = x, y = z, z = -y

Initial Node Positions

Returned relative to the reference node (usually node 0):

{
  "type": "initialNodePositions",
  "nodes": {
    "0": {"x": 0, "y": 0, "z": 0},
    "1": {"x": 0.2, "y": 0.1, "z": 0.1}
  }
}

Flexbody Mapping Data

Includes mesh name, group nodes, position/rotation/scale, and flatMap:

{
  "type": "flexbodyMappingData",
  "flexbodies": {
    "0": {
      "mesh": "pickup_body",
      "groupNodes": [...],
      "pos": {...},
      "rot": {...},
      "scale": {...}
    }
  }
}

Stream Interval

Default: 0.1 seconds (10 Hz). The timer accumulates dt and broadcasts when threshold is reached.

Event Handling

The server processes peer events each frame:

  • "C": Client connected (logged).
  • "DC": Client disconnected (logged).
  • "D": Data received - decoded as JSON and routed to handlers.
  • "ping" messages receive "pong" responses.

Unrecognized messages are forwarded via extensions.hook("onWebSocketHandlerMessage", ...).


How It Works

  1. Load: extensions.load('util_nodeStream').
  2. Connect a WebSocket client to ws://127.0.0.1:8088.
  3. Send {"type": "startNodeStream"} to begin receiving position updates.
  4. Optionally request initial positions or flexbody data.
  5. Unload the extension to stop the server.

Lua Examples

-- Load the node stream server
extensions.load('util_nodeStream')

-- Server starts automatically on port 8088
-- Connect with any WebSocket client:
-- ws://127.0.0.1:8088

-- Example client messages (JSON):
-- {"type": "startNodeStream"}
-- {"type": "getInitialNodePositions"}
-- {"type": "getFlexbodyMappingData"}
-- {"type": "loadExtension", "extensionName": "util_someExtension"}

Additional Exports

  • M.onExtensionLoaded - (undocumented)
  • M.onExtensionUnloaded - (undocumented)
  • M.onUpdate - (undocumented)

Node Beam Export

Minimal exporter that dumps the current vehicle's node positions and beam connections to a JSON file.

Photomode

Provides overlay file listing for the photo mode UI.

On this page

OverviewExports (M)InternalsWebSocket ProtocolNode Position FormatInitial Node PositionsFlexbody Mapping DataStream IntervalEvent HandlingHow It WorksLua ExamplesAdditional Exports