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

Precompile Vehicles

M.dependencies = {'freeroam_freeroam', 'core_vehicles'}

Dependencies

M.dependencies = {'freeroam_freeroam', 'core_vehicles'}

Iterates through a predefined list of vehicles, spawning each on smallgrid with synchronous shader compilation to warm caches.


Overview

util_precompileVehicles is a build-time utility that spawns every vehicle in a hardcoded list (100+ models) one at a time on the smallgrid level, waits 200 frames for shaders to compile, then moves to the next. Quits when done.

Extension path: lua/ge/extensions/util/precompileVehicles.lua Dependencies: freeroam_freeroam, core_vehicles


Exports (M)

FunctionSignatureDescription
onInit()Disables async shaders, filters vehicle list, starts freeroam on smallgrid.
onVehicleSpawned(vehicleId)Marks current vehicle as loaded, starts 200-frame wait.
onClientStartMission()Begins spawning the first vehicle once the level is ready.
onPreRender(dt)Counts down frames, advances to the next vehicle or quits.

Internals

Vehicle List

A hardcoded table vehiclesToLoad maps ~110 model names (e.g. pickup, etk800, vivace, us_semi) to true. Only models also present in core_vehicles.getModelList() are processed.

Flow

  1. onInit - disables async shaders, builds filtered vehicle list, starts smallgrid via freeroam.
  2. onClientStartMission - triggers the first loadNextVehicle() call.
  3. loadNextVehicle - calls core_vehicles.replaceVehicle(model, {}).
  4. onVehicleSpawned - sets loaded = true, frames = 200.
  5. onPreRender - decrements frames; when 0, advances to the next vehicle or calls quit().

State Variables

  • vehicles - filtered array of vehicle model names
  • vehicleToLoad - current 1-based index
  • loaded / frames - control the per-vehicle wait
  • finished - stops onPreRender processing

How It Works

  1. Extension loads, starts smallgrid freeroam.
  2. For each vehicle: spawn → wait 200 frames → next.
  3. After all vehicles, logs completion and exits.

Lua Examples

-- Typically invoked via CLI, not at runtime:
-- beamng.exe -onLevelLoad_ext "util/precompileVehicles"

extensions.load("util/precompileVehicles")

Additional Exports

  • M.onClientStartMission - (undocumented)
  • M.onInit - (undocumented)
  • M.onPreRender - (undocumented)
  • M.onVehicleSpawned - (undocumented)

See Also

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

Precompile Shaders

M.dependencies = {'core_levels'}

Procedural Track Generator

Generates randomized gymkhana / autocross tracks from seed-based procedural parameters.

On this page

DependenciesOverviewExports (M)InternalsVehicle ListFlowState VariablesHow It WorksLua ExamplesAdditional ExportsSee Also