Sigma Freud
Sigma Freud

Reputation: 57

How does one most efficiently store player data in a Python MMO game?

I am developing an MMO shoot-em up similar to the game Realm of the Mad God in Python 2.7.

Player data for the game will include equipment worn, the player's name, etc. for each player of the game, so that when they log off their character, their player data will be saved and preserved in a permanent manner, and when they log on again, their player data will be loaded onto the game. To be safe, I am estimating that the number of unique player data entries will be 1,000,000 entries.

Is it perhaps more efficient to store all player data in one massive txt file, or perhaps 26 files, or perhaps 26*26 files? What is the best way to arrange these entries?

Example entry:

"player1023"|13|1023|482|9|1|4|5|9|3

Upvotes: 1

Views: 860

Answers (1)

Emanuele Paolini
Emanuele Paolini

Reputation: 10172

If you don't want to use a database (most natural here), I would suggest to use fixed width records in the file (let say all lines are composed by 80 characters. That way you can achieve a very quick binary search to find lines and you can overwrite a single line without the need to rewrite the whole file.

Upvotes: 3

Related Questions