Best Storage Method

I’m making a 2D Minecraft or Terraria style game and I’m not sure on how to handle the storage portion for each block. Temporarily I have three arrays called blockType, posX and posY. If I want to read and write each of these arrays in some file what should the format be?

Thanks.

This seems like a largely philosophical question. How are you going to be accessing the data? Do you just want to write the temporary arrays into the file and then read them back out? Do you want to store indexed entries and get an entry by index? Are you saving when closing the program and reading when opening, or accessing during runtime, and are you going to have multiple threads attempting to read the file at the same time?

Perhaps you should first look at serialization ([here][1] and [here][2]) to produce binary files. Or, you could write the data out in

[3] format if you prefer and it's not too large.

If you can give me a little more information on what you're trying to do, I can give you some better ideas on how to go about reading and writing the data.


  [1]: http://www.codeproject.com/KB/cs/objserial.aspx
  [2]: http://unity3d.com/support/documentation/ScriptReference/BitStream.Serialize.html
  [3]: http://forum.unity3d.com/threads/38273-Lightweight-UnityScript-XML-parser