简体   繁体   English

在python中,我将如何为文本冒险创建保存系统?

[英]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. 到目前为止,我的想法是将某些变量保存到文本文件中,例如名称,运行状况,xp等,并具有一个位置变量,该变量确定玩家在游戏中的位置,并从头开始。 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 https://docs.python.org/2/library/pickle.html

You could use pickle or json or xml . 您可以使用picklejsonxml See also this question. 另请参阅问题。 Or this one. 还是这个 Or just google data persistence . 或者只是google 数据持久性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 python 中为基于文本的冒险游戏创建保存系统? - How can I go about creating a saving system for a text based adventure game in python? Python-我将如何去做? - Python - How would I go about doing this? 如果/其他循环系统该如何解决? [基于Python GUI的冒险游戏] - How would I fix my inventory if/else loop system? [Python GUI Based Adventure Game] 我将如何在Python中创建另一个int()函数,以便我能理解它? - How would I go about creating another int() function in Python so I can understand it? 我将如何使我的Python评分系统工作? - How Would I Go About Making My Python Scoring System Work? 我将如何创建一个可以从应用程序内部更改 Python 代码的应用程序? - How would I go about creating an app that can change python code from within the app? Python 2.7:如何创建一个字典,将前n个数字映射到它们各自的正方形或立方体? - Python 2.7: How would I go about creating a dictionary that maps the first n numbers to their respective squares or cubes? 如何在pygame中创建流畅的相机运动? - How would I go about creating smooth camera movement in pygame? Python-我将如何从 html 文档中获取文本块 - Python-How would i go about getting block of text from an html document 我如何在Pygame中制作可点击的文字? - How would I go about making clickable text in Pygame?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM