
System and tool
Road Builder and Traffic System
The tool and the traffic had to be built together, because a road network that generates cleanly but cannot be navigated is just geometry.
- C++
- Splines
- A* Pathfinding
- Editor Tooling
- PCG
- A*Multi-agent pathfinding
- EditorRuns in-editor, not at runtime
This is an editor tool for building urban environments. You draw splines, it generates roads, intersections and the navigation data underneath them, and a traffic system populates the result with cars that can actually get somewhere.
Generating the roads
I wrote a custom class based on Unreal’s posable mesh to deform road geometry along a spline. Using a boned mesh rather than instancing segments means curves stay continuous instead of faceting, and the whole network stays one coherent surface rather than a chain of pieces that nearly line up.
Intersections were the harder half. Anywhere two splines meet you need geometry that resolves cleanly and navigation that agrees with what the geometry is doing, and the two are easy to let drift apart.
Traffic
Cars run A* over the generated network with obstacle detection layered on top. There are two vehicle implementations, one spline-following and one physics-based, because they fail differently: spline-following is cheap and predictable, physics is convincing and expensive. Having both meant density could be traded against fidelity per scene.
Driver profiles vary acceleration, following distance and how willing a given car is to commit to a gap, which is what stops a road full of agents looking like a conveyor belt.
Making it hold at density
The first version traced constantly. Every car asking the world what was in front of it every frame is correct, and it does not scale past a handful of agents.
Moving detection onto timer-based scheduling, staggered so agents do not all query on the same frame, cut the cost enough to run dense traffic. The behaviour is very slightly less responsive and no player would ever notice, which is usually the right trade.
Working with art
I worked with a 3D modeller on the road materials and UV layout, and that fed back into the generator. The tool had to lay out UVs in a way that tiled correctly along arbitrary spline curvature, which is not a constraint I would have found without someone texturing the output.
Breakdown
