RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Editor AI TestsEditor AI VisualizationEditor – Assembly Spline ToolAsset BrowserAsset DeduplicatorAsset Management ToolSFX Previewer (Audio Events List)Audio Ribbon EditorAutoSaveBarriers EditorBiome ToolBuilding EditorBulk RenameCamera BookmarksCamera TransformCamera Path EditorCEF HelperCo-Simulation Signal EditorCrawl Data EditorCreate Object ToolDataBlock EditorDecal EditorDecal Spline EditorDocumentation HelperDrag Race EditorDrift Data EditorDrive Path EditorDynamic Decals Tool (Vehicle Livery Creator)Engine Audio DebugExtensions DebugExtensions EditorFFI Pointer Leak TestFile DialogFlowgraph EditorForest EditorForest ViewEditor Gizmo HelperEditor Ground Model Debug HelperEditor Headless Editor TestEditor Icon OverviewEditor ImGui C DemoEditor InspectorEditor Layout ManagerEditor Level SettingsEditor Level ValidatorEditor LoggerEditor Log HelperEditor MainEditor Main MenuEditor Main ToolbarEditor Main UpdateMap Sensor EditorMaster Spline EditorMaterial EditorMeasures Inspector HeaderMesh Editor (Base)Mesh Road EditorMesh Spline EditorMission EditorMission PlaybookMission Start Position EditorMulti Spawn Manager (Vehicle Groups)Navigation Mesh EditorEditor News MessageObject Tool (Object Select Edit Mode)Object To Spline EditorParticle EditorPerformance Profiler / Camera RecorderPhysics ReloaderPrefab Instance EditorEditor PreferencesRace / Path EditorRally EditorRaycast Test Editor ToolRenderer Components Editor ToolRender Test Editor ToolResource Checker Editor ToolRiver EditorRoad Architect EditorRoad DecorationsRoad Editor (Decal Road)Road Network ExporterRoad River Cache HandlerRoad River GUIRoad Spline EditorRoad Template EditorRoad UtilitiesScene TreeScene ViewScreenshot Creator BootstrapScript AI EditorScript AI ManagerSensor Configuration EditorSensor DebuggerShape EditorShortcut LegendSidewalk Spline EditorSites EditorSlot Traffic EditorSuspension Audio DebugTech Server ManagerTerraform ToolTerrain And Road ImporterTerrain EditorTerrain Materials EditorText EditorTool ManagerTool ShortcutsTraffic DebugTraffic ManagerTraffic Signals EditorUndo History ViewerVehicle Bridge TestVehicle Detail ViewerVehicle Editor MainEditor - VisualizationEditor Viz HelperEditor Water Object HelperEditor Windows Manager
Gen Decal EditorGen Experimental Frame EditorGen Mesh ExplorerGen Experimental SolidFlexGen Mesh ModuleGen Network ModuleGen Region ModuleGen Render ModuleGen Terrain ModuleEditor Gen TestEditor Gen Top (Roof Geometry)Editor Gen UI (Building Architect UI)Editor Gen UtilsEditor Gen World

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 Extensionseditorgen

Gen Region Module

Region-based procedural urban generation system for buildings, blocks, and road layouts.

Region-based procedural urban generation system for buildings, blocks, and road layouts.


Overview

The region module implements procedural generation of urban regions including building placement, block subdivision, road-side structures, and region boundary logic. It works with the decal road system to generate buildings along road networks with configurable dimensions and spacing.


Module Table: R

FieldTypeDescription
ui.spacingnumberUI spacing constant (3)
out.apathtableOutput path array

Generation Parameters

ParameterDefaultDescription
mm_len{10, 20}Front wall length interval (min, max)
mm_depth{6, 16}Building depth interval
mm_space{1.5, 4}Space between buildings
margin2Edge margin

Key Functions

FunctionDescription
forMedian(sfr, sto)Computes median direction vector between two road sides at a junction
toStem(p, side, tip)Projects a point onto a road side's stem direction from a corner

Data Structures

VariableDescription
adecRoad decal array
abaseBase geometry for buildings
aboundBoundary polygons
acrossRoad crossing points
aswitchDirection switch points
anobjGenerated objects
dn2dSide index to node-to-depth map

Dependencies

ModulePath
Utils/lua/ge/extensions/editor/gen/utils

Usage Example

local R = require('/lua/ge/extensions/editor/gen/region')

-- The region module works with the decal road system
-- to place buildings along road sides.
-- Junction medians are computed for proper corner geometry:
local dir = forMedian(sideFrom, sideTo)

-- Project a point onto a road side:
local dist = toStem(point, side, 0)  -- 0=start, 1=end

Exported Fields

FieldTypeDescription
R.outtableOutput data including apath
R.uitableUI state with spacing field

Exported Functions

R.forRoads(p, odec)

Initializes road-side building generation from a position.

  • p (vec3) - Reference position
  • odec (table) - Decal module reference

R.populate(acrs, adecal, odec, oworld, cancel, pt)

Populates buildings along road sides within region boundaries.

  • acrs (table) - Road crossing data
  • adecal (table) - Decal array
  • odec (table) - Decal module
  • oworld (table) - World module
  • cancel (any) - Cancellation flag
  • pt (vec3?) - Optional reference point

R.onUpdate(inj)

Per-frame update callback with injection data.

  • inj (table?) - Optional injection data

R.onSpacing(v)

Adjusts building spacing parameter.

  • v (number) - Spacing value

See Also

  • Gen Decal - Road/decal generation
  • Gen Network - Road network topology
  • Gen Terrain - Terrain manipulation

Gen Network Module

Road network generation and geometric utility module with socket-based communication.

Gen Render Module

Debug rendering utilities for the gen editor framework - paths, points, labels, and circles.

On this page

OverviewModule Table: RGeneration ParametersKey FunctionsData StructuresDependenciesUsage ExampleExported FieldsExported FunctionsR.forRoads(p, odec)R.populate(acrs, adecal, odec, oworld, cancel, pt)R.onUpdate(inj)R.onSpacing(v)See Also