Saving global dictionary into a save game file?

Hello! Im having trouble with a save and load system.I saw the Blendezo tutorial, but i couldnt get it to work. How ever i found a better one that shows you how to save in game data into the global dictionary, which is great.My question is…how do i save data in the global dictionary as a seperate save file? By that…i mean that if i turn the game off and play it again the next day i can reload my saved data from that file. Blendezos tutorial shows you how to make that seperate save game file (i understand that bit) but the part i need help with is what do i type to get it to save my global dictionary into that file.

In the Game Actuator there’s actually 2 options - save globalDict, load globalDict.

There you go!


Ok, got it.
the only problem i have now is im not sure what to type to have it save the level im on and player position.

So your real question is…

How do I save and load my game.

It’s great that you knew ABOUT the globalDict, but I’m guessing you have no python experience?

A dictionary object stores objects with a string key. You can do something like:

GameLogic.globalDict['playerPos'] = own.position

Which is run on your player object.

When you load it, you can do

own.position = GameLogic.globalDict['playerPos']

You should be able to figure out how to save other variables.

ah right!
thanks Sambassador