RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorVehicle ExporterFollow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track GeneratorRectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot CreatorShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files SyntaxVehicle Rope DebugBatch WorkerWebSocket Test

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)

See Also

  • Auto Annotation - Related reference
  • Booster - Related reference
  • Calibrate ESC - Related reference
  • Game Engine Overview - Guide

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 ExportsSee Also