Future and Experimental Generators

This page lists candidate methods for the first stage of TrackGen: the stage that produces an initial closed centerline before constant-spacing resampling and XPBD relaxation. It is partly historical: hull, polar, checkpoint, and voronoi have since shipped as standard runtime generators, while several later sections remain investigation notes. The canonical runtime contract is documented in Writing a Generator.

The goal is not to replace relaxation. The goal is to feed XPBD better initial curves: more diverse, more controllable, less degenerate, and easier to repair into constant-width valid tracks.

Contract for Any Centerline Generator

The generator should be judged by the interface it gives to the downstream pipeline:

  • Input: per-environment seed and static config.

  • Output: a closed 2D centerline or a small set of control points that can be deterministically expanded into a closed centerline.

  • Shape: fixed upper bounds for CUDA graph capture: fixed max control count, fixed dense sample count, bounded loops, no host-side retry loop based on generated data.

  • Validity target: simple closed loop is preferred, but not necessarily constant-width valid. XPBD owns thickness repair.

  • Diversity target: support length, turn density, hairpin count, straight length, compactness, symmetry/asymmetry, and “racing character” as tunable axes.

  • Performance target: batch-friendly Warp kernels, one env per row, no dynamic allocation, no per-env Python branching.

The evaluation should be post-relaxation, not only pre-relaxation. A generator that looks rough but relaxes into high-quality tracks is more useful than a prettier generator that produces rare unrecoverable cases.

Metrics for Comparing Candidates

For each method, run a fixed seed suite and log:

  • Pre-relax simplicity: centerline self-intersection rate before fallback.

  • Post-relax yield: final Track.valid rate after XPBD and inflation.

  • Fallback rate: how often generation must route to polygon fallback or another rescue path.

  • Relaxation burden: XPBD displacement, iterations-to-valid if measured, min thickness before/after, curvature-radius deficit before relaxation.

  • Diversity: distributions of length, area, compactness, curvature, straight-section length, turn-angle histogram, and self-approach distances.

  • Control: how predictably config knobs affect difficulty and style.

  • Racing-line feasibility: cheap post-relax proxy for whether the circuit supports a meaningful racing line, such as minimum-curvature cost, peak curvature, straight-to-turn structure, and a simple friction-circle velocity profile.

  • Systems fit: Warp implementation complexity, static-shape fit, CUDA graph compatibility, memory footprint.

Cross-Cutting Variants Worth Testing

These can apply to several generators:

  • Per-env style randomization: sample generator knobs per track instead of one config per batch.

  • Template plus noise: start from a known class such as oval, figure-eight-like but non-crossing, road-course, kart track, or test-track, then perturb.

  • Anisotropic scaling: stretch/compress before XPBD to create long straights and fast circuits.

  • Straight-section preservation: mark some control spans as low-curvature targets so XPBD does not round every sector equally.

  • Racing vocabulary templates: reuse a small set of track-building motifs from racing-line work, such as straight, clothoid-in, constant-radius apex, clothoid-out, sweeper, chicane, and hairpin. These can be segment templates or priors over a curvature-profile generator.

  • Difficulty labels: emit approximate pre-relax metrics such as expected curvature, length, turn count, and compactness for curriculum use.

  • Downstream racing-line proxy: after relaxation, run a cheap minimum-curvature or friction-circle speed-profile approximation to rank whether the generated track is merely valid or actually produces a meaningful racing problem.

  • Fallback families: if Bezier smoothing self-crosses, choose between polygon fallback, reduced-handle fallback, or local handle clamp instead of one global fallback.

Proposed Shortlist

The first implementation pass should investigate five methods:

  1. Current generator with per-env style sampling. Minimal code risk; likely immediate diversity gain.

  2. Convex hull plus midpoint displacement. Strong practical baseline from OSS implementations; easy to compare.

  3. Periodic polar spline / radial function. Smooth-by-construction baseline and a Warp-friendly replacement candidate for the unsupported Fourier path.

  4. Curvature-profile / clothoid-arc generator. Racing-line-inspired representation that directly controls radius, straights, sweepers, and corner vocabulary before XPBD.

  5. Checkpoint-steering generator. Potentially better racing feel; worth prototyping before committing to a Warp port.

The second pass should investigate:

  1. Segment grammar for explicit racing-style control.

  2. Repulsive-curve growth as the closest literature method and high-quality optional generator.

  3. Chain-code direction sequences if we want an evolutionary/RL-friendly discrete representation.

Graph-cycle extraction, scalar-field contours, and data-driven priors should stay offline until they show a clear quality advantage.

Implementation Notes

Keep the first production versions simple:

  • Prototype in torch/Python first with the same output contract as generate_centerline_warp.

  • Reuse the same downstream resample_constant_spacing -> xpbd -> inflate benchmark for every candidate.

  • Do not optimize for pre-relax visual smoothness alone. Optimize for post-relax valid yield, diversity, and low XPBD displacement.

  • Do not add unbounded retry loops to the Warp path. If a method needs search, make it an offline generator or give it a fixed-budget fallback.

  • Keep one common comparison script so each generator can be ranked by the same metrics.

Suggested Experiment Table

Method

Prototype first?

Warp candidate?

Main metric to watch

Current + style sampling

no, already exists

yes

diversity vs fallback rate

Convex hull + midpoint displacement

yes

yes, simplified

post-XPBD yield and style diversity

Periodic polar spline

yes

yes

smoothness vs blob-like shapes

Curvature-profile / clothoid-arc

yes

yes, if closure is bounded

closure quality and racing-line feasibility

Checkpoint steering

yes

maybe

closure failures and racing feel

Segment grammar

yes

maybe

closure artifacts and style control

Chain-code directions

yes

maybe

self-cross rate and grid artifacts

Graph-cycle / Voronoi site snapping

yes, done

yes, implemented

site-count/layout diversity

Repulsive-curve growth

yes

optional

quality vs generation cost

Scalar-field contours

offline

unlikely

contour selection failures

Data-driven templates

offline

maybe as codebook

realism and controllability