Some smart saving tricks!

  • Save whole data on ESC pressed (if you have an ESC menu)
  • Save whole data on Left-Alt pressed (if player is about to ALT-F4)
  • Save data on a timer that ticks every 1-2 seconds. (see below)

These are some “smart-saving” methods I could think of. :smiley: What do you guys think, what else could be used? Are these methods good/bad? Will they cause optimisation issues?

In my case, I’m working on a small RPG project so I have to consistently save player data (stats/items/experience/currency/location/etc.).

Feel free to drop down any tips/tricks you use/have used for your games.

Are these supposed to be dev tips? Or under the hood implementation methods related to saving data?

Save data on a timer that ticks every 1-2 seconds.

I wouldn’t go this way. Sounds like a disaster waiting to happen. But intercepting keys is generally a good idea.

They are some ideas that came to my mind about making a simple auto-save system :slight_smile:

I was wondering if this case was a bad idea, could you elaborate what might happen if this was to be implemented? Currently I just have the first two options in my game.

  • let’s say you’re saving every 1s but saving takes longer than 1 second, now we’re in trouble
  • the end user has a :potato: PC with a slow HDD, and now they get a consistent frame hitch every 2s
  • player goes idle for 1h, during which we’ve unnecessarily saved nearly 2000 times; every 2s

a small RPG project so I have to consistently save player data

Perhaps saving could be done in an event based manner - when data changes?

1 Like

Great points, lol! I especially love the last one, saving 2000 times, yikes. :rofl:

Well these points are more than enough to disqualify that option then.

Looks like this is the direction I’ll be going in. Save after data changes - experience gain/quest completion/item looted and so on.

Great tip(s) as usual @Everynone! Thanks :slight_smile:

1 Like

I mean, it’s not a bad idea per se. It’s just that saving non-stop may not be necessary. You could consider a smartish system:

  • autosave if no save was done in the last minute
  • autosave only if data actually changed

When the player: moves, fiddles with inventory, clicks through dialogue, flips through options - set a dirty flag in the save game system stating that data needs saving. This could start a timer; if no other save happens in the next 60s, autosave now. Clear dirty flags. Any type of saving that you have already set up clears those flags as well.

  • pop an autosaving icon to warn the player?
  • let them disable autosaving / control how often it happens?
1 Like

Lovely ideas. Definitely have to make it “smart” if its going to constantly save.

If the 3rd option was to be implemented, this would be the best way to go about it. I think I will do something similar to this! Hats off to you.

Not sure if the best but I had something along the lines of:

In the Game Instance.


This is all pseudoscript, ofc, and would need to be tested for logic loopholes. But essentially:

  • ask the system to autosave when something important enough happens
  • execute the autosave after some time providing the player is not busy or hasn’t already saved in some other way
  • if autosave could not complete, try again
1 Like

Wow, thanks for dropping an example as well. Perfecto! :pinched_fingers:

1 Like