Skip to main content
GameDev.net gamedev.net
🔒 Locked

Saving 2D map data

Started by shadowayex May 9, 2011 at 8:45 PM 2 replies 2.1k views
Original Post
shadowayex
shadowayex
I'm making a 2D game that uses a tile based map system. I want to save information about each tile into a group that can be read back later. I've asked around about general ways to store data, and I've been suggested that saving the data as comma separated values would be an easy way to read and write the data, but I'm not sure yet.

I want the data to be able to be read and written by the game only, and I don't want the data to take up too much space (as there will be a lot of maps). The maps are of variable size. Some may have only a small area of tiles while others could span quite a bit.

I don't know much about different means of saving data to files (and the pros and cons of each), nor do I know anything about compression or anything (this was also suggested). I've read and written to files in certain formats, but the files were always text files and they were readable by anyone.

Can anyone point me in the direction of a good way to store and protect my data effectively?
GregMichael
GregMichael
"Can anyone point me in the direction of a good way to store and protect my data effectively? "

Protect your data from what / whom and why would you want to do this ?
shadowayex
shadowayex
Players.

The game isn't like an MMO game or anything (although it will feature some LAN co-op). People would just play on their own computers. If they got into the map data and messed something up, then their game would most likely not work, and that wouldn't make for a very fun game.

Assuming most people would know better than to play around in the game data, this shouldn't be a problem. But I just want to make sure that curious people don't mess up their copy of the game.
kdmiller3
kdmiller3
Compared to comma-separated values, a binary data format would be significantly smaller, faster to read and write, and less susceptible to end-user modification. You could apply some kind of encryption, but that seems unnecessary. As for compression, zlib or lzo may serve your needs.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.