Create an autosave/checkpoint feature for my game?

Hi,

I’m currently working on an action/adventure style game. I wanted to implement an autosave/checkpoint feature that will be triggered at the start of each scene. This will then allow the player to load into the latest level/area they were in from the main menu.

My problem is I’m at a total loss how to do this, the tutorials I’ve looked at so far have been that different from eachother I don’t know what I should be doing.
I’m still kind of a beginner with coding, so any help or advice is much appreciated!

People tend to make things too complicated. The question you have to ask yourself is, what’s the absolute minimum amount of data that you can save and still be able to reconstruct the savegame effectively? In some games, like Prince of Persia on the Nintendo, that can be as simple as a 9 digit numerical “passcode”. What’s the data that’s needed there? Stage number, checkpoint number within that stage, total time left, and a flag that says which health boosts you’ve gotten. That’s it.

The breadth and depth of your save functionality depends on the needs of your game- most games aren’t completely linear like the original Prince of Persia game, and so most can’t be saved into a 9 digit numerical passcode. But it’s usually not that much harder. Figure out what all you need, and make a data container type for all of that (literally just call it GameDataContainer or something). When it’s time to save, fill that container with all of the data it needs, serialize it into binary, JSON, XML, or whatever you like, then write it to the disk. None of your scene objects need to be “saved” per-se, you only need the data that’s required to reconstruct those objects at a later time.

I have no idea what the specific needs of your game are, so I can’t really be more specific. There are tons of threads / guides around for how to serialize / write to disk / load from disk / deserialize- it really isn’t much more complicated than that, just make a choice between binary (1s and 0s), JSON (strings, useful for storing on web servers), or XML (human-readable), and then run with it.