Whilst working on project X I have refactored the object format several times.
The reference data is a 10x 10 map grid.
The original format was a map object containing an array of layers with each layer containing an array of Map rows, and each map row containing a Map Col that had a member of TileType.
The file when saved was 70K, now this is not that big but it will soon mount up as the maps got bigger in size.
For the second file format I decide to use the same method from eVade,
I created an Array of int to store all the map rows and cols. I then store the row size and col size as variables allowing me to do some simple math to access each cell.
Example if I wanted to access row 2 col 3 it would be
Map[(2*10) + 3]
The file came to 3k a big improvement but still not good enough.
As you can see I'm storing allot of repetitive data, why am I serializing all the 0 if they are the default tile?
Attempt number 3:
Store the total row, col and layers as int for calculations, and declare a default Tile value (0).
This means I only have to now store the tiles that are not the default value.
In order to do this I created an array of Tile where tile contains definition for Type, Row, Col and Layer.