How Would I Make a Road Placement System?

I’ve been working on a city simulation game like Cities: Skylines and Simcity, but of course, in Roblox. However, when it came to creating the roads, I came to a sudden stop. How do I create a road placement system that is smooth enough and allows NPCs to drive on it? Below is a video of SimCity’s system as a reference to what I am wanting to achieve.

Simcity’s Road Placement System
Below is a video of roads being placed:
SimCity - Road Placement System (Youtube)

Below is the image of the road’s gui (hidden in video):

[MAIN DEVFORUM QUESTIONS]

[1] What are you trying to achieve?
A road placement system similar to Cities: Skyline and SimCity that allows the option for NPCs to drive on (Zones will come later). Nonetheless, I would love for the system to be created from one’s mouse, just like the reference video.

[2] What is the issue?
I cannot grasp a way to do this entirely, hence why I’ve made this thread.

[3] What are some solutions that you have tried?
I’ve considered using Bones and a road mesh, but feel as if it would be harder to actually allow NPCs to drive on that piece of the road. Plus, I still, need a way to understand the scripting behind this complex system.

I look forward to answering your responses!

4 Likes

Bezier curves are great for creating smooth road curves for road building! I’ve played Cities:Skylines before and the curved road tool selects three points one for the start, one for the curve, and one for the end and I would assume that Beziers are what they’re using to do that since it also uses three points to create a curve. Beziers are also pretty handy because they can deal with terrain too since you can move the points up or down depending on the height. I’m guessing that you will be using raycasting for the road to follow the mouse which is good because you can detect if the mouse is hovering over a road to create an intersection. I think the best way to create an intersection is to create a node where the two roads intersect to make the roads in that intersections straight so that its easy to create crosswalks on it. Anyway, I’m not going to do all the thinking for you but this is how I would approach road building. Here is the link for Bezier curves and there are also plenty of videos on Youtube about them too, explaining the topic in more depth. I wish you the best of luck on this game and I’m excited to see the product!!

This is what I mean by the curved road tool by the way. Where the dotted lines intersect is where the curve point is.

Here is the roblox visual for the quadratic Bezier curve. If you compare it to the image from Cities:Skylines you can start to see some similarities between the two.

7 Likes

Thank you for the response, it’s be awhile, but I still appreciate it so dearly!

What did you do about connecting the roads, like if u create a road and connecting with a already existing road in cities skylines in connects seamlessly while in roblox i cannot get it to do that help pls

What does the “t” symbol in the gif you have represent? These kinds of questions are never shared on YouTube, and the link you gave does not work either.

In this, the t represents time. So when t=0, it is the start of the road, and when t=1 it is the end of the road.