Skip to content
← Back to Community
Database For Text Game
Profile icon
SamKunefeh

Hello everyone, I am currently making a text based adventure game. The game has now got so big, that it can't be completed in one sitting. So, I need to store the Player's data and make it accessible through accounts. However the problem is that there are way too many things that I can do, but I am still a beginner. What Should I use to store the Player's data and accounts?

Here's some ways that I have brainstormed:

**Please tell me if these ways are efficient or not **

  • Pickle a file with the data and accounts. To load the game, I would have to unpickle it.
  • Store the data on some sort of database like sqlite3.

*PS. I have store the player's variables inside a class so that it's easier *

Any help would be appreciated.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
T_R_W
Profile icon
SamKunefeh
Comments
hotnewtop
Profile icon
Coder100

Anyways, your current solutions are great!

Profile icon
SamKunefeh

@Coder100 Thanks, but a problem is that these ways store data on a a file. So, I think it might be possible for the viewer to view the file and try other people's accounts. Is there any way to store data on the web and not on a file?

Profile icon
Coder100

@Jackbaklava Sure, use something like firebase.

Profile icon
Coder100

But for these things like passwords, you should be hashing them. @Jackbaklava

Profile icon
SamKunefeh

@Coder100 Yeah, that's right. I though of doing that earlier, thanks for your help. I think I might be pickling the player's data and storing the accounts using a hash table (dictionary in pyhton). Let me know what you think about it.

Profile icon
Coder100

no problem :D @Jackbaklava

Profile icon
Coder100

nice idea btw @Jackbaklava

Profile icon
Coder100

Also try repl.it-DB (turn on explorer mode)
Docs https://pypi.org/project/replit/

Profile icon
Coder100

I think JSON is a great option as well.

Profile icon
SamKunefeh

@Coder100 Yeah, but the players could use other's accounts as well.

Profile icon
Coder100
Profile icon
SamKunefeh

@Coder100 Because of json's readibility, players could open the file while logging into their account and try all the possible accounts.