I want my level generator to get data out of a sublevel BEFORE streaming it in

Hi. :slight_smile:

I want to build maps out of randomly selected sublevels or “dungeon rooms”. Each sublevel is a Level with:

  • Entrance and exit connectors in arbitrary locations
  • Scenery extents so the level generator can avoid collisions

As of now, it only “has” these locations in that they exist in the sublevel as objects (arrows and a cube), but the level generator needs to know about them before streaming in the sublevel so it can avoid painting itself into a corner.

I see two ways to do this, neither of which is straightforward:

  • Make the level a child of Level (or rather World), add class properties, fill them out with an editor script when placing the connectors/scenery and retrieve them as class defaults before streaming in the sublevel. Doesn’t work because you can’t make children of Level (or World).
  • Instead of streaming in a sublevel, the level generator would spawn an actor that streams in the actual level and calls back to the level generator to tell it where the connectors and extents ended up. As far as I can tell, there is no way for the actor to retrieve this information before streaming in the sublevel, and there’s no way to unstream the sublevel if it is spawned in an obstructed location. So I would have to build the sublevel and then manually type in the location of each connector and the size of its extents into the actor and have the level generator retrieve them via class defaults, which is error prone and adds an annoying amount of friction to creating (hundreds of) sublevels, not to mention having to spawn (hundreds of) actors with no gameplay functionality.

Still, the latter option seems like the only viable choice.

Does anyone have a better idea?

When you construct the sublevels, you can store information about their structure somewhere ( using a tool you wrote in BP ), and then later read it back before spawning the level.

Where you put it is up to you, but I would recommend the save game.

You can write to it from the editor, in editor mode. And then read it back in game mode.

1 Like