API Referenceconsole
BeamConsole Folder Overview
Console scripts for BeamNG.drive - benchmarks, tests, and utilities run outside the game engine in headless/console mode.
Console scripts for BeamNG.drive - benchmarks, tests, and utilities run outside the game engine in headless/console mode.
File Categories
Core Benchmark Module
- bananabench.lua - Core physics benchmark module (MBeams/s measurement). The only file that exports a proper module (
M).
Benchmark Runners (use bananabench)
- bananabench-print.lua - Run benchmark, print to console
- bananabench-json.lua - Run benchmark, save to JSON file
- bananabench-csv.lua - Run ALL vehicles, export CSV
- bananabench-xml.lua - Run predefined vehicles, export XML for CI
- bananabench-async.lua - Coroutine-based variant for frame-by-frame execution
Standalone Benchmarks
- benchphysics.lua - Legacy physics scaling benchmark (CSV output)
- json-performance.lua - Serialization format comparison (JSON vs lpack vs string.buffer)
Tests
- unittests.lua - vec3 math correctness and performance tests
- servertests.lua - Test runner entry point (loads unittests)
- test.lua - Development test file (vehicle loading, JSON parsing)
- simtest.lua - Timed physics simulation (100 steps)
- test_dyncol.lua - Dynamic collision endurance test (5000 steps)
- simpleload.lua - Minimal vehicle spawn smoke test
Utilities
- main.lua - Console environment bootstrap (package paths, core requires)
- resave-pcs.lua - Re-save all vehicle .pc configuration files
Common Patterns
- Most scripts are standalone (no module return) - they auto-execute on
require/rerequire - Only
bananabench.luareturns a proper module table - Scripts use
BeamEngineglobal for physics,HighPerfTimerfor timing vec3/Vector3for position vectorsrerequireused instead ofrequirefor reloadable scripts
benchphysics Reference
Script defined in `lua/console/benchphysics.lua`. Simple legacy physics scaling benchmark that measures per-frame delay as vehicle count increases, outputting results to CSV.
json-performance Reference
Script defined in `lua/console/json-performance.lua`. Comprehensive serialization performance benchmark comparing JSON, lpack, lpack binary, and string.buffer encode/decode speeds.