7
\$\begingroup\$

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?

\$\endgroup\$
4
  • 6
    \$\begingroup\$ Voxels in 2D?.. You know what, they're called pixels. \$\endgroup\$
    – Nevermind
    Commented May 3, 2011 at 5:59
  • \$\begingroup\$ 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. \$\endgroup\$
    – davidv
    Commented May 3, 2011 at 13:40
  • 1
    \$\begingroup\$ 2D blocks bigger than pixels are called tiles. \$\endgroup\$ Commented May 3, 2011 at 16:56
  • \$\begingroup\$ I think he means a 2D isometric view with heights (like Snake Rattle n Roll or Marble Madness) \$\endgroup\$ Commented Jun 23, 2011 at 20:55

2 Answers 2

3
\$\begingroup\$

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?

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – ghost
    Commented May 3, 2011 at 12:01
0
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .