Posted elsewhere, but I think maybe my question pertains to Blueprints more than to anything else.
Up until now I had only one persistent level with several sub-levels in my projects. I’d load one “main” sub-level and then stream (load/unload) other sub-levels as needed. My projects were of a small scale and it worked fine for me.
Now I am wondering how does one go about setting up level structure for a single-player game with let’s say 20 levels. I’d like to have one or two hub levels where player comes back after beating other levels (let’s say a town from which player can go into caves, catacombs, another districts, etc.)
Do I still keep it in the same format with one persistent level and bunch of streaming sub-levels ?
Do I need to make each level to be a persistent level? In this case, how do I unload level once players beats it and how do I load next persistent level ?
How do I transfer stats (opened/unlocked doors, some dead enemies, solved puzzles, etc.) from one persistent level to another ?
I think it depends on the type of game you are making. If you are making a full open-world game without any “loading” then you probably want to have all your levels as sublevels and stream them in. However, if you can have loading, I would suggest this structure:
Create a separate map for each discreet level
Create Overworld (like a town in your example) that serves as a hub for the Player - once Player leaves town, load the new map (OpenLevel node).
Break up your map (level) into several sublevels and load/unload those sections as the Player goes around your level
This means that your big maps are nicely separated in different maps, yet the maps load fast because you only load the first sub-level on the map, and then dynamically load/unload parts of the map as needed.
As far as saving data from level to level, use a class like Game Instance. Any variables saved in that Blueprint will persist from level to level. You just have to create a system to save variables and load variables to Game Instance on Begin Play.
Tbh, I dont think there is a downside besides it can get messy with so many sublevels (say you have 20 main “levels” and each level has 20 sublevels or more). I would just be really organized in how you set up your sublevels to keep them manageable