Saving and loading with the save system. In my game, I have some objects that may change names or what they show on their widgets. The player may take an object in their inventory or move another object. And all that has to go through the save and load system making the whole process very difficult. I also saw that documentation and tutorials are very scarce on that matter and I wonder why.
The way I made it work was to have a spawner in the sublevel that reads a list in the game instance, and saves and loads from it, adding and removing items accordingly every time the player enters the sublevel.
But that is not really level streaming, I could do it with just a collision box. So the bigger question is, is the streaming system able to do more than spawning and deleting static actors that the player can’t interact with?
None of the info I found covers that. It is easy to spawn an actor inside the sublevel once you are in it with that “owner” trick, but how can I do that from the persistent level? Saving and loading actors inside sub-levels has been the most frustrating experience I had so far with Unreal. Makes inventories and character set-ups look like child’s play compared. Any info or tutorial suggestions on the matter, free or paid, would be greatly appreciated.
I found that that spawned actors always exist in the persistent. You can allocate one to a sublevel actor with ‘owner’, but the spawned actor is still in the persistent, it just gets destroyed along with the sublevel actor.
What do you mean by ‘saving and loading in sublevels’?
I’m gonna have to think about your case. I use level streaming, but have no problems interacting or saving objects states.
If you could share the outline of your method it would be great!
The main problem is, I can’t save anything in a sublevel if it is not loaded, its contents don’t exist! So when I save from my save spot in my persistent level, there’s nothing to save from the sublevels.
So I find a torch in sublev A, then enter sublev B and save the game. When I reload the game I need to be in B with the torch. Do you mean like that?
More precise, I am in Persistent level. I get in SubLevel A and pickup a torch in my inventory. I exit Sublev A back to Persistent level and I save the game in the persistent level. When I load the game again, the torch will be back in Sublev A besides I have a system setup to not show picked up items because sublevA did not technically exist at the time I saved. So I have to save everything to Game Instance structures and load/unload things from these every time I enter the SubLevA. Like a complete separate save system that of course will have to exist for every other sublev. But it looks like a hack to me and not real streaming.
Hmm… So what about:
You go to subA, pick up the torch. Save game gets the player has torch set.
You can go anywhere else and eventually:
Restart the game in subG, the player ( or inventory system ), sees the ‘player has torch’, so you can use it.
When you reenter subA, the torch spawns but reads the save game and sees it has been picked up and destroys itself.
That works, no?
No it’s not exactly like that. There have to be lists of items in the game instance, which are then split into lists of what each level has, and then spawn what is in the list when entering. If I am in level a and want to spawn something to level b I have to add it to level b’s list so it spawns when b loads and reads the list.
I did that already, but it’s not what I expected streaming levels to be. I want to be able to save my game and my save game to KNOW what goes on in all the levels. When I add existing actors to a structure for saving it has to be ALL the actors in the game. I may be in London and spawn something in Paris. The engine should save all changes to the whole thing, not just the Persistent level. I didn’t know we should have one independent saving system for each level that fires whenever something is changed.
I wanted to be able to mess around all I want, pickup things, spawn others, move few others, then boom, save everything once and for all. I realize this can’t be done, and this is bad, bad news… But at least I want to make sure the “mutiple saving” is the only workflow so I bite the bullet and just live with it. I wouldn’t like to find out an easier way to do things after all this work, although it seems unlikely.
I sort of see what you’re saying. Of course, actors can’t do anything if their level is not loaded, but I guess you can write things into the save game which they will understand and act on when they are streamed.
It still seems to me that one save game system is all you need. I think that by trying to have separate save game systems in the levels, you’re becoming a victim of the technology used to load parts of the game.
I do think you can’t have a ‘save game now’ button. But when you spawn something in Paris ( even though you’re in London ), at that moment, you record in the save game you have done this. Just like you would if you had been in Paris.
So, you’re constantly writing little snippets to the save game, and saving it.
Any sense here, or am I totally missing it?
Yes, you can see what I mean now. Seems like my only choice is to keep saving and loading items inside each sublevel. I am still experimenting as to how this can happen. If someone wants to have interactable items inside a sublevel it looks like it’s more on the save system than streaming. I am afraid it will get too complicated as my game grows so I will look for the best way to have this made and present my chosen method here.