Advertisement

Objects in an Isometric World

Started by February 06, 2000 02:39 PM
4 comments, last by Rah 24 years, 10 months ago
Hi all I''m looking for some info on moving objects in an ISO world including collision detection. I understand the basics of rendering the map (I''m using an aspect ratio of 2:1 tiles). What I''m not to sure on at the moment is collision detection with the 2D sprites involved. Does anyone have any ideas, articles etc. on this subject matter? I''m not looking for any specific information, just general ideas etc. that relate to this. Thanks for your help, -- Rah
I''d be glad to offer some ideas, but I''m not sure what your asking? Do you mean collision detection between 2 moving objects or with static object? Are you using a diamond type map or a staggered map?

Currently in my implementation I treat all objects the same, each object has flags associated with it at design time, and I have optional flags at runtime that indicate whether the object is solid, transparent, walkable etc. When a request to move to a location is made, I check these flags and determine whether or not a collision occurs. For things like shooting arrows etc. I''m using a Line of Sight algorithm that detects these flags in the path of the object, and I can determine collisions that way. I also have heights in my map, so I have to take that into consideration as well when for example, a character shoots an arrow at someone ontop of a building, does the arrow get blocked by a wall, another character/object etc., I can also use this method to determine if I can see/target objects that are a distance from the character.

Advertisement
Hi,

Yes, sorry I didn't make myself very clear before. Ok.. let me explain

With a standard tile-game (ie. perfectly square tiles), moving a sprite and checking for collision is relativelly simple. Assuming the tile above is walkable, we just -1 from the sprites y-value etc. etc.

But... What I'm stuck on is doing this with an ISO (diamond tile, 2:1 ratio) engine. To move the sprite 'up' both x and y values will need to be changed...


.. = Non-walkable area
/ / = Walkable 'path'

.. / /
../ /
./X/ <-- Player, X, cannot move vertically up as this
/ / would take him/her out of the playing area.

I'm still not sure if I've made explained my problem exactly... I think it does the job though

Anyway, like I said before, I'm just looking for some general pointers on the subject.


Thanks,

--
Rah

Edited by - Rah on 2/7/00 1:06:21 PM
I''m assuming you want to make an engine like Diablo, with isometric view.

For the case of Diablo, the map, where the characters reside, is represented with square tiles. These tiles are then rendered with diamond shapes to simulate 3D. Your collision detection should be performed with the squaretiles.

Map represented in computer, perform collision detection here:
+-+-+-+-+-+      P = Player''s character/X/ /X/X/X/      X = Wall+-+-+-+-+-+      an empty square is walkable/X/ / /P/X/+-+-+-+-+-+/X/X/X/ /X/+-+-+-+-+-+


Map presented to player when rendering. Tilt map when drawing by: Xscreen = Xmap + 0.5*Ymap (simplified):
      +-+-+-+-+-+     /X/ /X/X/X/    +-+-+-+-+-+   /X/ / /P/X/  +-+-+-+-+-+ /X/X/X/ /X/+-+-+-+-+-+


(How do you like my ASCII art? =)
Rah, you''re making an extremely simple (but very common) mistake. Just because the graphics are not rectangular (they are diamond shaped), that doesn''t mean everything associated with it is also that shape.

The map is rectangular, so simple collision detection will work, such as bounding boxes/circles.

Jim

Ok, I''m kicking myself as I type here

Pretty obvious really when you think about it... oh well
Thanks to all who''ve replied with info etc.

--
Rah (somewhat embarassed)

This topic is closed to new replies.

Advertisement