I am having some problems drawing my entities in an isometric map.

Tiles are drawn using Painter's algorithm to do the z-sorting which works great for the tiles alone. Entities are parented to a particular tile and have an offset within it. They are drawn immediately after their parent tile. The problem is that when the entity is too far right or too far down; the next tile(horizontally to the right, or vertically below) is drawn over parts of it like so:

enter image description here

(Note, currently my player has his registration point (red circle) a little higher than right at the bottom, just to better approximate the centre of his feet.)

A couple of ideas I had to try and remedy this:

1) To simply offset the position of entities to move them so that they will always draw in a place that won't be drawn over later. I really don't like to add in strange offsets that must be compensated for all over the place but this seems like a viable option.

2) To draw everything tiles and entities, using painter's algorithm. Entities would not need to be parented to a tile anymore but every renderable graphic would need it's drawing position offset. (Tiles would have their point at the very top, entities at the very bottom so that painter's orders things correctly)

3) Implement some kind of layering system so that all floors are drawn first, then things behind entities etc etc. This seems complex and would change from scenario to scenario. As my game will have randomly generated levels, I feel this isn't the right solution.

So, do any of the above have merit? Do I have it all completely wrong and there's another solution I've missed?


1 Answer 1


I think that layering is the way to go. Layer 0 would be the ground, then layer 1 would include everything that is on the ground, and finally layer 2 would be anything above the ground (blimps, clouds, etc.). Add/remove layers as needed. Each layer would be painted in order, and a painting algorithm would be used to order the entities within each layer. Randomly generated levels or not, it shouldn't really affect the layering system.

  • \$\begingroup\$ How would walls work in this method? I mentioned randomly generated levels as without them, you can design your maps around this problem although it's still limiting. With layers like this an entity can't walk in front of and behind the same wall tile. \$\endgroup\$
    – Munchface
    Sep 10, 2013 at 17:59
  • \$\begingroup\$ That's where the painting algorithm comes in. You'd want the entity and the wall to be on the same layer. Within each layer, you'd draw from the top of the screen to the bottom. \$\endgroup\$ Sep 10, 2013 at 18:06
  • \$\begingroup\$ Gaah. Facepalm moment. Thank you for your answer and clarification. \$\endgroup\$
    – Munchface
    Sep 10, 2013 at 18:09

You must log in to answer this question.

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