Best way to make spline roads?

Hey all, been working on some random generation stuff lately and I thought it’s to start on the roads. My first thought was to do a bp that will spawn a central intersection mesh and then lay connections off that.

Then I realized a spline path would probably be a good way to handle it. There’s plenty of tutorials that explain how to make roads and place meshes along a spline but none deal with actually connections, or making it change meshes depending on the angle between points and such.

So if I wanted to have the points be randomly dropped in an area and have the connect up, laying down the hisms as it went, and then connecting different paths with differently shaped intersections, but is there a way to have it “detect” an intersection?

What about a bp actor that will drop intersections meshes at random points and then draw splines connecting those up?

Any help appreciated.

Edit: Almost a year old and I’m coming back to this because I still need some sort of way to make spline roads procedurally that can dynamically connect. This has had to of been done before so any pointers would be nice.

Not an answer or real advice as this is really involved, just my 2c:

making it change meshes depending on
the angle between points and such

This should be easy enough. You can get tangent at spline point / length and have a Spline Mesh Component replaced with another one based on the criteria.

So if I wanted to have the points be
randomly dropped in an area and have
the connect up, laying down the hisms
as it went

Splines can deform Spline Meshes Components; afaik you cannot use ISMs for that. More info [here][1]. Unless I missed a major feature implementation. o_O

but is there a way to have it “detect”
an intersection

Spline Meshes Components have collision, you could use it to detect if another SMC is intersecting and replace one. Or check if spline points are close enough to create an intersection.

What about a bp actor that will drop
intersections meshes at random points
and then draw splines connecting those
up?

It could work. Drop intersection meshes and generate splines leading away from the sockets, ending at another intersection’s socket.

The challenge here is to write a killer algorithm that makes it all look plausible. On the other hand, you can have something generated procedurally and then tweak it ever so slightly, human touch makes all the difference in the world!


What can be also worth looking into are Marketplace solutions; since this wheel has been invented more than once already, an investment of $50 can save you a month(s?) of work and teach some really cool stuff.

I’ve done that before, buy stuff just to take it apart and see what makes it tick (pun, ehm) - one way to learn things, for sure.

[Feature Request] Instanced Spline Mesh Component - Rendering - Epic Developer Community Forums

How do games with lots of splines
handle the overhead on that?

Dunno, big games don’t use blueprints to do heavy lifting. [Actor Merging does not seem to work on spline mesh components - just checked. It produces weird results, I kind of see why.

The square bit in the middle is the merged static mesh made out the green roads spline mesh components - not great.


I used splines heavily in my last project but I had hardly ever more than a couple of hundreds of SMCs in the scene. Generating and updating them (especially on tick) is a really demanding but once they’re in the world, the performance hit was negligible.

Again, with 2000 of those, the story would be different, surely.


In case you find no answers here, drop a question regarding spline mesh optimisation in the forums; the open-ended nature of your question may attract someone with relevant experience.

Hmm, so splines can’t use instanced meshes. How do games with lots of splines handle the overhead on that? It might be better and easier to just have some sort of system that snaps hism to a grid and places them in a line.

Okay so most of the tutorials I’ve been watching all day use constructions script with the basis that the person using this is setting up the level before play. That is not the case with me, my world is random gen so, this has to be as well.

My project’s terrain is made of tiles like civ or something(and is completely flat) so I was thinking just get a random tile from the array of them and use their world origin as the spline point #1, then another for point #2 etc, etc…

If they are very close or collide put up a connecting path or intersection, far away then place a large plaza to act as a city center then draw more splines off that in a radius.

Here’s something really simple I threw together from a couple different tuts and threads I’ve seen. Imgur: The magic of the Internet

I guess what I’m asking for is help on making these “connect”. Trace along the spline for it or something?

This is going to be wrong, but I am throwing it in. If you can generate a random spine, could you use the basics from endless runner where is puts in a corner, you could put in an intersection and spawn the road spines from there.

The only problem is it would be random every you play.

The only problem is it would be random
every you play.

Not if you use [random streams][1].

https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/RandomStreams/index.html