Isometric sorting, really hard to find?

Hello. I am running into problems when sorting my objects, well all is fine until an object takes up a certain amount of “height” as in Y pixels.

Here’s sort of what I am aiming at : http://retromedia.ign.com/retro/image/article/910/910219/dream-arcades-20080915023523710.jpg

Best solution I found so far is using an sorting strictly on an objects ScreenY position (getScreenY+getHeightInPixels)… to sort of find the “feet” of the player. But this does not work if an object (a house for example) is several tiles wide, since then when I walk along side it I will obviously get above the house lowest point while I am still in front of it, which makes the house draw over my character.

I’ve googled my eyes out, but only found some Flash AS3 examples etc, I do not know flash unfortunately.

I mean really, there must been many Isometric games made in Java, can’t someone help me out here? :slight_smile:

There’s no easy solution to that I’m afraid - for static objects you’re probably best splitting it into multiple sprites. Usually you want to do that anyway so you can piece them together in different ways in your level editor.

You can make OpenGL figure this out using the depthbuffer, as isometric perspective is 3D too.

http://www.java-gaming.org/index.php/topic,10237.msg82081.html#msg82081

It’s not 3d, it’s actually 2d only.

Point of isometric is to give the illusion of 3d, which requires this “depth sorting”.
I think it’s commonly referred to as 2.5D?

Just like that link you gave me up there.

[quote]It’s not 3d, it’s actually 2d only. Point of isometric is to give the illusion of 3d, which requires this “depth sorting”.
[/quote]
You can make the GPU solve this for you, pixel perfect, by using 3D geometry.

[quote]I think it’s commonly referred to as 2.5D?
[/quote]
So because everybody fakes isometric with some 2D algorithms, you don’t allow yourself work with 3D ? Ofcourse if you really want to work with 2D, that’s fine :slight_smile:

The screenshot in that link, was just a 3D scene, rendered in isometric perspective.

http://home.hccnet.nl/s.balk/static/isometric.png

Isometric perspective is achieved using a specific projection-matrix. You can easily handle the most complex shapes, even intersecting geometry, just like any 3D perspective, using the depthbuffer.

That looks like the exact thing I am after.
However, I’ve never ever worked with 3d.
Yes I do realize that using 3d and displaying it as isometric is a solution, one that I would have to learn from scratch…
However, isometric games been around for ages, there’s a ton of them. And I mean games that use only 2d :slight_smile:

I would not mind terribly to go down the 3d path, just that it’s a steep path indeed when starting from nothing.

What you’re doing (sorting by the Y and the height of the object) is the right way to do it if you’re not doing everything in 3D. However, if you’re doing this in OpenGL then you’re using ortho mode, and ortho mode uses the Z-buffer automatically anyway like Riven already said. So instead of changing the drawing order based on the Y, you can just make the Z coordinate match the Y (or whatever sorting you want) and rotate it towards or away from the camera (along the X or Y axis) based upon how it is meant to be aligned, and voila it’s taken care of. You don’t really need to know any 3D to know how to do this, it’s just clever usage of glTranslatef and glRotatef.

If you don’t want to deal with that, then Orangy is right - you’re just going to have to split the image up into multiple pieces. If you made yourself a level editor, you can just have it do that for you. Or even better you can have only one image but you can draw it twice - just trim your texture rect to only draw each piece where you want. This is cheap because you’ve still only bound that texture once.