RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage

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 Extensionsflowgraph

Flowgraph Manager

Top-level controller for a single flowgraph project. Manages multiple graphs (parent-child hierarchy), unique ID allocation, execution lifecycle (start/stop/pause), editor integration, node selection,

Top-level controller for a single flowgraph project. Manages multiple graphs (parent-child hierarchy), unique ID allocation, execution lifecycle (start/stop/pause), editor integration, node selection, copy/paste, serialization, and module management.

No public module exports - instantiated internally by core_flowgraphManager.


Purpose

The manager is the root object for a flowgraph. It:

  • Owns all graphs, macros, and their nodes/links/pins
  • Allocates globally unique IDs across the project
  • Drives execution: triggers root graph, updates modules, handles hooks
  • Provides editor operations: selection, clipboard, undo history
  • Serializes/deserializes the entire project to/from JSON

Class (C) - Key Methods

Lifecycle

MethodDescription
init(parent)Initializes graphs, macros, modules, ID counters, execution state.
attach(fgEditor)Binds to the flowgraph editor UI.
detached()Clears selection state when editor closes.

ID Management

MethodDescription
getNextFreeGraphNodeId()Scans all graphs/macros for an unused ID. Used for nodes and graphs.
getNextFreePinLinkId()Scans all pins/links for an unused ID. Counts down from 2^29.
checkDuplicateId(id)Debug check for ID collisions across all graphs and macros.
getGraphNodeOffset()Returns the current max ID offset for safe ID allocation.
autoGraphNodeOffset()Scans all IDs to compute the maximum used ID.

Execution

MethodDescription
start()Begins execution: initializes modules, plans execution order, triggers executionStarted.
stop()Stops execution: triggers executionStopped on all modules and nodes.
pause() / resume()Pauses/resumes execution.
step()Advances one frame while paused.

Graph Management

MethodDescription
createGraph(name)Creates a new graph in the project.
deleteGraph(graph)Removes a graph and its children.
createSubgraphFromSelection(asMacro)Groups selected nodes into a subgraph or macro.

Editor Operations

MethodDescription
copyNodes()Copies selected nodes to clipboard.
pasteNodes()Pastes nodes from clipboard into current graph.
deleteSelection()Deletes all selected nodes and links.
unselectAll()Clears node and link selection.

Key Properties

PropertyTypeDescription
idnumberUnique manager ID.
graphstable{[id] = graphObj} - all graphs in the project.
macrostable{[id] = graphObj} - all macro graphs.
modulestableOrdered list of active modules (action, button, camera, etc.).
runningStatestring"stopped", "running", or "paused".
allowEditingboolWhether the editor can modify nodes/links.
frameCountnumberCurrent execution frame counter.
activitytableReference to the associated mission/activity, if any.
selectedNodestable{[id] = true} - currently selected node IDs.
selectedLinkstable{[id] = true} - currently selected link IDs.
groupHelperGroupHelperHelper for group/ungroup operations.

Module System

Modules are manager-level service components sorted by moduleOrder:

-- Modules are initialized during manager setup:
-- action, aiRecording, button, camera, drift, file, foreach, level, mission, ...

-- Access a module:
local buttonModule = mgr:getModule("button")
buttonModule:addButton({ label = "Go", style = "default" })

Serialization

-- Manager serializes the full project:
local data = mgr:serialize()
-- Returns: { graphs = {...}, macros = {...}, variables = {...}, ... }

mgr:deserialize(data)
-- Rebuilds all graphs, nodes, links, and modules from saved data

Usage Context

-- Managers are created/accessed via core_flowgraphManager:
local mgr = core_flowgraphManager.loadManager(filePath)
mgr:start()

-- Or get an existing running manager:
local mgr = core_flowgraphManager.getManagerByID(id)
local module = core_flowgraphManager.getManagerModule(mgrId, "camera")

Additional Exports

setupStateGraph(empty)

  • empty - any
  • Returns: any

createGraphAsState(name, isStateGraph)

  • name - any
  • isStateGraph - any
  • Returns: any

createGroupState(name)

  • name - any
  • Returns: any

createStateFromLibrary(data)

  • data - any
  • Returns: any

selectGraph(graph)

  • graph - any

copyGraph(oldGraph, newName, hidden)

  • oldGraph - any
  • newName - any
  • hidden - any
  • Returns: any

convertToMacro(graph)

  • graph - any
  • Returns: any

refreshIntegratedPins(node)

  • node - any

findIntegratedNode(graph)

  • graph - any
  • Returns: any

updateSubgraphs(graph)

  • graph - any

updateInstances(macro)

  • macro - any

saveMacro(macro, savedata)

  • macro - any
  • savedata - any

createNewMacroNode(path)

  • path - any

createInstanceFromMacro(macro, node, forceId)

  • macro - any
  • node - any
  • forceId - any
  • Returns: any

createMacroInstanceFromPath(path, node)

  • path - any
  • node - any
  • Returns: any

setupCreationWorkflow()

creationWorkflow()

