A
Antimon
Hi,
I'm working on a gameserver (not a huge project) and i need to save the
whole world state to somewhere.
Game world will be object oriented and there can be many different
class types so i cant just create 4-5 tables on a database and store
information. So i wanted to have a "ISerializable" interface with two
methods: "Serialize" and "Deserialize". Serialize will return that
objects byte[] representation and Deserialize will use a byte[] to
construct the same object from scratch.
All "ISerializable" objects will be mapped in a static
"Hashtable<Serial, ISerializable>" where "Serial" will be an id number
class assigned to each ISerializable on construction. So i can write
Serial id's as object pointers while serialization.
This approach seemed to be fine to me. So i'm thinking about
implementing it on filesystem or an rdbms. If i use a rdbms, there will
be 2 tables One for class types, one for object instances. I will be
storing binary data on database (returned from Serialize method).
It seems that there's no point on using an rdbms for something like
this but if i use filesystem, i will need to suspend server each 30
mins or something and dump all world into a file. So, a crash may cause
a timewarp. If i use a rdbms, i can have a continious saving mechanism.
I can place modified objects into a queue, and a thread can write them
to the database continiously. So if server goes offline for some
reason, i would only loose data on the serialization buffer which will
not be a comparable amount to 30 mins. And rdbms system would allow
splitting the server to 2 machines (one for server application, one for
rdbms layer) w/o any effort.
On the other hand, filesystem mechanism will be very easy to implement
and maintain.
All suggestions are welcome Please help me decide what to do.
I'm working on a gameserver (not a huge project) and i need to save the
whole world state to somewhere.
Game world will be object oriented and there can be many different
class types so i cant just create 4-5 tables on a database and store
information. So i wanted to have a "ISerializable" interface with two
methods: "Serialize" and "Deserialize". Serialize will return that
objects byte[] representation and Deserialize will use a byte[] to
construct the same object from scratch.
All "ISerializable" objects will be mapped in a static
"Hashtable<Serial, ISerializable>" where "Serial" will be an id number
class assigned to each ISerializable on construction. So i can write
Serial id's as object pointers while serialization.
This approach seemed to be fine to me. So i'm thinking about
implementing it on filesystem or an rdbms. If i use a rdbms, there will
be 2 tables One for class types, one for object instances. I will be
storing binary data on database (returned from Serialize method).
It seems that there's no point on using an rdbms for something like
this but if i use filesystem, i will need to suspend server each 30
mins or something and dump all world into a file. So, a crash may cause
a timewarp. If i use a rdbms, i can have a continious saving mechanism.
I can place modified objects into a queue, and a thread can write them
to the database continiously. So if server goes offline for some
reason, i would only loose data on the serialization buffer which will
not be a comparable amount to 30 mins. And rdbms system would allow
splitting the server to 2 machines (one for server application, one for
rdbms layer) w/o any effort.
On the other hand, filesystem mechanism will be very easy to implement
and maintain.
All suggestions are welcome Please help me decide what to do.