API ReferenceGE ExtensionseditormasterSpline
Master Spline - Auto Road Generation
Generates roads between waypoints using A* pathfinding on the terrain heightmap grid. Handles slope avoidance, turning radius constraints, hairpin widening, and elevation optimization against road des
Generates roads between waypoints using A* pathfinding on the terrain heightmap grid. Handles slope avoidance, turning radius constraints, hairpin widening, and elevation optimization against road design presets.
Public API
| Function | Signature | Description |
|---|---|---|
M.isPreview | () → bool | Returns true if a preview path currently exists |
M.clearPreview | () | Clears the current preview path |
M.generateAutoPreview | (spline, autoParams, presetParams) | Generates a full multi-waypoint auto road preview |
M.createAutoRoad | (spline, bankingStrength, autoBankFalloff) | Commits the preview to the spline's primary geometry |
M.handlePreview | (spline) | Renders the preview ribbon each frame |
Parameters
autoParams
| Field | Type | Description |
|---|---|---|
baseWidth | number | Default road width in meters |
slopeAvoidance | number | How aggressively to avoid steep slopes |
bankingStrength | number | Auto-banking strength after creation |
widthBlend | number | Hairpin widening blend factor (0=none, 1=full) |
presetParams (from road design standards)
| Field | Type | Description |
|---|---|---|
maxSlope | number | Maximum allowed slope gradient |
minRadius | number | Minimum allowed turning radius |
maxWidthGradient | number | Maximum width change per meter |
Algorithm
- A* pathfinding on terrain grid cells (8-directional)
- Cost function combines distance + slope penalty + radius penalty
- RDP simplification to reduce node count
- Hairpin widening at sharp curves (post-process)
- Slope envelope snapping + Z relaxation to terrain
- Catmull-Rom interpolation for smooth final path
-- Generate preview between spline waypoints
auto.generateAutoPreview(spline, autoParams, presetParams)
-- If user accepts, commit to spline geometry
auto.createAutoRoad(spline, bankingStrength, autoBankFalloff)Dependencies
editor/toolUtilities/rendereditor/toolUtilities/geomeditor/toolUtilities/rdp
See Also
- Master Spline - Homologation - Related reference
- Master Spline - Jump Tables - Related reference
- Master Spline - Layer Manager - Related reference
- World Editor Guide - Guide
Gen UI Library
ImGui widget library providing reusable UI components for the gen editor framework.
Master Spline - Homologation
Analyses and optimizes a master spline against road design presets to ensure geometric compliance (slope, corner radius, banking, width gradient). Provides per-frame iterative optimizers.