3
\$\begingroup\$

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?

\$\endgroup\$
5
  • \$\begingroup\$ This may seem like an odd question but why do you need to depth sort an isometric game? Fixed camera == fixed depth? \$\endgroup\$
    – James
    Commented Jun 23, 2011 at 19:58
  • \$\begingroup\$ @James : to ensure which objects are foreground and which are background. \$\endgroup\$
    – Ali1S232
    Commented Jun 23, 2011 at 20:15
  • \$\begingroup\$ please give more specification what are the bugs and what is the result of the best solution your are looking for. \$\endgroup\$
    – Ali1S232
    Commented Jun 23, 2011 at 20:16
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 23, 2011 at 21:26
  • \$\begingroup\$ if you add more datails you will raise the chances to read the right answer. \$\endgroup\$
    – FxIII
    Commented Jun 24, 2011 at 7:58

3 Answers 3

4
\$\begingroup\$

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

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ 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 \$\endgroup\$
    – user502144
    Commented Oct 27, 2013 at 6:43
0
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

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