Jump to content
  • Advertisement
Sign in to follow this  
No_Germs

Collision detection on "star control"

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

i want to program a game similiar to "star control" (two ships shooting at each other in a 2d space). what method should i use to check if the ships are hit by each other or the projectiles they fire. i mean, what method do you suppose they used at that game...

Share this post


Link to post
Share on other sites
Advertisement
Start Control 2 Source

heres a link to Star Control 2 source - or remake of it on sourceforge. thought you might be interested in it.

As far as what method to use .. I would start by using simple distance calculation from one ship to another or projectile to another and use bounding circles to quickly determine if the projectile hits/misses.

Because their is only two ships I dont think you would need to use anything elaborate (like a quadtree), brute force will work just fine. If the projectile / object is within the targets radius you can do further calculations if you want to test for more acurate hit detection.

Share this post


Link to post
Share on other sites
Thanks for the link... what about the possibility that the projectile will have a very large speed, and it will never be inside the ship's area, although, it crosses it?

Share this post


Link to post
Share on other sites
Depending on how complex you would want to make it you could do it two ways:

1st) If the projectile is that fast then you would not see the projectile, because it is too fast. maybe just see tracers in place for graphics -- In this case you would just calculate if the ray of the projectile intersects with the bounding circle at the time the shot is fired.

2nd) you would calculate if the path of the two objects intersected during the time between one frame and another. Heres a link to something on nehe that might help, I know gamasutra has a good article on the subject, with some simple math (i'll search for it):


http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=30


Share this post


Link to post
Share on other sites
thanks alot :)
one last question-
what model is used for the actual checking-
is checking if the projectile is in the bounding rectangle realistic enough, or do they use another geometric model?

Share this post


Link to post
Share on other sites
Heres a link on gamasutra (you will have to sign up - it's free)

http://www.gamasutra.com/features/19991018/Gomez_2.htm

This should help/solve your collision problem (if it arises).

Checking to see if the projectile hit the bounding rectangle should be good enough in most cases but, this also depends on your physics model to, if its simple or complex. I would do per-pixel collision after finding out if you hit inside the rectangle/sphere.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!