Loading & Saving Structures with Object System

March 21, 2010 General News 0 Comments

Now that I've got the engines out of the way, there's really only one major thing standing in the way of a new GGrewve: data handling between sessions.  All these well-organized data structures look great inside a compiler...but one glaring downside to using object-oriented programming over my previous "hack-ish" data system is that loading and saving are no longer as easy as writing the data structure to a file - because such an operation isn't well-defined for arbitrary structures like it is for a data structures that consists of one large string (GDS and OS structures from the AHK code).  Loading and saving the structures from the c++ library requires a custom interface for each structure which is, to put it plainly, no fun at all.

For backwards compatibility, I've chosen to write all structures in Object System's encoding format.  It's not nearly as efficient as binary data, but it takes a lot less work to handle the data in lesser languages like AHK.  After writing a c++ version of the OS data system, to which most of my day today was devoted, reading and writing arbitrary data structures now consists of implementing an OS conversion interface for each structure.  That is, each data structure must be given a function for converting its data to Object System format as well as a function for loading its data from an Object System structure.

It sounds pretty straightforward, but in complex engines like gMSE in which structures are nested within structures that are, in turn, nested within superstructures, the task gets daunting.  Nonetheless, I've finished implementing loading/saving for all MSE structures and am in the process of writing the function for the gMSE space.

After loading and saving are out of the way, it should be relatively smooth sailing to the new GGrewve.