I am developing a Gameserver, since i have to store the progress of every player, i have the question:
What it the best data Storage solution for my case?
Some facts:
At the moment, every Player is a Row in my MYsql-Database, having a unique id and name.
Every player has a World.
Every world contains a growing set of regions (as the player moves forward).
And every Region contains a set of landscapes.
Here comes the problem.
I want to add new landscapes as easy as possible, so i have this simple concept:
i have an interface landscape.java containing only one method called doit(String command)
Every implementation of a landscape is doing fancy stuff in their doit-methods without me having to change any code.
Now i have to store the world of every player, here are some ideas/options i thought of
-
Storing everythin in a database would require me to create tables for every implementation of a landscape. would be a bad solution imo
-
Serialisation was another idea, perfect because i do not have to worry about anything simply cast to landscape and fine. But i have my doubts, how should i edit the data, whats to do when i update the classes, how do i roll out changes to the data.
-
Frameworks like Hibernate, JPA etc. (i have no deep knowledge in them, could this be helpfull in my case?)
-
Writing my own file-format, changes in my strategie or other ideas?
Some perhaps inportant information at the end:
-
Saved data has to be editable
-
storing is not time-critical and should be done in normal time
-
Since all data is cached in memory, i do not really care about it being fast, it more likely has to be reliable
-
possible to use are PostgreSQL/Mysql and Filesystem.
I am not experienced in this field, so please give me a hint if i’m going a wrong way 😉
I don’t see anything which suggest you should chose one approach over another.
Some people will have a preference and I would go with whatever you prefer.
If you are going to Serialize your data, I would use a Text Serialization which makes it easy to edit it in a text editor. e.g. XML, JSon, CSV.