Jump to content
  • Advertisement
Sign in to follow this  
TheResolute

SC2 collisions

This topic is 2374 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

How does StarCraft II implement collision detection?
It appears as though it just does a simple distance check between 2 objects to determine whether or not a collision occurred
Then applies a visual hit effect at the correct position on the model if it was a projectile hit, loosely based on the position of the projectile during collision, and modifies that based on the model's geometry and shielding, etc.
This arrangement is successful because ranges are fairly short, projectiles are fairly fast, and models are fairly circular, and they are viewed from the top down as fairly small, so it doesn't appear unusual as this method might if used in a game with ambient collisions between projectiles and large targets that would require more a more detailed approach to not be unusual, such as a fleet of ships firing long range missiles at another fleet with fighters frequently flying between a missile and its original target
Basically, this specific implementation relies fairly heavily on illusion and an environment tailored to it, rather than hard accurate collision detection
Does this seem accurate, or is there a better explanation?

Share this post


Link to post
Share on other sites
Advertisement
There is a better explanation, namely that Starcraft II doesn't have any collision detection. I admit that I have not played Starcraft II in quite a while, but I have never noticed projectiles being intercepted by objects that are not their target or any attacks missing (I will admit to the possibility that I have missed such things however)

Share this post


Link to post
Share on other sites
I considered that, however, there is a confirmed instance in which a Stalker shoots at a Siege Tank and as the projectile is traveling towards the tank, it is picked up by a Medivac and the projectile misses
I believe this also applies when Stalkers are Blinked out of the way of incoming fire, for example Marauder missiles

Share this post


Link to post
Share on other sites
I suppose that it could be a simple test to see if the target in question is no longer a valid target. This is supported by the fact that the behaviour you describe occurs when the target is destroyed before some of the incoming projectiles hit. But there doesn't seem to be any sort of line-of-fire checking or anything beyond what you just described.

Share this post


Link to post
Share on other sites
Yeah I believe the only 'collision detection' is distance/radius tests using 2D lines/circles.

Off the top of my head, there's probably three categories --
Instant -- do distance check to see if attack is valid, if so, play animation and perform instantaneous damage.
Projectile -- do distance check to see if attack is valid, if so, launch projectile. When projectile has reached target, check to see if the target still exists there and if so, perform damage.
Splash -- do distance check to find all units in radius and perform damage.

As well as the above stalker/tank case, stalkers can use blink to literally dodge each other's shots. Also of note, PDD's can shoot down projectiles (PDD unit has instant attack against projectile attacks) -- which means projectiles can be aborted/deleted before reaching their target.
There's also some graphical glitches to do with this stuff, if a stalker blinks while being shot by a colossus, the colossi beam with travel to the blinked-to location (even if out of range), but will not cause damage at this location (damage is still done in the usual location). So there's definitely some differences between the actual game rules and the visualisation of the game.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!