I'm looking for an efficient way to save my game coded in python. I've looked at pickle, but I'm not sure it will suit my needs as there is a lot of info that needs to be saved.
The way I understand pickle is it will take whatever I give it and dump it into a file, which sounds great. But not only do I have the player character to save, theres the rooms that the character has already been, the state of the rooms, if the user opened up treasure chests, etc. And if I understand pickle correctly, I would have to input each room manually for that to work.
Is there a better way to do this? Would I be better off creating a database of some kind? Or am I just not using pickle correctly?
Perhaps I'm missing something, but why not put all of the data you mention into a dictionary. It may even be a multi-level dictionary. Something like:
{
"player_info":{"name":"Bart", ..},
"current_state_of_game":{"cur_location":"library", "prior_room":"kitchen", ..}
}
Then pickle that?