Best way to save maps (2D) and how to achieve it

I have been looking around at how people are able to save maps in games and i have came across 3 diffrent ways.

  1. saving each tile as a pixel on a image: this way is basic and easy to do but there are some limitations. 1, filesize can get large if you try and save data in the gray scale value and you can only render a game from x0 - ~ and y0 - ~ and you cant use -1 quadrants, so this wont alow you to make a fully freerome game because 2 up and left will be limited.

2)Hard coding levels: i have found this only works with small puzzle type games and such and has the same flaws as the first type.

  1. lastly, a map file, this would allow you to use things such as (1,-2){} to pull specific quadrates and get information on the tile type, metadata etc.

I am looking to use the 3rd method in a game i am working on but i cant find a good, small libery for saving and loading tiles, dose anyone have any suggestions? and alos allow me to not only save the tile ID but also meta data.

  • John