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

Map Tiles

Generates orthographic map tile images at multiple zoom levels for use with web map viewers (e.g., Leaflet). Includes an ImGui control panel with progress tracking.

Generates orthographic map tile images at multiple zoom levels for use with web map viewers (e.g., Leaflet). Includes an ImGui control panel with progress tracking.


Overview

util_maptiles renders the current level from a top-down orthographic camera at multiple zoom levels, producing a tile pyramid suitable for slippy map viewers. Exports tile images as PNG, a metadata JSON file, and an optional navgraph overlay.

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


Exports (M)

FunctionSignatureDescription
onUpdate(dtReal, dtSim, dtRaw)Main update loop: renders tiles and UI.

Internals

Tile Generation Parameters

ParameterDefaultDescription
baseTileSize1000World units per tile at zoom 0.
basePixelSize512Pixel resolution per tile.
maxZoomLevel5Maximum zoom level (0 = most zoomed out).
framesPerTile2Frames to wait before capturing each tile.
outputDirectory"tiles"Base output directory.

Rendering Setup

Before generation, rendering settings are adjusted for quality:

  • TS::detailAdjust → 20000 (max mesh detail)
  • Terrain::lodScale → 0.00001 (max terrain detail)
  • groundCoverScale → 8 (dense vegetation)
  • Shadows disabled (sunsky.castShadows = false)
  • Shadow texture minimized (texSize = 64)

Settings are restored after completion.

Tile Grid

For each zoom level, tile size = baseTileSize / 2^zoomLevel:

  • Tiles are generated left-to-right, top-to-bottom.
  • Each tile uses an orthographic RenderView positioned above its center.
  • Terrain height is determined by raycasting at tile center.

Output Structure

tiles/
  {levelName}/
    {zoom}/{x}/{y}.png
  metadata.json
  navgraph.json (optional)

Metadata

{
  "levelName": {
    "baseTileSize": 1000,
    "basePixelSize": 512,
    "maxZoomLevel": 5,
    "terrainSizeUnits": 4000,
    "tileGrid": {
      "0": { "tileSizeUnits": 1000, "pixelSize": 512, "tilesX": 4, "tilesY": 4 }
    }
  }
}

Navgraph Export

exportNavgraph() converts the road network into polygon data:

  • Each road link becomes a quad (4 points) sized by node radii.
  • Coordinates are transformed to tile-space.
  • Color-coded by drivability level.
  • Output: tiles/navgraph.json.

ImGui Interface

  • Progress grid: Color-coded tile status (grey=pending, yellow=current, green=done).
  • Preview: Live render view of the current tile.
  • ETA: Estimated time remaining based on average per-tile time.
  • Debug panel: 3D world toggle, zoom level selector, manual tile stepping.

How It Works

  1. Load: extensions.load('util_maptiles').
  2. Open the ImGui window and click "Start Tile Generation".
  3. The system iterates through zoom levels 0→5, rendering each tile.
  4. Tiles are saved as PNG files in the output directory.
  5. Metadata JSON is written on completion.

Lua Examples

-- Load the map tile utility
extensions.load('util_maptiles')

-- The UI handles all interaction
-- Navgraph can be exported separately via the UI button

-- Coordinate conversion (for custom overlay integration):
-- Game coords → export coords: flip Y, offset by bounds, scale by pixel/tile ratio

Additional Exports

  • M.onUpdate - (undocumented)

Log Streams

Simple file I/O helper for reading and writing logged stream data in JSON, wikitable, and reStructuredText formats.

Node Beam Export

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

On this page

OverviewExports (M)InternalsTile Generation ParametersRendering SetupTile GridOutput StructureMetadataNavgraph ExportImGui InterfaceHow It WorksLua ExamplesAdditional Exports