I'm curious what solutions game developers have come up with for serializing the different types of data that they deal with for their games. Do you guys use some monolithic GameObject hierarchy that houses a serialization interface for derived types, use sort of custom RTTI-based solution, perform explicit stream serialization for certain classes, or use some of the open source solutions (boost::serialization, s11n, etc).
|
|
Protocol buffers from Google can be a pretty good approach for serializing c++ objects. You may have to make some intermediated objects as part of the serialization process, but it also works across many platforms and languages. |
||||
|
|
We in our game simply use boost.serilization, it's easy to use and very fast, but it's in my opinion just useful for savegames. If you try creating characters, i recommend you something XML'ish or JSON based things, because they are easy to read and editable even if you don't have the editor. |
||||
|
|
XDS was designed just for this purpose, it gives you the benefits of XML during development and the benefits of a compact binary representation at distribution time. |
||||
|
|
I rather like JSON for serialization. It is pretty simple to parse and there are free libraries available such as http://jsoncpp.sourceforge.net/ I've never been a fan of boost or RTTI in C++. Tinyxml also work well for xml serialization and deserialization. http://www.grinninglizard.com/tinyxml/ Ultimately I don't want to have to spend any more time than I have to for serialization. |
||||
|
|
|
Both jsonCpp and Protocol buffers are good options. To my knowledge both are only going to allow you to serial tree structures out of the box (please correct me if I am wrong). boost::serialization can handle arbitrary graphs, but doesn't have a nice text format like json (I think there is an xml format) Personally I think the approach for json serialization that Dojo has taken is the best I made my own version of it in c++ using jsoncpp, that also will deserialize typed objects (I have sort of big factory for all my types). It allows me to make a scene from a collection of json files that can be referenced anyway I please. |
||||
|
|
