Need help making a road system for ai cars and pedestrians (like Cities Skylines)

Hello everyone,

i’ve just started working on a city building game like Cities Skylines, but i have no idea how i can make the road system.
I wanted to have cars following traffic rules like Cities Skylines and pedestrians walking on sidewalks, but i have no idea how i can make a road system for this.

Splines probably just won’t work, because you cant branch with them to create junctions. So i was thinking of a different idea:

What i thought of was making a new empty actor, and placing down vertices with edges between them. But how can you make vertices and edges in an actor?
With this idea you could have simple math determine what type of road there should be at a vertex.

1 edge connection to vertex: end of road / dead end.
2 edge connections to vertex: a point / node in a road.
3 edge connections to vertex: a T junction (3 road junction).
4 edge connections to vertex: a + junction (4 road junction).

Is using vertices and edges a good way of making roads?
And if so, how do you create vertices and edges inside of an actor?

Or should i be using a completely different approach?

You could try using this plugin from the marketplace, it costs a little but we’ve used it and it’s very good…

Procedural Road And Highway Tool With Simple Vehicle Traffic

But really i want to know how to make this myself and i want to know how something like Cities Skylines’ traffic works. I don’t really have the money for a plugin.

I’ve also found a good pdf (http://www.artifactgames.de/Resume/DA_JanKrassnigg.pdf) on how to approach this, but i don’t know how to recreate that in UE4.
How do you make something like this?

1 Like

Bump… still don’t really know how to approach this…

1 Like

I’ve been trying to figure this out myself. Going to read through that pdf you linked. I am having some success with Splines. If you wanna see what I’ve got, I have a YouTube Channel. Once I figure it all out, I’m planning to make a tutorial series.
https://www.youtube.com/channel/UCZT…-7wlzRiL69Mdzg

2 Likes

Any update on this since 2020?

1 Like

This is a massive question to ask, and to expect an answer that can be contained within a forum post is unrealistic. A system like this would be incredibly complex, try doing some googling. You’ll find that there are youtube playlist tutorials that supposedly teach you how to do something like this (I say supposedly because I haven’t taken the time to watch them).

Here’s one that I found after 5 seconds of research.

Tutorial

Again, what is asked here is an incredible undertaking - and you can expect to either need to pay for a plugin that does it for you already, or spend many, many hours building it yourself.

1 Like

Thanks for your answer!

The tutorial is about a NPC Pedestrian System, we’re looking for a method or at least a direction to make a Runtime Road system, for context, here’s a more specific post about it (https://www.reddit.com/r/unrealengine/comments/17kk3lb/how_to_create_road_building_system_like_cities/)

I understand that’s a complex subject, that’s why we look into forums. I’ve been searching for a week and couldn’t find a single consistent tutorial or video about complex road generation in runtime.

1 Like

And anything new with this post ? Maybe you have found some direction in which you can point next person that one to learn a little more about roads system ?

1 Like