How I'm Doing FPS Headshots In Mixtape Delinquents


Ok: So I decided I want to work not only on update devlogs, but occasionally talk about my process in terms of what im doing with the game design of MTD

This is going to be somewhat of a typical design doc, both to give ppl an idea of what's to come in the next update, and to document my progress for both players and myself

for the first one of these, just as a warmup, let's talk about something I've already implimented for an upcoming build of the open alpha: Headshots

So in the upcoming build of MTD, there's a component called the "weakspot" component

It's basically just a Area3D node attached to a Bone3D Attachment node. (For those who don't know, "Node" is just what a component is called in Godot, basically everything that's in you're gameworld, or anything your player sees, one way or another is a Node.


Above is how it's attached to the enemy (cop) NPC class

Now, the reason it's using an Area3D node is that a StaticBody3D caused major collision issues with the NPC, causing them to fade in and out of the world geometry (since the characters ofc already have solid collision). I didn't screenshot it but it was pretty goofy lol, so Area3D it is

However, there was another decision that was very important:


The GunComp scene, which is where the raycast nodes and the programmed logic for all guns in the game are held, now has an additional Raycast3D node that's *just* for headshots

This solves multiple issues. The first (and biggest) is that of collision. Both the longshot (which is used for most, distanced gunshots, subject to the guns accuracy) and pointblank (which is a used for very close, guaranteed gunshots, player interaction and melee weapons) can't detect Area3D due to other Area3Ds (like the "Noisemaker" collision which simulates the range of a noise) interfering w/ the player's aiming. The actual Weakspot component is only on collision mask 4, which is a different collision layer (1) than most of the game's collision (meaning only raycasts on that collision layer will pick it up) Vice Versa, so it the Headshot raycast


Having a seperate collision layer also solves two other problems: RNG and bullets vs melee weapons

Ok, so RNG: As i briefly mentioned just a second ago, gun accuracy in MTD works on random number generators (that's what RNG stands for, if you didn't know before. This is similar to how accuracy works in other ImSims like Deus Ex and Creulty Squad.

A brief, explanation MTD's gun RNG: Every gun has an "accuracy" of 1-100, a RNG is rolled between 1-100, and the shot will "miss" if the RNG is a bigger than the gun's accuracy (In other words: it's a percent chance, basically)

However, perfectly aiming a headshot and losing it to RNG is rly frustrated, with is why Deus Ex and Cruelty Squad both guarantee an instant kill if you can aim a headshot. MTD also does this, so long as a bullet is shot and it hit's the weakspot component, it doesn't matter if the RNG is bigger than the accuracy %, it's still and instant kill on the target, to reward the player for really good aiming

And finally, the thing about melee weapons: In MTD the function for firing a bullet is different than the function for using a melee weapon (like the combat knife) so headshot's are only registered when you're using a gun, simple as that!

And that's about it for this one. I'll try to have this build out soon

Get MIXTAPE DELINQUENTS: A Bootleg Roleplaying Game (OPEN ALPHA)

Leave a comment

Log in with itch.io to leave a comment.