# How to store 2D tile-map

I want to create a 2D map composed of small tiles, that should look like voxels (eg. this just from side).

I think I can make a structure like Voxel2D, that have int X, Y and some Color, and every Voxel2D is going to be 5x5 pixels (so multiply X and Y by 5 when drawing).

But now how should I store the whole map? In a 2D array like classic Tile-map, or is there any faster way?

-
Voxels in 2D?.. You know what, they're called pixels. –  Nevermind May 3 '11 at 5:59
Yes I know, but I wanted to desribe the graphical style I want to achieve and when you look on that video (and I hope it is build from voxels), they arent 1x1x1 pixel, but a little bigger. –  davidv May 3 '11 at 13:40
2D blocks bigger than pixels are called tiles. –  eBusiness May 3 '11 at 16:56
I think he means a 2D isometric view with heights (like Snake Rattle n Roll or Marble Madness) –  BlueRaja - Danny Pflughoeft Jun 23 '11 at 20:55

You wouldn't call it voxels when it's 2D, it's just tile based. Array storage should be what you are looking for.

Edit: I can't help wondering if there is more to your question than I read, and I don't really get why you choose a 3D game for explaining your idea. Do you just want to be sure that you are working in the right direction or is there something that you don't know how to implement?

-
Like eBusiness says, an array is your best bet, but you might want to consider dividing your map in smaller chunks (for example one chunk per screen) and only load each chunk when that area needs to be drawn onto the screen. This is more memory friendly when dealing with large maps and loads of attributes per tile. –  ghost May 3 '11 at 12:01

You can also employ 2 arrays rather then one, with one as a map array containing "tiles" and one is a tile array containing predefined pixols(5x5 or less),when needed you can still modify this pixols but you have to make a new tile array rather then a predefined one.

The good thing about this is that the non modified ones can be predefined as image tiles until they are broken up.

Note however that worst case scenario is the same as having just one array full of pixols.

-