Skip to main content
GameDev.net gamedev.net
🔒 Locked

simple collision detection

Started by alex_myrpg Mar 17, 2005 at 12:32 PM 2 replies 600+ views
Original Post
alex_myrpg
alex_myrpg
ok, this is a really simple question - one that i hope can be answered by someone with any decent experince (?). well, i have my game engine that animates every x milliseconds and renders every other game loop - the standard thing. now, when i do collision detection (when the game gets animated) should i 1. check if object has collided - if so, do appropiate effects OR 2. use a mathematical formula to calculate number of animations until object collides. the former could POSSIBLY be less accurate because it only checks between animations (each move of the object) but the second could also POSSIBLY be a bad choice because of the complex maths involved with detecting collision between irregular shapes... plz reply asap, thanks. p.s. my game is a standard 2D using managed DX9.0
Drew_Benton
Drew_Benton
Suggestion 1 is the most commonly used and easiest. If you have a very simple game, you should not be worried about significant slowdowns.

Suggestion 2 is the more intuitive and better way to approach this - but not that exact concept. I do not think you could devise a way to calculate the animation sequence and collison detection properly due to different FPS on machines. Unless you are talking about bounding boxes instead of the actual picture.

I would just go with suggestion 1 simply because it should work fine for you. There are a lot of other ways of doing collision detection, but the payoffs will not be worth it in a small 2D game. Not only that, more advanced methods would take a bit more time to develop, test, and implement. For your suggestion one though, you could just use bounding boxes that are about 90-95% of the actual image, so there can be a little more realism to the collisions - just don't make the border of the image the bounding box. Just my opinions at the moment. [smile]
alex_myrpg
alex_myrpg
ok, ty very much for ur advice :D i dunno if it's a 'small' game (well, compared to commercial 3D ones, yeah ;)) the game's actually a 2D tile-based RPG adventure. however, i assume that it shouldn't really matter anyway. lol, i thought the 1st one would be quicker in fact. i'm quite an experienced programmer in general, but i'm a bit of a newbie to game development using engines. maybe there's a good article explaining different types of collision detection? i'll check around ;)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.