Expose on Spawn - available for levels?

Hello friends,

a few fellow programmers and me are in the process of creating a mostly procedurally generated cross-platform game. Our basic architecture has a persistent level/world, which consists of several sublevels, which in turn consist of rooms that are divided into tiles. All procedural generation is (or rather, we would like to have it) handled/called in blueprint construction scripts. Now, we plan to use precisely one seeded random stream in order to have reproducable worlds, and what’s basically missing is some way to pass a reference to the random stream between the persistent level and the corresponding sublevels. As our rooms are modelled through actors, we can use the “Expose on Spawn” feature on SpawnActor calls for referencing between levels and rooms, however, i have not been able to find such a feature for levels. Question 1: Can this be done through blueprints, and if so, how should i go about it?

We do have a workaround in place which leaves the construction script unused and has a manual ‘init’ call after a reference has been set, however, i feel like there has to be some other way to accomplish that if only for consistency reasons.

On a related note, we have randomly placed entrances and exits for each level, and need to access those locations from other level blueprints in order to ensure connectivity. Question 2, once again: How would i go about this? Gamestate seems possible, but feels wrong…

Help is much appreciated,
thanks!

Hi ,

It sounds to me like what would be most useful to you is savegame objects. Using savegame object blueprints, you can pass information between levels without losing the data during loading/unloading. You can find that here:

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html

If all of the information is going to be streamed in, you should be able to access any info streamed once it opens, if you have information that is being unloaded at the same time, you should be able to use the save state to pass any values/information you need to keep track of into the next level, then when that level is streamed back in you can simply pass that information back.

If you plan on keeping the persistent level throughout and simply loading and unloading streamed content, creating a Game Instance blueprint and saving the information in there should serve the same general purpose, it depends on what specifically you are looking for.