Download

Creating streets at runtime on terrain

Hi everyone,

I want to make RTS streets that you can place dynamically. I’m using splines for the path. If you want to see what I want to create you can take a look at Manor Lords (https://youtu.be/d2mW8fmakKA?t=25).

Now my question is:

How do I build the streets along the spline?

I think there are 2 ways to create the streets:

  1. Create a SplineMeshComponent that has the street material and hitbox on it. I would prefer this solution, but my problem here is that the spline doesn’t match the height of the terrain.
So what would be the solution for this?
  1. Just paint the terrain. But I don’t like this solution a lot. Because I think it is a problem paint a direction and I have to repaint, when I delete the streets and have to match the environment texture.

Hope to get some good ideas on that. Thanks in advance!

Not using unreal landscape is a good start.

assuming that, then a voxel plugin of some type.
with that, you probably just sculpt the terrain to conform to the road / implement a landscaping system.

its not the easiest thing to do. if you have no experience with the engine start somewhere else.

If you have a fair amount of experience, then you just need to figure out the right pathway to modify collision at runtime.

Thanks for your help, will take a look on the voxel plugins. Do you have any good documentation/tutorials on this?

Also, I don’t quite get how you would do the collision. Can you explain it a bit more?

And how do you think did he do it in the video i sent?

No, the few I tried back in the day aren’t particularly efficient.

Managing collision at runtime is not exactly an easy task.
in short, You’d have to use the built in engine stuff.
luckily for you, with .26 they added a lot of procedural things. You can probably find a tutorial on procedural mesh generation and collisions.

As far as the game goes,
They probably have a custom landscape system with an appropriate toolset they built over time.

The game’s been in my wishlist for over a year… and probably in development for at least a year before that.

So if I understand you right, you think that they use meshes too and don’t paint the terrain?

And shouldn’t it be possible to just add a custom collider to the street mesh so as splinemeshcomponent it should still match the mesh?

The spline collision has nothing to do with how to manipulate collision at runtime for a custom terrain, or how to edit a terrain shape at runtime.

You can get the spline to snap to the terrain anytime with a simple downward line trace that starts from way up above the terrain on the visibility channel.
as any other linetrace, it can detect anything, including other actors (not the landscape) so that you can implement some kind of snapping.

What mesh the spline uses is unconsequrntial.

Ah now I understand what you meant, little misunderstanding there.

So to me it seems like the Voxel Plugin (Voxel Plugin FREE in Code Plugins - UE Marketplace (unrealengine.com)) is the best option. Or do you have good alternatives for this?
And do you know how good the performance for large terrains is? (not much editing of terrain)