Procedural Generation and Blueprint Detection

Hey everybody,

So I’ve been playing around with procedural generation the past few days, attempting to make the level get from point A to B with enough room to explore in between, and frankly right now its a mess of branches, booleans, and a lot of my own person sadness.
It makes the script very very hard to look through, and frankly it’s rare that I’ll get from Point A to B.
What I wanted to do was have the blueprint place part 1, then from there figure out that it can use X Y and Z there, and then continue off those branching paths correctly placing new pieces at the end of each part?
Below is a rather gutted version of the gobildygook that is my current set up, it doesn’t know what part is where, and frankly likes to block itself off.

So the short version. Is there any way to get my blueprint to recognize what part it put down last, and realize the branching paths off of it that need to be filled in?

Thanks for any help in advance.

What I do is to keep an array for each information type that each tile can be. Then, if I need to check and see what the current tile is, or what the surrounding tiles are, I reference the proper index in each of those arrays.

So for instance, I want coasts to spawn near land and nowhere else So whenever I am about to say whether a water tile is ocean or coast, it does a neighbor check to see if the Sea Level array is saying the nearby tiles are land or water. If any of the tiles are land, then set my Water Depth array to say how deep the water is.

I can do a neighbor check because I have worked out the math that knows where each index in each array is in relation to each other.

I use all the arrays to determine what the map is going to look like before I even generate it. So I generate the sea level array and later on I generate the water depth array to make some of those water tiles coasts.

For actual generation, I use switch on Enums to route the generation, and sometimes boolean/branches to see if the tile has had its trees cut down.

Here is a pic of my enum switching:

In your case, I would generate the map in such a way that only certain room types get generated along a predetermined path, and then outside of that path, you can generate everything else however it fits. You generate this before you place the rooms so that you can check and ensure you have the path you need.

Sorry my reply took so long,

I’m a bit green with blueprints, so what you do is you essentially make part arrays, of what can go off of Part X, and use an Enum switch to pick what goes with what, and then have each piece after the path is complete, figure out the indexes around it, prior to placing a part, so it can check what’s up.
So if I generate all the array locations (as each piece is equal in size) in an even spacing in a grid pattern and then generate parts over it, it would be cleaner and able to pick a path from point A to B?

In a way yes. First, is it land or water? If land, then what elevation? And then what temperature? And then what precipitation? After it goes through all those switches, the actual tile type is laid down.

Your setup might be something like: Room or no room? If room, how many exits? What directions are the exits? Etc.

So I use seeds to grow my biomes out. You can do something similar.

First, in your Room/Not Room Array, generate a line of rooms between A and B. Then, in the arrays that determine number of exits and direction, you need to ensure that all of those rooms have exits that lead from A to B. Then, for each of those rooms, you can decide if it has any extra exits. If they do, you can then grow side rooms and branching paths off of those exits.

All of that is done purely in the arrays. You will have the entire map figured out in the arrays before you use the enums to guide the execution to whichever room is to be spawned.

So I finally had some time to attempt this myself, and I noticed that you have your Enum Switching inside the construction script, and I’m curious as to why that is since you can’t make actors spawn in the construction script, is it just for flaging each point of the location array as being a certain piece to spawn in the normal blueprint or?
My responses are taking so long because I want to actually try out what we’re talking about before I ask more questions

My enums aren’t in construction script…

But you actually can spawn actors in construction script. That is what I used when I first started. The only difference is you can’t spawn during runtime with construction script, just in the editor.