RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Ambient SoundUI Apps ManagerUI AudioBindings LegendCamera Distance AppDeveloper ConsoleCredits MusicExternal WebSocket ServerFade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsNavigation Map DataVehicle Paint EditorVehicle Vicinity AppUI Visibility
Generic Mission Data AppPoints Bar App
Minimap Additional InfoMinimap LayersMinimap RendererMinimap RoadsMinimap RouteMinimap Topographic MapMinimap UtilitiesMinimap Vehicles

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 Extensionsuiappsminimap

Minimap Roads

Renders navgraph road segments on the minimap with spatial culling.

Renders navgraph road segments on the minimap with spatial culling.


Overview

ui_apps_minimap_roads draws navgraph road links as colored line segments on the minimap. It builds a kd-tree spatial index on first call, then queries visible roads each frame for efficient rendering.

Extension path: lua/ge/extensions/ui/apps/minimap/roads.lua


Exports (M)

FunctionSignatureDescription
drawRoads(p, radius, td, debugSettings, camPos, scale, dpi)Main draw function - builds cache on first call, then renders visible roads.
reset()Clears cached kd-tree and road data (call on map change).

Internals

First-Call Initialization

On the first call to drawRoads, the module:

  1. Iterates all map.getMap().nodes and their links
  2. Skips links with hiddenInNavi = true
  3. Stores link data in a flat array: [x1, y1, x2, y2, color] per link
  4. Builds a kdtreebox2d spatial index with bounding boxes per link
  5. Colors roads by drivability:
    • ≥ 0.9 → main road color
    • > 0.25 → low drivability color
    • ≤ 0.25 → lowest drivability color

Per-Frame Rendering

After initialization, each frame:

for lIdx in kdNodes:queryNotNested(camPos.x-radius, camPos.y-radius, camPos.x+radius, camPos.y+radius) do
  local s1X, s1Y = worldToMapXY(links[lIdx], links[lIdx+1])
  local s2X, s2Y = worldToMapXY(links[lIdx+2], links[lIdx+3])
  -- Draw background stroke (dark outline)
  td:lineRoundEnd(s1X, s1Y, s2X, s2Y, bgWidth, bgWidth, 0, bgColor, bgColor, 0, 0, 0, layers.ROADS_BG)
  -- Draw foreground (colored road)
  td:lineRoundEnd(s1X, s1Y, s2X, s2Y, fgWidth, fgWidth, 0, color, color, 0, 0, 0, layers.ROADS_FG)
end

Road Styling

Roads use constant-width rendering (not scaled to road radius):

  • Background width: 2 * scaleInverse * dpi + 2 * dpi - dark outline
  • Foreground width: 2 * scaleInverse * dpi - colored fill

Color sets come from ui_apps_minimap_utils.getStyleColorSet().

Fallback Grid

If no roads exist and grid drawing is disabled, the module calls ui_apps_minimap_utils.drawGrid() as a fallback visual reference.


How It Works

  1. First drawRoads call builds a kd-tree from all navgraph links
  2. Each frame, queries the kd-tree for links within the visible radius
  3. Draws each visible link as a two-layer line (outline + fill)
  4. reset() clears the cache for map transitions

Additional Exports

The following exports are available but not yet documented in detail:

  • M.drawRoads
  • M.reset

See Also

  • Minimap Additional Info - Related reference
  • Minimap Layers - Related reference
  • Minimap (Main) - Related reference
  • UI System Guide - Guide

Minimap Renderer

Main minimap renderer - manages the ImGui window, camera transforms, and orchestrates all minimap sub-modules.

Minimap Route

Renders the navigation route and off-screen route pointer on the minimap.

On this page

OverviewExports (M)InternalsFirst-Call InitializationPer-Frame RenderingRoad StylingFallback GridHow It WorksAdditional ExportsSee Also