Generate steet

hello,

i want to create a racing game with a street that has diffrent segments:

  • it should spawn random segments with a specefic length.
  • the car has not a consisstant speed so i cant spawn it after x seconds so it’s fitting to the other tiles.

can annyone help me how to do this? i have no idea

You want to make it a procedurally generated closed loop using premade segments? It may be easier to create some tracks, but if you want to generate the tracks you will need to look into different types of algorithms for generation. One lead I have for you is that I might start by creating a rough loop by placing points in space in one of multiple premade loops and shifting them randomly, then using different track segments to try to arrive to the first point by using random segments that go in that direction. When your track roughly arrives at the point or it’s no longer possible to reach that point (if you passed it), you use more segments to get to the rough position of the next point in the loop. When you get to the last point you use a form of pathfinding to create a short road from the last segment to the finish line.

You could also place some segments randomly in a rough loop then connect them with roads through pathfinding.

If you wanna go full random you could place a bunch of points in a circle, rectangle, etc, shift them around a bunch, and then make a path that connects all the points. You could then make a road along that path.

There might be better ways but these are the ways I can think of for just making random tracks.

But then again, I feel like a racing game is exactly the kind of game where you want to make the tracks custom-made. There’s a lot of subtleties that go into making a good track, especially the pacing. So generated tracks would never be as good as entirely premade ones, without even talking about the aesthetics of it.

thanks :smile: i made it with tracks now and it’s perfect