Converting procedural map data to geometry

So I’ve been reading up on basic procgen principles, and I get the idea behind using L-Systems to generate streets: you treat each street as a line segment represented as an fvector, and for n iterations you go through every segment and apply whatever rules you’ve put in the grammar, so the street grows like a snake until you have 100-200 or however many line segments linked up in a rough amalgamation of a street network.

That having been said, once I have my array of vectors, how the heck do I convert that into actual linked static meshes? I can’t simply spawn a mesh and stretch it to exactly match the vector without distorting the textures unless I make the road out of hundreds and hundreds of 1x1 instanced mesh blocks, and that seems excessive when all I need is a single contiguous surface.

So is there a commonly known way to accomplish this, or is the simple act of translating my line segments into geometry a pretty big task?

Soory I place reply in wrong section. Very sorry

Verry sorry

Regarding your first question, you just need to make your road mesh has a tiling texture, then for each mesh you spawn using the L-system make a Material Instance Dynamic and then set the scalar parameter for tiling to match the length parameter from your l-system.

fwiw I have made a whole L-system using blueprints a year ago or so. I am about ~80% though rewriting it in C++ because blueprint l-systems were too slow. But I did manage to program most of the core l-system features into blueprints such as parametric variables and variable checks. I was planning to release it at some point but I keep getting wrapped up in other deadlines. I’d be happy to post some examples of how certain bits work if that is helpful.

That would be super-helpful if it’s not too much trouble; the logic of how to produce coordinate systems representing level geometry is pretty straightforward, but for some reason whenever I try to think about ways to turn it into actual meshes, I end up recreating voxels.

So are you talking about problems with l systems themselves or some specific part of mesh placement?

I never actually messed with making whole cities, although I did use an example in a presentation the similarity between city layouts and plant branching by changing the branching angle (very simple symmetrical example):

Placing buildings and stuff at the cross points would involve using one of the Jump commands which moves the ‘turtle’ without drawing any meshes. Then after placing the building you jump the turtle back to where it was (maybe with a branch end?).

Buildings could probably be premade static meshes, but you could also make them semi procedural but that will require basically deconstructing what you want to be procedural and driving all of that. Ie, you’d need a few basic pieces like a repeatable window section, corner piece, trim. It could be as granular or as simple as you want. I’d probably start by making a few “bottom level” meshes with replacable mid and top sections.

Oh that’s interesting, so you would make the streets and buildings with the same grammar? I was thinking of layering multiple systems on top of each other: run several passes of a system that only has rules to grow roads and transform them to match terrain, then feed the resulting array of segments/points to a completely different grammar charged with locating and instantiating buildings, streetlights, and whatever other detail elements you designed.

It is up to you how to implement that, but I like the idea of using hooks in the world that could be created from other systems. In my own prototyping I never got that far so any one Lsystem was completely self contained. It should be fairly easy to make some more blueprint specific Lsystem instructions (and this is kind of going outside of formal l-system territory a bit but that is bound to happen) that do things like get a list of other meshes or specific markers by querying the world. It will probably be necessary to abuse the blutility system to make that work, unless you are able to point the actors manually at eachother with references. So then you just place the road system and let it complete, and then place a separate building system and first give it a variable reference to the road system. So it’s not 100% procedural since there is some hand holding but it could be very powerful still.

Hmm okay, I’ll give that a whirl- thank you for the suggestion :slight_smile: