This project was the focus of my final dissertation at university. Given a 3D terrain and series of nodes it will attempt to automatically generate a series of connecting roads that appear ‘realistic’ in their routes.

I implemented this project in the Unity game engine, and coded it in C#, which I had used prior. This provided tools for quickly creating 3D terrain, as well as a plugin for generating splines which I used heavily to give the roads a realistic appearance.
Initially the scope of this project was to generate a single road between two points, but the speed of prototyping enabled by the Unity game engine allowed me to expand the initial scope to look at wider networks of nodes and roads.
The roads are generated by calculating the shortest route between two points on a grid with the A* algorithm. Although the 3D terrain is stored as a grid of heights, the resolution of this grid is far to large to allow quick route calculations so a lower resolution grid is used, populated with heights by sampling the heights of corresponding positions.
To improve the realism of generated roads, additional costs were applied in the cost calculations of the A* algorithm. For example, to prevent roads from making extremely sharp bends they consider a ‘bend cost’ which is calculated by looking at the angle change in direction between previous nodes.