Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a tile based isometric game.

The problem we are having is with depth sorting, we tried a lot of methods but none work.

They all do a great job but its not perfect, they seem to bug sometimes.

We have tiled objects of different sizes, like 2x2, 2x6, 3x4. This makes it so hard.

We are trying to avoid slicing the bitmaps.

Anyone has a idea?

share|improve this question
This may seem like an odd question but why do you need to depth sort an isometric game? Fixed camera == fixed depth? – James Jun 23 '11 at 19:58
@James : to ensure which objects are foreground and which are background. – Ali.S Jun 23 '11 at 20:15
please give more specification what are the bugs and what is the result of the best solution your are looking for. – Ali.S Jun 23 '11 at 20:16
There is at this point no best solution.. all have same problem and that is that 2 objects can share the same depth.. witch in theory is correct cause it is possible when they don't overlap. But for mathematical calculation this depth is important to other objects else the calculation for 100+ objects is to much for flash. We kind of need some sort of confirmation that this problem can not be fixed without approaching it from a different angle, like slicing them into 1x1 tiles. – Apollo Meijer Jun 23 '11 at 21:26
if you add more datails you will raise the chances to read the right answer. – FxIII Jun 24 '11 at 7:58

You need to compare your object's bound boxes and check if one object is supposed to be in front of each other, then apply a topological sort based on this information.

Here are some articles with further details:

share|improve this answer

You are experiencing the reason why many systems prefer to use a Z-buffer rather than the simpler but more error-prone painter's algorithm. Unless extremely strict rules are enforced on your objects, there is no way to sort them totally by depth without slicing them.

It would help if you could show us what your objects look like, how you compute depth, and an example of the bugs you mention.

share|improve this answer
It is possible to sort objects, requiring all of them to stand on the ground. It is not a strict rule and this case is rather common. One possible solution is described here: – user502144 Oct 27 '13 at 6:43

i too have been looking for a good way to depth sort different sized objects, i have thought that i could get the bottom x,y co-ords and if the x,y co-ords are higher up they get rendered first. Although they may be some bugs and i have not actually tested it or tried coding (im in the process of coding my theory in javascript with canvas). Although i have found a very good way to store the odered list in order of rendering, it uses a technique to dramatically increase efficiency in ordering a list, it is of course a BinaryHeap array Here is a good article about it Hope that helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.