Ask coding questions

← Back to all posts
Database For Text Game
Jackbaklava

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
T_R_W
Jackbaklava
Comments
hotnewtop
Coder100

Anyways, your current solutions are great!

Jackbaklava

@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?

Coder100

@Jackbaklava Sure, use something like firebase.

Coder100

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

Jackbaklava

@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.

Coder100

no problem :D @Jackbaklava

Coder100

nice idea btw @Jackbaklava

Coder100

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

Coder100

I think JSON is a great option as well.

Jackbaklava

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

Coder100
Jackbaklava

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