How to make a save feature for a text game in python?
I am currently woking with a text game but it's really loong so is there a way to make a save feature so that user can save the game in between and come back to play whenever he/she wants??
I want to save things like place,pokemon,dex,pokemn levels,user name..so help me!!
I am also working on a text based adventure game and just literally posted a question right now. You can view it here: https://repl.it/talk/ask/Database-For-Text-Game/51218
Here's some suggestions:
- You can save the player's data on a database like sqlite3 or mongodb.
- You can make a json file for all the accounts.
- You can use python's module pickle with
import pickleand use it to pickle the player's data and load it when player starts the game. You can read the documentation online, as it's really easy to use.
PS. Save the player's data in a class so that it's easier to save it.
Hope This Helps.
First test loading of game files and make sure you can get it so that your player class gets modified. Then all you have to do is add a save game feature that lets you output these variables back to a file in your directory system somewhere. Try doing this and let me know if you need any help afterwards.