Creating roads manually and by people walking

Godot Version

4.5

Question

I am working on a city builder-like 3D game. I want to start to implement the ground and the roads system; at the moment I have just a plane shape 3D as ground with no roads which I probably have to change with something else since the ground will not be flat.

How should this work.

The player will have the ability to place different types of roads, straight lines, no bends.
Where the roads are not present, if people walk frequently along the same path, this path should become visible like a dirt road. Something like in Ostriv or in Ancient Cities as reference.

I still have to start to implement this system, so, to avoid bad decisions, I’d like to ask you if you have already done something like this or you know how you would do it and tell me what I need to make it.
In example: what would you use to create the ground? How would you make the dirt roads made by walking people show up? Should that be a shader job? Would you simply programmatically place pieces of road when necessary? And so on… I’m looking for hints like these.

Then I will look for resources to learn how to actually implement the system.

Thank you.

You’re looking for a lot more information than you seem to think you are. Here’s an hour long video that, while about RTSes, should get you going in the right direction.

For roads, you probably don’t want shaders, just a 3D object that represents road segments. You can’t avoid bad decisions though. You will make them. Just start building. Maybe by following the above tutorial.

Thank you, I’m already familiar to that tutorial, I followed it for the buildings’ placement, to have people spawning and moving around and to have a basic UI.
I already have people going around collecting the resources required for the buildings, both from the environment and from storages and doing other tasks.

I know I’ve got A LOT of work ahead, but I want to move the subject a bit away from people doing something now, thus I’ve thought to start building the terrain and the roads system.

Ok, so what you have done is waste my time. Because instead of being clear about what you’ve done and what you haven’t, you’ve been very vague and asked a lot of vague questions. I’m very glad I only spent a few minutes finding you a link rather than spending a lot more time explaining things you already know but didn’t bother to mention you had done. That is very disrespectful of our time.

I suggest you read this post on how to ask questions, and then give us enough information to not waste our time and yours:

I litterally wrote even in the title that I need suggestions to make a road system, where did you read that I needed anything else?

Come 4.7’s release you’ll have access to DrawableTexture2D which could be useful blitting textures or colors onto your ground texture. Personally I would blit a red dot underneath the NPCs on a staggered timer and use a shader to display red as dirt, green as grass, and blue as anything else needed.

You could possibly use decals (with maybe some form of collision for npc detection once placed), that way you stamp the terrain with a decal as the NPCs walk on it, and the more NPCs walk on an area, auto-update the texture of the decal to go through dirt>paving>tarmac etc.

I’ve never made a game like this or thought about how to implement features like these so take anything with a grain of salt. But if i were to add paths that spawn in where humans walk, i would add a random chance to add a path to a suggested paths array or dictionary whenever a human starts moving towards a location that fulfils some criteria. E.g. if the errand doesn’t start from a building, road or path, don’t put a path in there, to avoid a mess of disconnected paths, or if it already is on a road/path also skip adding. Just add “from” and “to” and then use those to generate a path in a separate function. Then every once in a while check the array to see if there is a most common entry. Like if many move from one place to another, a road usually gets built there sooner in reality than less traveled paths. Example: market to town square would get entries quickly, and a path from some random remote hut to another random remote location would probably never get a path.

This is just a rough idea. I think it could cause some nice organic feeling path network to emerge. But i could be wrong!

I am thinking about a similar system, but have Zero idea how to implement it yet.
“The Settlers 4” had a system where roads would gradually appear as more Folk walked across an area (and faded if unused), and I’d like something similar.

Watching to see what ideas arise.

You’re probably already using a grid of some sorts?

Add a counter to each cell of that grid that’s incremented with each passage in that cell.

Have a threshold for your various implements (dirt, gravel, asphalt, concrete) and texture the cell accordingly?

Something like that,

Cheers !

You need to implement a system of invisible “paths” that units can walk on. Preferably as a network of linear segments connecting all reachable points. Measure how much each segment is being traversed over time to determine candidates that could become visible paths.

How exactly to implement the visual part of this, would depend on your game’s overall visual design, but in any case you’ll have to maintain an underlying non-visual data model that represents it

“The Settlers 4” had a system

Funnily enough that’s actually what I was thinking of when describing my suggestion for using decals, however I was thinking using decals might potentially allow you to use any of the existing terrain systems for Godot depending on exactly what your eventual game style looks like.

I would use a splatmap and try to implement what this person does for the snow …

Instead you are writing to the splatmap. To implement fading you could try just writing a fraction of what it takes to make the mud show through the grass, so each NPC puts a bit of color on, then fade the texture gradually back to grass with a full viewport shader.

Also, keep track of the data in case you want the roads to become more permanent.

Base ground is terrain with ID texture. assign different IDs for grass, dirt, desert sand and roads.
Terrain-related plugins mix textures according to painted IDs. Proton scatter will sprinkle small 3D details (pebbles, vegetation, rock formations, etc).
Road generator algorithm will make a 3D curve from line segments accross the terrain, snap terrain height slightly below that curve’s points and procedurally extrude textured road segments accross that curve.
That’s my plan if i’m ever placing roads during runtime.

That was a cool video.

I’ve seen this person’s videos before and they do really cool things. There’s one on chunk mapping too for a Minecraft clone.

Thank you for your answers, you gave me many ideas, now I will look for more information about those, I’ll make some tries and then I’ll decide what to use.