How to make randomly generated racing tracks?

Hello. I am making a game and i wanted to know how can i make randomly generated racing tracks

I have these tracks and i want them to connect and create something like this

Zrzut ekranu 2024-08-17 114350

i will be glad if somebody could help me solve this problem!

I’ve never done this, I’m just giving a general idea of ​​how you might proceed.

You should place connectors for each track segment, one at the beginning (Point A) of the segment and one at the end (Point B). You create a script that takes a random segment and identifies it as the starting segment, creates another segment, and connects point B of the first segment to point A of the second segment.

Then you should manage the closing of the track, I can’t tell you exactly how you should do it, but one idea is to create a script that controls the position and orientation of the starting segment, and from there the only thing I can think of The aim is to generate the track segments, perhaps in a slightly more controlled way, until it reaches the end, like reaching the end of a labyrinth. I can’t give you any more information, but I hope this helps in some way.

Here are some videos you can use for the first part:

1 Like

thanks for your help :grinning:. I’ve already made it so it creates random tracks which connect but I can’t really figure out how to make them close and create a circle.

Since you already have coded it so the tracks connect what if you use the logic: tracks going forwards for a random amount of tiles, then it randomly chooses between left or right and then you follow that path for a random amount of tiles, then go back for the same amount of tiles you went forward, then opposite direction at the bottom for the same amount of tiles until it’s aligned with the start piece where you’d need to throw in some logic to connect the paths back up.

It would look good with your tiles that turn meaning it wouldn’t look like a rectangle or square with the logic if created correctly.