Saving/Loading in Runtime

Good day, all!
It’s my first time actually making a game that ISN’T 3 minutes long, which means I’m gonna need some sort of Saving & Loading system.

The logic bricks in the “GAME > Save bge.logic.global” is not what I’d use, correct? 'Did a bit of searching and it says the only way would be through Python, which is alright.

Anyone know HOW it’d work, though? And could someone point me in the direction of a script?
I’m thinking autosave, but saving manually is fine too. Whichever
Thank you! :ba:

Check the resources forum. Monster has made a great save/load system.

No-one is quite sure why there is a logic brick for ‘saving the bge.logic.globalDict’ because there is no way to write in it without python, so having it as a logic brick seems strange.

So the way to save a game is to

  1. Figure out what you want to save
  2. Store it in the bge.logic.globalDict
  3. Save the globalDict

And the way to load it is to:

  1. Read the globalDict
  2. Figure out where the values were meant to go
  3. Apply the values

The globalDict is just a standard python dictionary, and can be accessed the standard way. I tend to use it like:


global_dict = bge.logic.globalDict
...
global_dict['player_position'] = obj.worldlocation

And so on.

Is there a limit to how many things you can save?
And sure, I’ll check it out!!

Not exist limit.