Decal Roads Editor
Debug visualization for AIPath objects in the world editor. Renders lane markings, widths, and directions using dynamic decals and debug drawing.
Debug visualization for AIPath objects in the world editor. Renders lane markings, widths, and directions using dynamic decals and debug drawing.
Overview
util_decalRoadsEditor is a world-editor support module that visualizes AIPath objects with their lanes, directions, and widths. Uses debugDrawer and DynamicDecalMgr to render sphere nodes, prism segments, and directional arrow decals per lane.
Extension path: lua/ge/extensions/util/decalRoadsEditor.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
onExtensionLoaded | () | Logs module loaded. |
onExtensionUnloaded | () | Logs module unloaded. |
onPreRender | (dt) | Renders AIPath debug visualizations every frame. |
Internals
AIPath Visualization
For each AIPath in the scene tree with drivability > 0:
- Node spheres: Drawn at each path node position with the node's radius.
- Segment prisms: Square prisms connecting consecutive nodes, sized by node widths.
- Lane arrows: Dynamic decal arrows per lane showing direction.
Lane Rendering
Each segment is split into lanes based on lanesLeft and lanesRight:
- Left lanes: Drawn in cyan (or red if flipped), direction matches path.
- Right lanes: Drawn in red (or cyan if flipped), direction is reversed.
- Arrows use
art/arrow_waypoint_1.ddsdecal texture. - Arrow spacing matches lane width for consistent visual density.
Distance Fade
Visualization fades based on camera distance:
- Fade start: 400 units (2x internal
fadeStartof 200) - Fade end: 500 units (2x internal
fadeEndof 250) - Below 0.01 visibility, segments are skipped entirely.
Path Properties Used
| Property | Purpose |
|---|---|
drivability | Must be > 0 to render. |
oneWay | Whether the path is one-directional. |
flipDirection | Reverses lane direction assignment. |
lanesLeft / lanesRight | Number of lanes per side. |
Node width | Converted to radius (width * 0.5). |
How It Works
- Module is loaded dynamically by the world editor C++ side.
- Each frame,
onPreRenderiterates allAIPathscene objects. - For each path with valid drivability, nodes and segments are rendered.
- Lanes are drawn with directional arrows using dynamic decals.
Lua Examples
-- This module is typically loaded automatically by the world editor
-- Manual load for debugging:
extensions.load('util_decalRoadsEditor')
-- No public API - visualization is automatic via onPreRenderAdditional Exports
M.onExtensionLoaded- (undocumented)M.onExtensionUnloaded- (undocumented)M.onPreRender- (undocumented)
Config List Generator
Vehicle config list filtering and random selection system. Used for generating lists of vehicles that match specific criteria (e.g., for dealerships, traffic, career mode).
Dependency Tree
Analyzes level asset dependencies by walking scene objects and building a dependency graph of files, textures, materials, shapes, and SimObjects.