We are making a reinforcement learning algorithm for our class. And in this progress we want to make a savestate for a nes-game which is made using the gym-retro package. We have tried using pickle to save the game environment but it does not pickle gamedate objects.
TypeError: can't pickle GameData objects
Is there any way to save the gamestate that we don't know about? This is part of the code we use:
def SaveEnv(self, env, level):
self.env[level] = open('store.pckl', 'wb')
envDict = {}
envDict[level] = env
pk.dump(envDict, self.env[level])
self.env[level].close()
print("Save Successful")
env = retro.make(game='TinyToonAdventures-Nes')
env.reset()
SaveEnv(env,level)