Bezier Curved Road Generator Plugin

Bezier Curve Road Generator Version 0.5

Install Plugin

“Create curved roads with ease!”

Changelog
https://devforum.roblox.com/t/bezier-curved-road-generator-update-log

I present to you my recreation of @Hydrolock 's BezCurve Road Builder!

Original Plugin


NOTE

I am by no means a programmer, I don’t code, but I at least have some knowledge of coding. This is my first venture into this type of coding, so if you have any feedback on the script, please let me know! Also I did get permission from the original owner to recreate the plugin.


What does this do?

This allows you to create curved roads that obey the FHWA/AASHTO standards (well, as close as possible while being practical). It does this via the namesake's function, Bezier Curve.

Preparations

UPDATED 02/09/2025

If you don't want to read, watch the demonstration below!!

Preferably before you start, have the following

  1. Have a Model that is named Road
    - The parts inside have to be correctly orientated to the World Orientation

  2. The model has to have a PrimaryPart assigned to it.
    - Preferably the Road part, or what ever is used for the asphalt/concrete and etc

  3. Ensure that ALL of the parts of the model follow the following axis orientations

X is the LENGTH of the Road

Y is the HEIGHT of the Road

Z is the WIDTH of the Road


Video Demonstration

Step 1

When pressing on the plugin, it brings down 2 selections.

  1. Create Curved Road - This is the main plugin, probably going to be the most used button

  2. Starter Pack - This will spawn in BezierCurvedRoad StarterPack. It includes 4 sample roads, all named Road, the RoadPoints model (contains p1, p2, p3, and p4) and a ReadMe

IF THIS IS YOUR FIRST TIME, PLEASE SELECT THE STARTER PACK

Step 2

  1. Ungroup the spawned BezierCurvedRoad StarterPack
    - If your reading this, you can skip and delete the BezierRoadGen README script, unless you want to see the Changelogs or want to read more (who does that)

  2. Ungroup the RoadPoints model (OPTIONAL)
    - This is optional since you can do ALT + LeftClick the parts and drag them around. For easier movement of the parts, ungroup.
    - Inside the RoadPoints model are the control points p1, p2, p3, and p4. The plugin will consider these points as the control points to generate the road with. Move them around to where ever you want them to be.

If you ungrouped the RoadPoints model, and after you placed them around, group it back with the SAME name, ensure that all of the control points are inside. MAX 4 for now

Step 3 (UI) UPDATED

Press on the plugin again and this time press Create Curved Road option.

Upon pressing,

  1. Select a valid Road Model
    -It will highlight any valid Road Model from the Workspace. If you have a valid road and its not highlighted, this might be the reason why.

After selecting a valid Road Model,

  1. It will now highlight RoadPoints grouping.
    -The parts inside the RoadPoints model will be highlighted, and a line going through the vaid p points. Select any of them.

After selecting a valid RoadPoints grouping, the main UI will appear, giving you a few selections

Starting from the top to bottom, right to left

  1. Segment Length
    - Any value inputted will be treated as the standard length that will be used in the road generation. The HIGHER the value, the longer the Road model will be generated.

WARNING

The LOWER the Segment Length value, the more Road models will be generated. This can make the generated road smoother but this can cause a Roblox Studio crash. I am not responsible for any loss of progress of your game. You have been warned.

  1. Curve Strength
    - Any value (numbers) you input will be considered as the strength of the curve. Higher values (>70) means more “curvy” the road generated will be

  2. Dynamic Curve Strengh
    - If ticked, input a Speed in MPH, the value inputted will be considered as the baseline speed for the curve, and the road generation will adjust accordingly to the value

Banking

  1. Extend To 0
    - If ticked, the road generation will generate beyond the p4, with a goal to smooth out the banking angle to 0. Length will vary depending on the last generated bank angle.

Lane Generation

  1. # of Lanes
    - Any value inputted will be considered as the amount of lanes that will be generated. There is a Suggest Lane value just above depicting a suitable amount of lanes, based on the default 15 stud width per lane

  2. Stripe Length
    - Any value inputted will be considered as the length of the lane stripe

  3. Width per lane
    - Any value inputted will be considered as the width of the lanes

  4. Lane Stripe Spacing
    - Any value inputted will be considered as the spacing of the lane stripes.

  5. Generate
    - When pressed, it will generate a road based on the values you inputted above, and the placement of the RoadPoints. It will appear semi-transparent.

ALL roads generated through this plugin will be inside Curve Folder in the Workspace.

image

  1. Done
    - After a road is generated, when pressed, it will finalize the road generated and makes the road generated no longer semi-transparent, and shut down the plugin.

  2. Cancel
    - Cancels out any generated road, and shuts down the plugin.

Optional features

  1. Flip Directions
    - Upon ticking the box, it will regenerate the generated road flip from p1 -> p2 -> p3 -> p4 to p4 -> p3 -> p2 -> p1, Untick the box again and it will revert back.

  2. MPH
    - Shows empty at start, but when a road is generated, it will provide a suggested MPH (or KMH when the Switch to KM/H is ticked) on either the tightest curve or if none is detected (or too close to the start/end p1 or p4), the average speed throughout the entire generated road

  3. Switch to KM/H
    - Upon ticking the box, it will switch the displayed MPH to KMH, Untick the box again and it will revert back.


