Save/Load Properties from text - Finally did my first one, and it was quite painless!

I finally did my first Pickle -> Unpickle


import bge
import pickle


def main():
    scene = bge.logic.getCurrentScene()
    cont = bge.logic.getCurrentController()
    own = cont.owner
    ActorData=[]
    Actor=[]
    for objects in scene.objects:
        if 'Team' in objects:
            if objects['Team']==0:
                Actor=[]
                Actor.append([objects.name,"Empty"])
                PropNames = objects.getPropertyNames()
                for Props in PropNames:
                    AList = [Props,objects[Props]]
                    Actor.append(AList)
                print(Actor)        
                ActorData.append(Actor)
                print('_______________________________')
                print(ActorData)
    for data in ActorData:
        print(ActorData[0][0][0])
        for prop in ActorData[0]:
            print(prop)
    path= bge.logic.expandPath("//")
        
    path += '/Saves/'
    file = 'Maps.txt'


    #SaveData
    
    with open(path+file, 'wb') as f: 
        pickle.dump(ActorData, f)                        
                    
    #LoadSavedData


    with open(path+file, 'rb') as f:
        gameData = pickle.load(f)                
    print(gameData)            


main()



This is just a test, but it worked just like I thought it would the first time :smiley:

Congratulation!

I hope you see saving/loading is really no issue, when you use a library.

If you check your code you should recognize the most work is in the storing the model data into a sufficient savable structure = storing (and back = restoring). As this is specific to your game you need to spend the most effort on that.

yeah, already tested and it works !
(JRPG template should be available sometime this week)