Save object data do corresponding level?

Hi!
I am a bit stumped with my save system i created. I am currently saving player data, object lcoations, and event flags in my “MaiNSave” save game obejct, and everythign works perfectly fine.
But now, while I was creating a new test level, I noticed that objects (if the player walks through a teleporter into the new level, and I do an autosave there) would apply the saved data (since the objects themselv ask if a save game exist and then apply that data on event begin play). I did that by adding the objects while saving to an array with their unique ID (display name).

So yeha, I should have known that objects in the new level apply that data to themselves since level 01 and level 02 both can hold an object called “BP_Chair”.

How would I go about telling the objects to only load the data if they are in the correct level?

FYI, here is the saving and loading command, maybe that helps because I really dont know what to do.


This happens during saving.
And this during event begin play:

The approach is ok, however there is one fundamental core logic is missing on your save system afais.

You need to coralate your levels with your save data, meaning you save per map/level not globally per object. This is generally for level actors, cause you want to save a level object to that level.

If not as you said if there is a chair moved in another level, its moved on other levels too as chair just looks for itself but not level.

At the same time some logic on save system is global like you save player health and player health is global you start with same health on all levels ( whatever is saved).

The easiest way is to seperate data types so you don’t have a problem. Like

PlayerSaveData
LevelSaveData
LevelObjectSaveData
PlayerProgressionData
PlayerInventory
PlayerSettings
VideoSettings

etc.

and easiest solution to your problem is to make save slot names atleast coralated with level as slot.

Level001_PlayerSaveData_Date_Time

etc having these kind of logic gates do solve a lot of problems.

  1. The problem you having as you can have many corelations with save data
  2. When you make a save you don’t have to save all the things. There is an elevator its moved so you just save level object data with elevators state (floor etc)
  3. It makes your game faster especially is a heavy usage like open world, you will not have to save everything and load everything at once.

I know that it creates a bit more work but its generally for greater good.

There is some plugins do those this way too however I strongly recommend creating your own system so you exactly know what is going on or have a greater idea of the problems if something goes wrong later on. Building the right save system for your game matters a lot, not too much, not too less just enough for your game.

Here is a better logic save game system that puts you in the right direction rather than a vague tutorial video. It doesn’t have to be exactly like this can be even much more better however it is a good starting point for an extendable system.

Let me know if works if you manage to coralate your save data with level (name) so you can have correct logic of saving objects.

Here is a sneak peak from my current game’s save system which still I am developing incrementally.


I have various functions to save specific data blocks on my subsystem and subsystem is always looks for coralated data ( ex level name) while saving a block.

Ex: Object saves its position in end play

loads its self if its data exists

it will never load itself if there is another level cause subsystem always looks for always data exist on that level. Which i also made on slot name as well as a struct value on bigdata.


Basically I save data always a slot coralated with level also to ini file

and when session starts I look for a slot (for now) coralated with that level

If not I auto create a new empty slot for the level, since even player manually doesn’t save the game I can still save progression, level objects etc.

If you just save your bigdata per level you will see that it is solving the problem you asked for