Topic was automatically imported from the old Question2Answer platform.
Asked By
peterhoglund
I’m looking into how to handle saving in my game. Down the line, I want to save many variables and I need to do it quite often automatically (there will only be autosave, the player will not press a save button)
Because of that, I don’t want to have to save everything in the game every time, only the necessary variables. What would be a good way to save specific variables to the save file and overwrite it if it is already stored?
Have a global script with a dictionary or array so it can be accessed anywhere
Update the values as normal.
Save dictionary to file on conditions like
The game quit
A stage got cleared
The player has the game idle
Save point reached
The saved file automatically overwrites the old one when saved so it may be a good idea to have multiple dictionaries or save files for things like configuration, progress, consumables, status