# How can efficiently I edit my 2D tile-based maps?

I've been developing a very basic 2D tile-based game for my own experience. I read what must be hundreds of tutorials on what I found on Google with "tile based maps".

Almost every tutorial I see is an engine that reads a text file and loads tiles based on the numbers in the file, such as:

0,0,0,0
3,0,0,3
2,0,2,2
2,0,2,2


But what if I were making a map that contained several 100 tiles?

surely there's an easier way to make a map than by writing a ton of numbers into a text file? How can this be done quicker?

An idea I had was making the world a single layered image: A layer for the objects/sprites/characters and another on top of that for tiles that should be under you like walls, trees, etc.

Is this possible/worthwhile?

• Almost all tiled maps are created with special editors that let you "paint" with tiles as brushes, and have lots of built in helpers to make the job easier. There's definitely not a lot of writing text files except for very small test maps. Search google on "tile map editor" for a good overview and lots of examples of these kinds of editors! – Patrick Hughes Jun 19 '13 at 2:38
• thanks for your reply mate, yeah right now i'm currently using tiled. but most loaders i've looked at have very little explanation of how they work and i gave up figuring them out, right now i use Tiled to make the map, save it as a image and add it onto XNA.. that way i just use a single image as the entire map, ill be putting a grid over the top, add invisible collision tiles and then a layer on the top of that for eg top of trees and walls that the character goes under when moving over the top of the tile.. is this possible and/or a viable way of mapping? – kraze Jun 19 '13 at 2:50
• You seem to be concerned with the by the size of your text file. Don't, just have something working and see if there is anything to improve ( regardless though, your map size will always grow the bigger your level is ) – Sidar Jun 19 '13 at 7:13
• Your idea of the image is one that pops up often, and is useful, because if you do it right, you've instantly got the map for your game already coded! The catch is, that if you're writing pixel data with RGB values, then essentally all you're doing is saving a 6 digit hex number instead of a single "Index" number as you've been finding. The principle is identical, with many of the same hurdles. Both are useful. Most maps for 2D games are going to be one or more layers of ID numbers as you've found. You can shrink them using compression such as Run-length encoding or LZH or anything else. – Phil Jul 19 '13 at 11:48
• @kraze The image idea scales incredibly poorly. The maximum size of a texture is around 8k by 8k and most cards can only handle 2k by 2k. Whats wrong with saving it as a .tmx file and loading that in? bitbucket.org/vinull/xtiled – ClassicThunder Jul 19 '13 at 15:27