I want to create a save states when my player exits any level of my game and goes back to the main menu. But i was thinking how can i create a save game even if the game crashes ? Example of it would be if i play a map for over an 1 hour and it just randomly crashes then all my xp and loot + other stats would be gone…And this will be a huge set back… This game should work similar to diablo 4 lets say when game just crashes or whatever happens on returning back it aways have all the stats and loot. My game is not intended to save manualy but it has to save automaticly. Is there maybe an automatic sollution where all my stats are saved every 30 sec ? Would this approach result in some mini lags when it saves ? And would this awso mean that after hundreds of hours this save files may take a heavy hit on ssd space ?
I would like to hear any suggestions how i can make this happen and what would be a good way to do it. ty
So first things first- you can’t save on crash. The reason it works for things like Diablo is off-site always-running servers is where all the data is saved, so the only time it would be a worry is if the server crashes.
So what you’re getting at is autosaves- To minimize HDD usage you want to limit the amount of autosaves, and delete the oldest to make room for the newest.
Choosing when and where autosaves should happen is part of design of your game. Play any large-scale game and you’ll notice that after certain things happen there will be a save. Say, in the Witcher, you get an autosave after completing part of a quest objective AND you can set it to automatically save every so often-say every 10 minutes.
Ty, this was helpfull. Im just starting to work on saving the game and this is now the first time i really start to think how to do it. As it seems automatic saves are fine for me. Not sure if i really should go more then every 3 min so even if the game crashes then it would not be a huge setback but still not optimal. i wish i could make it less then 30 sec. Anyway i will awso make a save when a very rare loot drops and in the moment when it is picked up there would be a save as well. It would be devastating if it not save it.
Thx again i will see how this is acctually done and will try it out.