Isometric 101: Easy question for expert

Started by
5 comments, last by EDI 18 years, 10 months ago
Just curious if there are any experts that can shed some light on how to successfully determine when the place the wall BEFORE or AFTER the placement of the character. As you can see from the diagram - character 1 is partially obstructed from wall and character 2 is in front of the wall. in senario 1 - obviously character 1 is placed first then the wall is placed after. in senario 2 - the wall is placed first and then the character 2 MY QUESTION: What is the best way to do this? How do you determine when the character is postioned in such a way as it needs to be placed BEFORE or AFTER the wall. Should i use hotspots? (as also shown in diagram) Or am i doing this completely wrong? Thanks Bill
Last Half of Darkness Developerhttp://www.lasthalfofdarkness.com
Advertisement
Back when I was still doing isometric, I always chose to align my pieces of wall with the front left and right edges of a tile. That way, I would always draw any objects that were on the tile first, then draw the wall last so it correctly overlaps everything else. Of course, you could always use 3D, leverage the awesome power of the z-buffer, and just not worry about it anymore. [wink]
What you need is not a fixed depth value for the entire wall, but a way to determine the depth of the wall at a given point.

Your entire wall seems to be one big block image. Store a piece of data for this wall which is just a 2D line from the near-ground corner to the far-ground corner. When sorting objects, test not against the Y position of the entire wall, but the Y position of the wall at the point directly above or below the other object's base. If the wall's base is above the other object's base, then the wall goes behind. If the wall's base is below, then the wall goes in front.

If the object's bounding box doesn't intersect with the wall's bounding box, then it doesn't matter which gets rendered first relative to eachother, but you should render the one with the lesser Y position first (just to reduce data shuffle, if you're using an array for sorting).

And now, illustrative ASCII art...
 a    c     /  D / E   /   b


a = wall x/y
b,c = wall base left end, right end respectively (expressed as relative to point (a).
D = object behind wall
E = object in front of wall
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
This might help.
The code is in Blitzbasic so should be easy to follow.
http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=turtle177605122002175421&comments=no
You can download a demo of Bliztbasic (Blitz3D) if you want to see it running from www.blitzbasic.com or use notepad to check the code.
You can render everything from the left-to-right, top-to-bottom so it's always rendered in the correct order. You may need to do multiple passes if you have more than one layer.

GDNet+. It's only $5 a month. You know you want it.

Tom; his problem is that the wall is one big sprite, not a general tile-vs-tile sorting issue.

What wrf needs to do is implement a more generic sorting scheme which takes all objects on-screen, and sorts them by behind/ahead with their shape-specific baselines, not their generic positions.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
lol, we going to be seeing Last Half of Darkness: ISOMETRIC, now? [grin]


What you are looking for, by the way, is a solution that a GDNet member came up with a while ago (his name was CrazyMike), when we were having the same problem.

I coined a name for it, Large Object Rendering Method or LORM

we use it in MW and it works, really great =)

Here is the thread the solution came from (whoo look at that date!)

My Unsolvable Problem

And here is a very good thread about how it works (numerical draw order chart)

Here


Good Luck ;)

[Edited by - EDI on June 21, 2005 2:52:36 PM]

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

This topic is closed to new replies.

Advertisement