Known Limitations

“My Road lines / Road looks wrong after generating!”

I have said above, that the parts inside the Road Model has to be orientated properly to the orientation said above.

“The compatible road models are not being highlighted!”

Theres some problems with this, even I face it at times, I am working on it, but it will take some time.

If you find any more, please contact me!

---

Future Plans (Updated)

I plan to do a few more things to flesh out the plugin.

  1. Allow tilting to happen at the start/end (p1 and p4)
    - Already underway, the code already supports this, but it is not working correctly. Maybe in the next update!

  2. Allow movement of the parts inside the RoadPoints without going through the Explorer or manually moving them outside the plugin
    - This is mainly for quality of life improvements, still thinking of a way to figure this out. Several branches of the code attempted to implement this, nothing worked.

  3. Allow generation of more than one RoadPoints at the same
    - A long-term plan for me to implement, really helps with the highways with separate right of ways.

  4. Allow more than 4 Control points
    - Already in the works, already laid the foundation work for it. In the most unstable build, it works! so see it soon!

If you have any more features that you wish to see me implement (atleast to the best of my abilities), please let me know. Contact me at Trellux#trellux or find the MDU social link to the server.

A separate topic dedicated for changelogs will come soon.

Thank you for stopping by!

13 Likes

This is super cool well done! Will you make one for cart ride games in the future?

What do you mean by this? Technically this plugin can work with all models, it just has to be named Road. The highlights currently work to show that it has all of the requirements for the plugin to work properly (and to get the correct results). It can have anything inside, just as long they are orientated properly. So really, it can work for cart ride. I can probably provide a variant without specific FHWA standards so it can be more loose.

Ohh gotcha, I was under the impression that the plugin only creates roads. To clarify I was wondering if I can use this to create rail road tracks like in cart ride games. Is it possible to create something visually similar to this?

image from this post:

It can, but the plugin right now is restricted to the standards of the FHWA, that’s why I named it a Road generator. I can definitely make a variant that removes the hard-coded restrictions so it can make the one in the picture. To be real that is similar to the first version after reworking the plugin, so yea I can make it like that again.

1 Like

Thanks man, that be much appreciated :smiley:

I deployed an emergency update to the plugin, I apparently pushed an update with stuff inside, which broke the plugin.

So if you installed the plugin before you see this post, please update!

Could it be used with train tracks?
Such as these btw.

I believe it can, just that the track parts have to be aligned properly, and that only the track are parts, and orientated properly. The gravel bed can be parts but may get generated wrong.

Overall it can, just some quirks and that this plugin does follow the FHWA standards for roads, so it may not be what your looking for. Look 2 post above your post. I do plan to release a more loose variant for other stuff, or somehow incorporate it in.

Hey all, Happy New Year!

Currently working on an update to the plugin that brings a new feature: Lanes generation!

The plugin now allows you to set lanes that will get generated along side the road generation. You have the control on how wide and how much spacing each stripe will be. Currently working on allowing edits on the length of these stripes as well, so count on it being in the update!

Here is a video on the current state of the updates

Just note that there’s a few things in the video that will not be in the update, as they are just debugging stuff I added in.

Also there will be a major change in the instructions on how to use the plugin, mainly on what models can be used as there are new functions that look for certain aspects of a model to implement road lanes accurately.

I am currently working on 2 things on top of this update, one is the unrestricted version so you can possibly make roller coasters or something, and the other is allowing the starting section and the ending section to not be flattened out so you can make inclines on top of inclines without the road generation being smoothened out.

Anyways, stay tuned for the update!

Definitely excited for the update! It’s about time we get a new bezier curve road plug-in that’s comprehensive and works well. Been too long without the ability to do this.

1 Like

Update 0.5 has been released!

Enjoy the new Lane generation and improved UI!

Please reread the instructions as there have been some changes in how the road generation will use your road model!

I do plan on an overhaul of the UI and finally getting the custom start and ending banks, I planned to get it in to 0.5 update but it didn’t work out.

Anyways, for an update on other things

The unrestricted variant script is now going to be the primary focus, up until its atleast presentable and actually functions. I will not set a expected release date, maybe when it’s close to how it should function

The custom angle of the banking at start and end will take a while, as I need to fundamentally change how it even does the curves and banking, its complex and really “fragile” in the code, I will make do with something.

Anyways, see you around!

1 Like


So I noticed on some certain banked curves I get this janky thing, even on lesser curves I get this (I know this one is kind of an extreme example).

If you could find a way to fix this, that would be great! :slight_smile:
Also, I have been playing around with it, this is awesome work! Keep it up!

Can this be updated soon to generate sideways?
I really wanted it for more realism to my games

Sadly this is a function to comply with banking and elevation change at the same time. Its a part limitation unless I find a way to make it a mesh, and that’s really beyond the scope of my knowledge.

I even limited the banking just a bit below the actual maximum so this can be mitigated by just a little.

Who knows, I will try to find some solution but its pretty hard without going through the entire code

Can you explain what you mean by “sideways”? Like Mario Kart 8 tracks? If so that will be in the unrestricted version I’m currently working on