API ReferenceGE Extensionsutil
Compile Imposters
Batch imposter compilation tool that iterates through levels and triggers imposter texture updates.
Batch imposter compilation tool that iterates through levels and triggers imposter texture updates.
Overview
util_compileImposters loads levels one-by-one in freeroam mode and calls Engine.Render.updateImposters(true) to regenerate imposter textures. Uses the job system for async level loading and waiting. Designed for build pipelines.
Extension path: lua/ge/extensions/util/compileImposters.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
compileImposters | (queue) | Starts imposter compilation for a list of level names. |
onInit | () | Sets unload mode to manual. |
onPreRender | (dt) | Manages log cooldown timer and timeout shutdown. |
onModManagerReady | (mod) | Signals that mods are activated. |
onConsoleLog | (timer, lvl, origin, line) | Resets log cooldown on any console output. |
Internals
Compilation Pipeline
- Waits for
core_levelsandfreeroam_freeroamto initialize. - Waits for mod manager activation.
- Sleeps 10 seconds for system stabilization.
- For each level in the queue:
- Calls
freeroam_freeroam.startFreeroamByName(levelName). - Waits for the level and player vehicle to be ready.
- Sleeps 120 seconds for full level load.
- Waits for console log activity to cease (cooldown).
- Calls
Engine.Render.updateImposters(true). - Sleeps 20 seconds, then waits for log activity to cease again.
- Calls
Timeout Safety
onPreRenderincrements a frame counter. If it exceeds 6000 frames without reset, the game shuts down.- Frame counter resets when moving to a new level or after each wait cycle.
Log Cooldown
Console log activity resets logCooldown to 6000. The system waits until cooldown reaches 0 (no log output) before proceeding, ensuring rendering operations have completed.
How It Works
- Call
compileImposters()with an array of level names. - The system loads each level sequentially.
- After each level loads fully, imposters are updated.
- The process continues until all levels are done.
Lua Examples
-- Compile imposters for specific levels
extensions.util_compileImposters.compileImposters({
"west_coast_usa",
"east_coast_usa",
"italy"
})
-- Only one job can run at a time; calling again while active returns falseAdditional Exports
M.compileImposters- (undocumented)M.onConsoleLog- (undocumented)M.onInit- (undocumented)M.onModManagerReady- (undocumented)M.onPreRender- (undocumented)