Sign in to follow this  
JoHnOnIzEr

Isometric help

Recommended Posts

JoHnOnIzEr    146
I havent started to code anything as I am just writing down my ideas so here goes. First, for those of you who have made these types of games, how do you handle walls (being able to walk behind them and be hidden and walk in front of them also)? Are they seperate from the first layer or are they like wall slices that are attatched to each tile, or are they some large object that is only anchored down to one tile but spans over several? Also, how would you handle objects like that? Objects that span over multiple tiles brings up another question. How would you be able to use the mouse to hover over these objects if the mouse is not over the tile the object is anchored to? Basically, if an enemy/object is on tile A but leaks into tile B (above A), and the mouse is on the part that leaks into tile B, how would I be able to know that I am putting the mouse over the enemy/object rather than tile B beneath him? I think that was all of my questions for now. thanks in advance :) [edit] fixed the subject

Share this post


Link to post
Share on other sites
JTippetts    12970
Quote:
Original post by JoHnOnIzEr
I havent started to code anything as I am just writing down my ideas so here goes. First, for those of you who have made these types of games, how do you handle walls (being able to walk behind them and be hidden and walk in front of them also)? Are they seperate from the first layer or are they like wall slices that are attatched to each tile, or are they some large object that is only anchored down to one tile but spans over several? Also, how would you handle objects like that?


Typically, I use wall slices, where each tile owns only the piece of wall directly on top of the tile. Wall sections can be anchored to a tile such that they are drawn along one of the four edges of the tile (left-back, right-back, left-front, right-front) and additional modifiers could possibly be used to indicate of the wall should be drawn "up" from the tile, or if it should be drawn "down" from the tile--possibly for a cliff or pit descending below ground level.

Using wall slices in this fashion makes things easier for my random dungeon generation routines, which can place walls on tiles then run a translator routine to puzzle the pieces into place.

You need to define the drawing order for each tile--floor, back walls, contents (objects, characters, etc... in whatever order you require) front walls, roof. There are, of course, going to be little inconsistencies in the way sprites overlap when all layers are drawn on a per-tile basis. Read through numerous backposts in this forum to get all the vile dirt on the problems of isometric sprite overlapping and rendering.

I prefer to draw in a tiled manner, but in multiple passes. First, I draw all floors for all tiles in the view. This way, subsequently drawn floors will not occlude or overdraw portions of object sprites which overlap a tile boundary. (If you use drop-walls that are drawn downward from a tile edge, then that can chuck a monkey-wrench into the whole damned works.) Then, I will proceed to draw each tile in a back walls -> contents -> front walls -> roof sequence. Even doing it this way, however, does not preclude strange overlap from happening. For instance, if an object sprite resides on one tile, but it's graphic partially overlaps one of the tile edges, then a neighboring tile may overdraw walls over the sprite in an incorrect fashion. Solutions exist to overcome these drawing obstacles, but require some forethought and planning.

Again, I'd advise you to thoroughly search through back-posts in this forum, as these issues have been discussed in-depth. Be prepared for disappointment if you are looking for "easy" answers, however. ;)

On another note, there is an article by Paul Siramy at the Phrozen Keep (a Diablo 2 mod-making site) which discusses the tile format used in Diablo 2, and can be instructional for seeing how the "pros" organize tile data and walls. I'd recommend you at least skim through it.

Quote:

Objects that span over multiple tiles brings up another question. How would you be able to use the mouse to hover over these objects if the mouse is not over the tile the object is anchored to? Basically, if an enemy/object is on tile A but leaks into tile B (above A), and the mouse is on the part that leaks into tile B, how would I be able to know that I am putting the mouse over the enemy/object rather than tile B beneath him?


The way I handle mouse hovering is not to query which tile the mouse is over, but rather to maintain a list of all objects drawn on the screen. Each time an object is drawn, a rectangle is inserted into a list, with the rectangle being associated with an object ID. The rectangle is the bounding rectangle of the onscreen graphic drawn for the object, though I implemented the system such that I could specify a rectangle of any size, not necessarily tied to graphic dimensions, in order to implement smaller selection areas or selected regions of objects.

The mouse coordinates are queried, then the list is iterated to find the top-most boundary rectangle the cursor intersects, and the associated object ID is returned. Easy as that. No tile-boundary limitations are imposed.

I maintain multiple object-type lists in this fashion, in order to prioritize the order in which objects are queried for selection. For instance, it is frustrating if a player is trying to target a monster that is attacking him, but the mouse selection keeps trying to target a door, portal, item or other benign object instead. So I check for monster selection first, then other object type selections in an adjustable order: portals, items, etc... A sorted list with higher sort priorities given to monsters works just as well.

Quote:

I think that was all of my questions for now. thanks in advance :)

[edit] fixed the subject

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this