Mindnumbing problem with Saved Games

I am making a platformer that is made up of several levels. All of the levels are loaded into a persistent world. When the player finishes a level, they are given the opportunity to save their progress. If the player wants to play a level they have previously beaten, they are given the opportunity to select a level in the load game screen.

The game saves and loads progress correctly if the player plays each level sequentially. However, if the player loads a level they had previously beaten, and then reaches another level they had previously beaten, the save game file will load in the wrong level the next time the player loads a game.

For example:

  1. The player beats and saves levels 1, 2, and 3. The player quits the game.
  2. The player loads their save game, but decides to play from level 2 again.
  3. The player reaches level 3 and saves the game. The player quits the game.
  4. The player loads their save game. The order of the saves is now incorrect, so any attempt to load a level will result in the wrong level and data being loaded.

When the system is working correctly (i.e., the player is saving levels sequentially and not returning to previous levels), print stings return something like this:

Loaded 3, Reached 3

However, when loading a level that is out of order and saving again, the print strings return this:

Reached 3, Loaded 2, Reached 3, Loaded 2

I would expect a correctly saved game to look like the second image, while an incorrectly saved one might look like the first, but the opposite is true. The save game system is large and a little complex, so I’m not even sure what part of the blueprint I should attach.

There’s one common error I see a lot, which could be causing this.

You can’t write to the save game unless you’ve just read it.

What I’m saying is, if you just write, at any point, and don’t have a perfectly up-to-date version in the reference, you will blank out some part of the SG when you save it.

It’s possible it could be this, so take a look here.

Other than that, you’re right, there’s nothing worse than trying to troubleshoot someone else’s complicated save game :slight_smile:

Maybe you could describe the concept. How it is supposed to work? How many checkpoints etc…

I’ve reduced the complexity of the system a bit, so I think I’m getting closer to solving it. I might post again and tag you if I can narrow it down to a specific problem. Thanks for your help.

1 Like