Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The headshot collision code in DX is broken as well. This is from memory from looking at the DX SDK years ago (+15 at least), but...

The collision shape used for a character in DX is a single cylinder. The game looks at where on the cylinder the collision point of the shot is, and tries to figure out if it's a head, body, or leg shot. It does this by checking how high the collision point is, with the lower X% being legs, top Y% being the head, and the middle being the body.

If a shot hits the head section, it runs some additional checks, and can sometimes still count as a body hit. There was some weird code that, after you stared at it long enough, looks like it ended up splitting the head area into compass aligned 1/8ths (so north, north-east, east, etc) and hits to the N-E-S-W octants would count as a head shot, and a hit to the NE-NW-SE-SW octants would count as body shots. (I couldn't tell if the angles rotate with the character, or are absolute relative to the world.) I think there was also a check for hits on the top cap of the cylinder, so that the hit would have to be close to the center of the cylinder to count as head hit, and near the outer rim would count as a body hit.

Hm, I should just make a diagram. Here: https://imgur.com/a/KG6MF1k

I guess what they were trying to do was make the actual head hitbox a smaller section of the head level, so that a shot that should go over the shoulder and miss would just count as a body shot and not a true headshot. And if you made a test map, with the player and a static test enemy placed in a line, this could work reliably from a fixed position. But when you actually play DX, and approach enemies from various angles, headshots inexplicably fail.



Weird coincidence, but I had to look through some old files backed up from the computer I was using 15+ years ago, and noticed it had C:\DeusEx sitting right there, with the SDK files in it. I found the function that handles damage in it.

https://pastebin.com/bwjaiDj7

It looks like I misremembered/misinterpreted some stuff. It looks like the top of the head behaves like the sides of the head, extending upward, forming a + shape.

Judging by how the arm/leg damage works, it the collision hit zones rotate with the enemy. Offset appears to be were the collision point is releative to the character's rotation, since it's also used to determine front/back and left/right collision. So for a hit to count as a headshot, it has to hit a cardinal octant of the collision cylinder.

Edit:

Updated diagram: https://imgur.com/a/Mec7HGm


I could be wrong, I didn’t work on it, but I believe these jankyness you describe was because DX was originally going to be like a Fallout style game but pivoted to an FPS. Old code left over from Troubleshooter and flawed game design choices that didn’t translate to a full 3D world. But I could just be remembering it wrong.


The good comes with the bad. Deus Ex's roots as an RPG are what made it so fun back when it was released.

I still remember how happy I was when I finally had gotten rid of any sort of sway on my reticle. Yeah, I can play this game like Half-Life now!.


This explains the totally janky behavior of the stun prod and baton in the 5 playthroughs of this game I've done over the past 25 years


Are you sure that the jankiness you describe is not related to you not being close enough to the enemy for it to count as a point blank hit? The engine does a simple distance check which is rather unforgiving, and if you utilize the range your melee weapon affords you, you will fail this point black attack check. This is just a guess on my part, but it's the #1 reason I've seen people be perplexed at seemingly inconsistent melee stealth takedown behavior.

If you first push yourself as close as you can get to the enemy model and attack the general area of their torso, it works every single time. But again, this is just me taking a guess as to what the problem you're referring to is!


Well that's the problem. In the first mission you have to figure out to stun the enemies in the center of their back rather than directly in their head. Its super counterintuitive and probably leads to many players not getting past the first mission.

It makes the difficulty curve super inverted


Only if you want to do totally non-lethal and "ghost" playthrough. Even then you have the dart gun


The minicrossbow is even harder than the prod, especially at lower skill levels and with no weapon mods. The prod at least stuns enemies momentarily. With the darts they still stand around shooting at you and set off alarms, and that's if you manage to hit them at all. You can run up to a guy and get a guaranteed stun in the time it takes him to spin around like a dumbass to look at the source of the footsteps.


My first playthrough, when I was 12, I opted for the GEP gun, but had to go to the minicrossbow after running out of ammo, thereby leaving me with no pistol skill. The worst of both worlds on the very first mission. Ended up climing up the back of the statue of liberty and throwing gas grenades. Good times.


The GEP gun is ironically the pro choice to make if you know what you’re doing. All of the other weapons on offer can be found in the first level, and the GEP works as a fantastic “lockpick” even if you never fire it in anger.


It's so bulky, though. I'd rather carry an auto shotgun and four other situational items. As for lockpicks:

* Lockpicks: single inventory slot, stacking; plentiful; silent

* LAMs: single inventory slot, stacking; loud

* Dragon Tooth: infinite uses; can't break down every door; silent?

* Sniper rifle: optionally silent; semi-common ammo; can't break down every door

* GEP gun: loud; bulky; semi-common ammo


It is also the pro choice for taking out your former boss.


This is true, but the upside of the crossbow is that for most soldiers it only takes a single shot to take them out, even if it takes a while, and you can do it from a safe spot, this can be beneficial if your JC sucks at combat or is low on ammo.


You need to crawl up right next to their ass and zap their lower back


Just like in real life.


Also if you have to stun them in a pinch, they just stand there being spastic, you can knock them out by prodding a second time, but if you do it right away the hit won't register, you have to wait half a second and move around a bit or something. This is very annoying since it wastes precious prod charges.


This may be because the 'headshot' multiplier is lower than the regular multiplier (1x vs 2x) for the prod and baton. For most weapons the headshot multiplier is 8x (or something).

So torso hits from behind are the way to go.


I'm surprised they did not use a bunch of cheap sphere-ray intersection tests. It would be more accurate.


The game also features bullet drop, but this is completely broken. Iirc it does a hitscan against the cylinder and then depending on the length of the ray the hit point is moved further down the length of the cylinder, but this means you cannot for instance aim above the character to compensate for bullet drop.


GMDX should had that fixed that since long ago.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: