How to make an endless road where turns can be added through code

Hi there,

I’m working on a project to create an adaptive difficulty system where the road a player drives on gets more difficult the better the player is doing. I’m stuck with how to actually get roads to be procedurally generated and in a way I can control the turn angles. If anyone can help me expand or explain the easiest way to do this I’d be very appreciative.
My three ways I have thought about are as follows:

use terrain generation similar to here:

but I can’t think of how to code it to implement turns in the mesh.

Create assets with different turning angles and somehow join them up correctly since their rotations and lengths will differ (any pointers would be helpful)

Or make tiles with road sections that fit, but I don’t have much expertise in modelling things so they’d all add up correctly so I’d prefer not to follow this approach.

Any advice or links to resources that may have covered this?

Thank you!

I recommend watching Freya’s live course on beziers and actual road generation. You can then embed these into your terrain to flatten it under the road or depending the height and the road, even sink in the terrain a bit, depends. This won’t give you a straight solution, but will give you idea how to approach the problem.

https://www.youtube.com/watch?v=6xs0Saff940

2 Likes