- Home /
What's the best way to store a 2D array in a .dat file? (C#)
Hi,
I've recently created a little 2Dish dungeon generator of sorts using a really simple tile system. I have it set up so that all the tile coordinates and IDs are stored in an array, map_data[(x-coord),(y-coord)]. What's the best way to go about storing this information (in C#) in an external file on the disk, similarly to how games like Minecraft do it, and then re-accessing that file through the game?
$$anonymous$$inda depends on how you want to save the files. The most basic way would be to save them to text files http://support.microsoft.com/kb/816149
You'd just have to figure out how to format the file to make it easy to read.. like saving 1 tile per line including the position, etc.
OR you could use X$$anonymous$$L files http://forum.codecall.net/topic/58239-c-tutorial-reading-and-writing-xml-files/ which would probably be a bit prettier to read.. or JSON or some other file format..
Your answer
Follow this Question
Related Questions
Efficient method of storing coordinate values sequentially in an array 0 Answers
Tilemap 2D 1 Answer
Arrays vs. XML or SQLite: Fastest data storage/retrieval using JavScript/UnityScript? 0 Answers
Storing Level Data in Array of Array (grid-based game) 1 Answer
Store data for tile based system 1 Answer