Level Streaming

Hi,

First time posting at the forums and new to unreal engine (1 year).

I am using level streaming to increase performance. Whenever I unload a sublevel and reload that sublevel again it resets to its original state.

For example; when the player solves a puzzle (blueprint actor) in a sublevel and then moves around the level that causes that sublevel to unload (on actor begin overlap -> unload stream level) and load (on actor begin overlap -> load stream level); the player is stuck with resolving the same puzzle because the puzzle resets with the level loading. I have searched the web but couldn’t find a working solution. How can I make it so that the puzzle doesn’t reset once it is solved regardless of the level streaming? I can only use blueprints at this time.

Any help is greatly appreciated.

Thanks!

Hello,
you need to store puzzle’s state somewhere. When the puzzle is solved set its “solved” state to true. And whenever level is loaded read that state from variable and reassign to puzzle actor.
If the puzzle is more complex and single boolean isn’t enough to describe its state you may use more variables - integers, floats etc. whatever you need.

To save puzzle state you may use:

  • custom GameInstance
  • GameSave object
  • optionally, since you use level streaming you could also store that state information inside character or controller blueprint.

Hope it will point you in the right direction.
If you aren’t familiar with game saving there is plenty of tutorials for both GameInstance and GameSave object saving.

Thanks Exadi!

From the options the gamesave object looked like the option that was suited for my project the best. I got it to work up to a certain level. I am able to save a single puzzle and it loads perfectly after it unloads/reloads during level streaming. However I tried using the same gamesave object to store multiple puzzle completion statuses and this is where I failed. My understanding is that I overwrite all the Booleans in the gamesave object whenever I try to update a single Boolean each time a puzzle is completed.

Should I be using a different savegame object for each puzzle, or should I be saving under a different slot name for each puzzle? Both options doesn’t sound right so I was wondering what is the proper way of having multiple variances in a single savegame object and manipulate each variance at different times without affecting the others?

Thanks again for the help.

I reckon you run into that issue because each time you save puzzle state you create new SaveGame object which overrides old one. Try to load existing SaveGame object and save puzzle state to it.
Got problem with adding the image to the post so here is a link to function blueprint: Imgur: The magic of the Internet

Just an fyi - you could check out rama’s Save Game Plugin - Rama Save System in Code Plugins - UE Marketplace

Usable for BP and streaming support