简体   繁体   中英

In python, how would I go about creating a save system for a text adventure?

Basically, a continue from left off system... kinda like any game has. So far the idea I got going is to save the certain variables into a text file like name, health, xp, etc. and have a location variable that determines where the player is in the game and will act as the continue from left off. Is there a simpler way about going about doing this?

Save all this information in some sort of object and pickle it. https://docs.python.org/2/library/pickle.html

You could use pickle or json or xml . See also this question. Or this one. Or just google data persistence .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM