[MUD-Dev] TECH: Serialization, dealing with changing classes.

Mark Kochanowski MJKTech at Earthlink.net
Thu Sep 5 10:19:39 CEST 2002


On Wed, 4 Sep 2002, Neil Edwards wrote:

> Hi there, I am currently writing a MUD from scratch in C# for
> learning the language and I enjoy writing MUDs. I was wondering
> how people get round the problem of Serializing objects (to a
> file) who's class may change and make the serialized version
> unreadable.
 
> I have tackled this problem previously with my java MUDs by
> writing XML based files and if something got removed from the
> class or added to it then the XML Parser would just not look for
> the item or give it a default if it didn't exist in the file. I
> was considering doing this again in C# but thought I would see how
> everyone else handled this.

I am in a similar situation. I am writing a MUD from scratch using
Visual Basic .Net.  To handle my data storage, I am using XML and
XSD.

What kind of objects are you serializing that the class may change?

For my classes I have (so far) 4 XML files: one for NPCs, one for
PCs, one for items, and one for rooms in the MUD. If I change my
classes, I also make the modifications to the XSD file, which in
turn adds a field when reading/writing each record in the XML file.

---
Mark Kochanowski
MJK Technologies
MJKTech at Earthlink.net


_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list