DrawTypeIcon(dataType, connected, alpha, typeIconSize, innercolor)

  • dataType - any
  • connected - any
  • alpha - any
  • typeIconSize - any
  • innercolor - any

deletionWorkflow()

updateEditorSelections()

findLinkIdFromHiddenLinkId(hiddenId)

  • hiddenId - any
  • Returns: nil

onDragStarted()

onDrag()

onDragEnded()

dragDropTarget(payloadType)

  • payloadType - any

dragDropSource(payloadType, data)

  • payloadType - any
  • data - any

goToHistory(index)

  • index - any

redo()

historySnapshot(title)

  • title - any

deleteSelectionButton()

draw(dtReal, dtSim, dtRaw)

  • dtReal - any
  • dtSim - any
  • dtRaw - any

getAvailableMacros()

  • Returns: any

getAvailableStateTemplates()

  • Returns: any

getAvailableNodeTemplates()

  • Returns: any

getCustomNodeTemplates()

  • Returns: table

clearGraph(graph)

  • graph - any

deleteGraphs()

getNextUniqueIdentifier()

  • Returns: any

updateEditorPosition(force)

  • force - any

updateNodePositions()

findMacrosUsedInChildren(graph, list)

  • graph - any
  • list - any

findDependencyMap(serializedMacros)

  • serializedMacros - any

createSubgraphFromMacroInstance()

resolveHooksAndReset()

onUpdate(dtReal, dtSim, dtRaw)

  • dtReal - any
  • dtSim - any
  • dtRaw - any

logEvent(name, type, description, meta)

  • name - any
  • type - any
  • description - any
  • meta - any

getHooklist()

  • Returns: any

getDependencies()

  • Returns: any

checkCompileWarnings()

setRunning(running, stopInstant)

  • running - any
  • stopInstant - any

setPaused(paused)

  • paused - any

queueForRestart()

destroy()

getGraphByName(name)

  • name - any
  • Returns: nil

resolveVariableChanges()

broadcastCall(functionName, ...)

  • functionName - any
  • ... - any

broadcastCallReturn(functionName, ...)

  • functionName - any
  • ... - any
  • Returns: any

hasNodeForHook(functionName)

  • functionName - any
  • Returns: boolean

blocksOnResetGameplay()

  • Returns: any

allNodes()

  • Returns: any

onClientEndMission()

getRelativeAbsolutePath(p, disableLogEntryOnFail)

  • p - any
  • disableLogEntryOnFail - any
  • Returns: any

See Also

  • Flowgraph Base Module - Related reference
  • Flowgraph Base State Node - Related reference
  • Flowgraph Base Node - Related reference
  • FlowGraph Guide - Guide

Flowgraph Link

Represents a connection between two pins in a flowgraph graph. Handles link initialization, drawing (including flow animation markers), tooltips, serialization, and quick-access conversion.

New Node Template

Template file demonstrating the structure for creating new flowgraph nodes. Shows all available pin types, node metadata fields, and the minimal `work()` entry point.

On this page

PurposeClass (C) - Key MethodsLifecycleID ManagementExecutionGraph ManagementEditor OperationsKey PropertiesModule SystemSerializationUsage ContextAdditional ExportssetupStateGraph(empty)createGraphAsState(name, isStateGraph)createGroupState(name)createStateFromLibrary(data)selectGraph(graph)copyGraph(oldGraph, newName, hidden)convertToMacro(graph)refreshIntegratedPins(node)findIntegratedNode(graph)updateSubgraphs(graph)updateInstances(macro)saveMacro(macro, savedata)createNewMacroNode(path)createInstanceFromMacro(macro, node, forceId)createMacroInstanceFromPath(path, node)setupCreationWorkflow()creationWorkflow()DrawTypeIcon(dataType, connected, alpha, typeIconSize, innercolor)deletionWorkflow()updateEditorSelections()findLinkIdFromHiddenLinkId(hiddenId)onDragStarted()onDrag()onDragEnded()dragDropTarget(payloadType)dragDropSource(payloadType, data)goToHistory(index)redo()historySnapshot(title)deleteSelectionButton()draw(dtReal, dtSim, dtRaw)getAvailableMacros()getAvailableStateTemplates()getAvailableNodeTemplates()getCustomNodeTemplates()clearGraph(graph)deleteGraphs()getNextUniqueIdentifier()updateEditorPosition(force)updateNodePositions()findMacrosUsedInChildren(graph, list)findDependencyMap(serializedMacros)createSubgraphFromMacroInstance()resolveHooksAndReset()onUpdate(dtReal, dtSim, dtRaw)logEvent(name, type, description, meta)getHooklist()getDependencies()checkCompileWarnings()setRunning(running, stopInstant)setPaused(paused)queueForRestart()destroy()getGraphByName(name)resolveVariableChanges()broadcastCall(functionName, ...)broadcastCallReturn(functionName, ...)hasNodeForHook(functionName)blocksOnResetGameplay()allNodes()onClientEndMission()getRelativeAbsolutePath(p, disableLogEntryOnFail)See Also