Serialization method is in cube serialize.cpp. Copy it into wherever you need it, and feel free to fix the style. There are 3 parts in that code, separated by comments. Part 1 are the reference arrays, which should only be calculated once. Part 2 should be in the actual serialize method. Part 3 is deserialization, which isn't finished yet. The reference array creation could probably be a lot better, but this is just a quick fix.