Fun Infused Games  |   Smooth Operator

  Home   |    Archive   |    About
Posts prior to 8/2/2010 may be missing data. If you need one of those posts, please contact kriswd40@yahoo.com and I will try and recover/find it.

Too Good Collision Detection
Date 9/1/2009    Tags Nasty, Game Dev    (0)

One of the recent reviews for Nasty was critical of the hit detection, going so far as labeling one of the cons of the game "Dodgy Collision Detection".

I can tell you for a fact that in Nasty, when a collision is detected, it did in fact happen. The problem is not the game but rather the player's perception of what should be a hit and what should not.

There is a two step process for detecting collisions in Nasty, done for accuracy and performance reasons. First, a check on a bounding rectangle is done to see if one object is colliding with another. If a collision is found, step two of the process is done. If not, then the next set of objects are checked. Step two of this process examines the actual textures that will be drawn to screen and determines if any of the pixels from one object overlap the pixels in the other. If any of them do, then a collision has occurred.

The issue now becomes that even a slight, 1 pixel overlap is considered a collision. This means that even a tiny part of the player's body overlapping with an equally tiny part of the enemy's body causes a collision to occur and the player to be killed. While technically correct, such a small collision isn't always seen as fair to the player. And sometimes (worst of all), the margin is so small (and the frame rate so fast) that the player simply doesn't believe they were hit (I'm sure we've all played a game at some point where we've thrown our hands up in the air and yelled "No way that hit me!").

The solution to this problem is to make the initial bounding rectangle detection area smaller, thus allowing a slight overlap of objects before a collision is registered. Players enjoy this because they don't die as often and the close calls will end up being even closer and more exciting.

For Nasty specifically, I will be going through the game and examining the bounding rectangles for each player, enemy, and projectile, making sure that there is always some room for overlap, thus eliminating these perceived non-collisions and appeasing the almighty review Gods.


This article has been view 535 times.


Comments

No comments for this article.


Add Comments

Name *
Website
  Name the animal in the picture below:

*  
Comment *
Insert Cancel
Things To Click


Tags
Video Games (7)  Trivia or Die (3)  SQL (1)  iOS (3)  Game Dev (11)  Advise (14)  PC (1)  World of Chalk (2)  FIN (20)  Abduction Action! (27)  XBLIG (32)  Abduction Action (1)  Nastier (4)  ASP.net (18)  Absurd (2)  Volchaos (11)  Web (19)  Fin (1)  XNA (40)  Rant (50)  Cool (2)  Visual Studio (1)  Trivia Or Die (1)  Xbox (1)  C# (14)  Sports (11)  Design (2)  Development (13)  Hypership (28)  WP7 (8)  VolChaos (1)  Nasty (34)  Abdction Action! (1)