Creating a procedural world with level as segments

Hello!
I’m building a procedural map that is created out of segments, right now this is done by spawning actors and those actors have sub actors. This doesn’t seem the right way to do it. It’s also annoying as editing segments needs to be done in the blueprint editor and I’m also noticing that it’s not as optimized as it could be. Here is my current output.

The obvious solution I think would be using level as a basis and spawning those as streamed instances. But when trying this gave me loads of problems.

First of all I can’t get any information from the loaded instance. I don’t even know when the level is fully loaded. I tried using bind Event to on Level Loaded but it doesn’t wait till all the actors in the level are loaded.

This returns 0 actors:


But when putting in a 1 second delay it works and returns 1 actor:

I really prefer to not use delay because building a map of 100 segments means I would potentially be waiting for 100 seconds for nothing.

I tried giving instanced levels ID’s by spawning them in a certain order but I also can not control the loading order of streamed levels. This is just a simple for loop of spawning 30 levels and iterating the Y-axis.
pic4
You can see that there is no real structure of the way the levels are loaded. so i don’t know how I would assign a consistent ID.

If I put in a delay and then access a spawned actor within the level I managed to figure out how to read the parent level like this but this doesn’t seem like the right way to do things

I also looked at the procedural plugin because it was free last year. it uses instanced maps but it’s terribly slow and the blueprint structure is kind of a mess.

The final thing I tried is using the PCG system as it supports levels too. Two problems it gave me is that it only takes static meshes and you need to convert it into a PCG settings file so it doesn’t allow editing. so it’s worse than my original actor spawning system.

Am I missing an obvious working methodology or is unreal not meant to do this? Should I just spawn actors and maybe make a program that converts levels into a collection of actors?

Would love to read others people’s ideas / suggestions.

Do you really need it all spawned at once like that? I use level streaming, but only stream the part I need next.

You can tell if it’s loaded by looking for the player start, which is placed in the level with a special tag on it.

I think it would be best to spawn the whole map in the beginning as the segments are quite small (less then 10m2) so you can easily see 10-15 segments in view. Might as well spawn the whole map. I’m also spawning procedural elements that overlap between multiple level segments and there’s enemy’s that would try to find the player within the maze.

if the whole map is loaded I could later unload streamed levels where both enemies and players aren’t near by. (but that’s not a concern for now :sweat_smile:)

Finally got it working!
Turns out Bind Event to on Level Loaded doesn’t wait until all the actors are spawned in but using Bind Event to on level Shown does!
I can then use that event to request data from actors that just spawned in to get the right spawning location for the next segment. quick video of the system working. its all event based so no delays :slight_smile:
generated

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.