I noticed that some games auto save. Some so well that it will remember where the music was, where the player was, etc.
The simplest way to make Autosaving is to just constantly update an external file with all the variables, but is there another way?
Actually this is not a bad idea.
Except when sometimes it is not good to save for example in the middle of a fight. But it depends on what kind of game you are making.
Maybe you can create some check points, save when it is safe.
The only variants I can think of are:
- Constantly save the variables but in the memory, so the game save/load faster. And only when quit the game or after some checkpoints/events (in case of kill the process or crash), save the data in an external file.
- Instead update all the variables in the external file, update only the variables that has been modified since the last save. For example player and dynamic objects position/animation/frame/state variables, music playback position, and so on will be modified constantly; while player level, items, etc. will be modified at certain events (level-up, pick item).