Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

4 Answers 4

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: gamedev.stackexchange.com/a/8181/36430 –  user502144 Oct 27 '13 at 6:43

Draw them in layers,sort them in layers?

share|improve this answer
    
i'm sorry could you explain what you mean, i'm not sure if i understand. Your saying we should break them into 1x1 tiles? –  Apollo Meijer Jun 23 '11 at 21:11

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:

http://bannalia.blogspot.com/2008/02/filmation-math.html

http://bannalia.blogspot.com/2008/02/isometric-room.html

share|improve this answer

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

 
discard

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.