Sunday, July 12, 2009

I <3 my serializer class

Working more on the compiler today. I've created a new specialization of the serializer class to handle reading and writing to the game file. It has made my life SO much easier! No more fwrite array size, fwrite array elements or loop through array elements, fwrite sub-arrays...it handles it all for me. All I have to do is provide template arguments--and both the writer and reader is generated automatically! Plus, it's HELLA fast and handles compression (and encryption) automatically.

I think I could release this serializer class as a very useful library at some point. There are only a few extensions I can think of right now that would really round it out: a Copy type so that an individual element can be memcpy-ed instead of copied via copy constructor (for large elements), a way to support arrays of arrays...or serializers of serializers...for complex hierarchies, and a serializer "scanner" that lets you look forward and pull out only the array sizes from the next chunk to be deserialized.

noon
time to write the compilation code for the most complex game object: the map.

five
Client-side map compilation is nearly complete. It collects, sorts and tabulates all of the locations correctly and I'm about to implement my special compression trick.
...and it's done! from the debug output:
testing map is 512 x 512
testing map is now 511528 bytes; compression ratio = 4.4348%

No comments: