I have already worked with isometric grids in the past, but in my current project I found an issue I am not sure on how to solve. I am trying to produce something similar to what's in the below screen:

Example map

What I am having trouble with is how to represent the tiles. With a flat 2d isometric grid all you need is an 2d array (even if you have elevation you can just have a z variable in there to track it and then render based on the z variable plus the z variable of nearby tiles). I am not sure how to proceed with this, however.

My plan was to have the map composed of 4-sided polygons that can be placed anywhere, and have a (x, y, z) position. Rendering is easy enough (start with lowest z tiles, go up to the next level, add any stairs that end on that level, keep repeating until all tiles are rendered).

However, how can I do collision checking? Checking if a point (a player) is inside the polygon is not too difficult, but how can I know whether he can move to another tile?

What would be best:

  • Have tiles holding a pointer to neighbouring tiles? (Seems like a lot of trouble to code for the editor).
  • Sort the array by Z-level, then search through the array for tiles that are close enough? (Seems slow)
  • Something else entirely?

1 Answer 1


One approach to a multilayered map would be an array (or 2-dimensional array) of linked lists or vectors holding tile objects. So your tile struct would either hold a pointer to the next tile above it, or you would have "stacks" of tiles of varying heights spread across the grid. Essentially that creates a 3D array.

A nice, albeit old article on multilayered maps would be here: http://www-cs-students.stanford.edu/~amitp/Articles/Tiletech.html

So for example, your tile struct would look like something along these lines:

struct Tile
    unsigned char type;
    Tile * next = NULL;

The map it self, if for example it was a 2D grid, would look like this:

Tile tile_map[rows][cols];

To then get a tile at a certain point to check whether it collides or not, you would iterate through the list at that point until you reached the desired z position.

unsigned char getTileType(int x, int y, int z)
    //Assuming 0 means an empty (air) tile
    unsigned char tile_type = 0;

    Tile * tile = &tile_map[x][y];

    //Iterate through the linked list of tiles  at this position
    int height = 0;
    while (height < z && tile)
        tile = tile -> next;

    if (tile)
        tile_type = tile -> type;

    return tile_type;
  • \$\begingroup\$ I'd like to avoid having it fixed to a grid (I am meaning to have multiple sizes for the tiles, which might make this more complex), but this is a starting point. Thanks. \$\endgroup\$
    – MKII
    Commented Jun 28, 2016 at 9:45

You must log in to answer this question.

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