D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Hit Detection Flaws & Fixes |
|
During my tests of the new hitbox code, I have made a somewhat shocking discovery: Depending on position of shot and target, what looks like a sure hit (and should be one) is a miss. I couldn't believe my eyes when I saw this. Digging into the related code revealed a flaw in Descent's collision detection causing this bug. As you may know, or may not know, Descent 1 or 2 levels are composed of boxes that are glued together and can be deformed to create the level geometry. These boxes, or segments, are also used when locating objects and computing their proximity. Each object has a 'home' segment; that is the segment its center point is in. For each object, starting with its home segment, collisions are tested with all objects in all segments this object extends into. This is only done for moving objects though. Now imagine a shot in some home segment and a big robot with its home in an adjacent segment. The robot does extend into the shot's home segment, but the shot does not extend past its home segment's sides. Look at the picture for an illustration: ![]() If the robot doesn't move this will cause the program to fail noticing that the shot hits the robot! One may argue that this is a rare case, but imagine firing at a far away robot that hasn't noticed the attack yet, or at an unsuspecting camper in a multiplayer game. This can be quite annoying, so I fixed it in D2X-XL. |



