#### Archived

This topic is now archived and is closed to further replies.

# Collision & Draw Order

This topic is 6924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I wonder abit about collision... I''m working on a tilebased game in Isometric view, the tiles are 32*16. The mobs/chars can move within a tile, the number of steps from one tile to another is not one leap its a myriad of smaller steps. A tile can contain more than one character, object (like a desk) within the same tile. I wonder if anyone has any experience or tips on how to easiest handle collission? Mobs/chars have diffrent sizes (like giants and dwarves) which enhances the problem even more. I guess the best way to work it would be for every mob to have a bounding box, to detect walls. I also wonder about draw order within a tile. If you for instance have played Nox you''ll notice that the drawing order is based on the REG Point (center), which is kinda buggy. For instance when your character runs past a dead bear corpse on the ground, the char partially dissapears while passing the center point of the corpse while he should instead be standing on top of it. Thx for any help.

##### Share on other sites
ok... collisions.

first off, since iso is actually a orthographic 3d projection, the normal tilebased collision methods wont work. (i.e. bounding boxes or bounding spheres or even pixel perfect sprite collision)

a few methods i''ve come up with to combat this problem are bounding rectangular solids and bounding cylinders (they arent as complicated as they seem)

my methods involve treating the sprite as a 3d object, without actually using 3d collision. from the character''s bottom to the top, it takes up a certain space for that layer. this layer can either be represented as an ellipse or a rectangle. all of these layers taken together represent a cylinder or a rectangular solid.

if you just pick a single ellipse or rectangle to represent all of the layers of a sprite, then you can just use normal rectanlge or ellipse collision detection if there are any layers that might intersect between two characters. (you keep track of the lowest and highest altitude for a character.. because a flying thing likely will not intersect something on the ground.

the order of something being drawn is a tricky one, especially in iso, where we cant rely on z buffers and stuff. my advice is just to try and make it look as NON screwed up as you can.

##### Share on other sites
Your cylinder layer idea was new to me and sounds pretty nice... do you know of any articles on the web on collision, that feel somewhat relevant for iso tiled games?

As for drawing order of diffrent elements within a tile, you suggest I use the center point, or the front center point? I notice in Nox how they avoid as much as possible having things lying on the ground. Like they try to make corpses look as flat as possible etc. I get your advice about making something look NON screwy, if anyone else has any experience they could share on the topic I''d be even more happy!

##### Share on other sites
I''ve been experimenting with draw order and nothing seems to work pretty well for me. Does anyone know how draw order is handled in other games, where there are allowed to be alot of diffrent elements within one tile (f.i. a char, a book ontop of a table, ground). Things would be alot less complicated if every tile only carried one object, like old Guantlet.. but but

I need to calculate some sort of Z, so what is the best way to do it? Drawing top-down, right-left works for the ground but not for multiple obj within the tile, unless there''s a twist I havent understood.

##### Share on other sites
One way that you could use to handle draw-order is to draw each ''square'' of the map top to bottom and left to right, but then as you draw each square, draw from the bottom up. For example, first draw the ground (eg. a stone floor tile) then draw the objects on top of that (a table) and then objects on top of that (a book).

The only big problem you have here is if you have a bunch of tall things, you have to decide how far you need to keep checking tiles to determine whether the top of them are going to poke up into the viewport of the game.

I hope I''m not being too unclear.

• 10
• 13
• 52
• 11
• 15