Go Back   Steam Users' Forums > Steam Game Discussions > T - Z > Team Fortress 2 > Classes and Balance Discussion > Spy

Reply
 
Thread Tools Display Modes
Old 03-11-2011, 03:03 PM   #1
ParanoidDrone
 
 
 
Join Date: Nov 2008
Reputation: 322
Posts: 3,086
A Somewhat Formalized Topic on Matters of Backstab Detection

TITLE
A Somewhat Formalized Topic on Matters of Backstab Detection

SOURCE
Information on melee and backstab mechanics taken from the following blog article:
Technofovea, by HvCTerr

ABSTRACT
The Spy's backstab is one of the most powerful abilities in TF2, capable of killing any target in a single strike. Yet it also causes rage and frustration. Spies complain about backstabs that fail to register. Victims complain about getting backstabbed when the Spy is in their field of view. This topic will address these concerns and more as we delve into the inner workings of melee hit detection in TF2, how the Spy's melee differs from those of other classes, what requirements must be fulfilled before a backstab is possible, and the implications of these requirements in normal TF2 play. It is the intention of this topic that a more complete understanding of these matters will lead to fewer reactionary complaints aimed at the Spy's backstab ability.

GENERAL MELEE
All melee attacks are represented in the game engine by a single, short range bullet. They are hitscan, which means they are lag compensated and originate from the player camera, shooting through the crosshair. In addition, melee attacks do not fire instantly. Instead, there is a short delay between pressing M1 and the attack firing. This delay is designed to synchronize with the melee attack animation.

Unlike other hitscan attacks, however, melee attacks do not use the player's hitbox to determine if the attack connects. Instead, they use collision hulls, which are rectangular prisms of identical size and shape for every class in the game. For performance reasons, these collision hulls alre always oriented to the X/Y axes of the map, regardless of the direction the player is facing. A melee attack is considered to hit if it connects with this collision hull.

SPY MELEE
The Spy's melee attack differs from other classes' in a few distinct ways. First, and most obviously, it is capable of an instant kill if used from behind the target. Second, and less obviously, it fires instantly, without the delay inherent to other melee weapons. Yet this was not always the case.

Prior to the Scout update, the Spy's melee attack was delayed just like every other class. When he initiated a backstab, the animation caused an even longer delay than usual. This resulted in situations where the target would strafe out of the way or turn around before the animation completed, nullifying an otherwise valid setup. To counter this, veteran Spies used the melee's inherent delay to their advantage, initiating the attack when just barely out of range, then moving into range before the attack actually fired, backstabbing the target without having to endure the lengthy animation.

When the Scout update went live, one of the changes was a reworking of the Spy's melee attack. It now fired instantly, and the backstab animation was considerably sped up to match. As a direct result, it was no longer possible to initiate the attack out of range and maneuver into range before it hit. This is also the reason the backstab seems to have a shorter range than it used to, when in fact it is merely the extra movement between initiation and completion that was removed. The melee range itself remained unchanged.

On nocrit servers, the backstab animation will never play. Instead, all attacks will use the standard swing animation. This is purely cosmetic and does not affect the backstab's functionality, but is deserving of note nonetheless.

BACKSTAB REQUIREMENTS
For the Spy's melee to count as a backstab, it must intersect the target player's collision hull in the rear 180 degree arc from the direction they are facing. In addition, the Spy must be facing within 90 degrees of a line pointing from him to his target. It is important to note that due to the posture of many classes, the location of their actual back, feet, etc. in the game world is not synchronous with where they are looking. The best parts of the class models to judge their direction with are their weapon and their head.

Equally important to what is required for a backstab to register is what is not required for a backstab to register. Nowhere in the requirements is height a factor. Assuming the above conditions are met, a Spy is perfectly capable of backstabbing someone while above them, even when standing on their head. The same applies to backstabs from below.

LAG COMPENSATION
Melee attacks are lag compensated, which means that the attacker hits what he sees on his screen. This counteracts the latency inherent in any networked game and prevents players from having to lead their shots by some arbitrary amount if they are to hit anything. The well known phenomena of being shot around a corner or wall, or of being hit by a melee attack when well out of range, are direct results of lag compensation working in the attacker's favor.

Because of latency and lag compensation, when fighting a Spy in close quarters, where you see him on your screen is not necessarily where he is on his own screen. If the Spy is actually behind you and gets a backstab, you will appear to die while the Spy is still in front of you. To the Spy, it was a perfectly legitimate kill. A similar scenario happens when turning around to face a Spy and suddenly getting backstabbed. On the Spy's screen, you had not yet turned around, and so he got the kill.

FACESTABS AND FAILSTABS
The vast majority of percieved facestabs can be explained by some combination of clever and/or lucky movement on the Spy's part, poor positioning relative to the Spy on the victim's part, and the melee and lag compensation mechanics detailed above. There are countless ways for a Spy to suddenly get behind you and reach your back, even when on the run. Because the backstab is instant, such cases appear as blatant facestabs to the victim, when in fact the Spy was able to cleverly maneuver himself to reach your back before you could react.

However, there remain a select few instances of true facestabs, where both the Spy and the victim agree that something is amiss. Unfortunately, it is difficult to conclusively prove that a facestab was truly a facestab without confirmation from the Spy himself, although anecdotal evidence suggests that they are more common when the victim is backing away from the Spy. Similar to facestabs are failstabs, where the Spy backstabs a target but the backstab fails to register, resulting in no or light damage to the target.

Both facestabs and failstabs can be traced to the way the game handles player position and orientation. These events are managed serverside, rather than clientside. Because of inherent latency, it is necessary for the clients to predict where the players are moving in between updates from the server that inform them of each player's actual position. Because backstab registration is handled by the server, this discrepancy between the client and server version of events is one explanation for facestabs and failstabs alike. The effect can be reduced by optimizing one's interpolation rates, resulting in less clientside prediction and a more accurate representation of the game world.

For more information about how to optimize your interpolation rates, see this thread by stabby stabby.

CONCLUSION
Due to the myriad factors involved in melee hit detection and valid backstab registration, it is exceedingly difficult to conclusively prove that any given instance of a suspicious backstab is a facestab. The best defense against such occurences is arguably to avoid such situations in the first place. Engaging a Spy in melee combat is generally unwise and can easily lead to disaster. Yet if such a situation does arise, knowing what to watch out for can help ensure your survival.

Last edited by ParanoidDrone: 06-25-2012 at 05:07 AM. Reason: Linked to stabby stabby's thread about interpolation.
ParanoidDrone is offline  
Reply With Quote
Old 03-11-2011, 03:43 PM   #2
Alfabetica
 
 
 
Join Date: Mar 2010
Reputation: 603
Posts: 4,236
Sticky. Now.
Alfabetica is offline   Reply With Quote
Old 03-11-2011, 04:10 PM   #3
stabby stabby
 
 
 
Join Date: Nov 2010
Reputation: 641
Posts: 1,900
Great job.

I'd add that while the knife is hitscan, player orientation (which way you are facing) is server-side. While whether or not the knife connects is determined server-side, but backstab registration is infact server-side.

This accounts for failstabs.
stabby stabby is offline   Reply With Quote
Old 03-11-2011, 04:34 PM   #4
CatatonicMan
 
Join Date: Jun 2008
Reputation: 794
Posts: 8,813
As I understand it, your portion on 'Backstab Requirements' isn't correct. The location of the actual hit doesn't matter; relative position/direction is the only deciding factor in calculating a backstab.

You are granted a backstab if the following conditions are met:

1 - Your attack actually hit (obvious, but melee is notorious for being wonky)
2 - Your location at the time of the attack was in the rear 180 degree arc of the target
3 - Your attack is within +/- 90 degrees off the line between you and your target

Also, under the 'Facestabs and Failstabs' section, most failstabs (or non-registering melee in general) is likely due to client prediction errors.

Last edited by CatatonicMan: 03-11-2011 at 04:43 PM.
CatatonicMan is offline   Reply With Quote
Old 03-11-2011, 04:52 PM   #5
ParanoidDrone
 
 
 
Join Date: Nov 2008
Reputation: 322
Posts: 3,086
Quote:
Originally Posted by CatatonicMan View Post
As I understand it, your portion on 'Backstab Requirements' isn't correct. The location of the actual hit doesn't matter; relative position/direction is the only deciding factor in calculating a backstab.

You are granted a backstab if the following conditions are met:

1 - Your attack actually hit (obvious, but melee is notorious for being wonky)
2 - Your location at the time of the attack was in the rear 180 degree arc of the target
3 - Your attack is within +/- 90 degrees off the line between you and your target
To the best of my knowledge, position and direction are important only to the extent that they affect whether or not the target is in range of the melee attack to begin with. I've personally backstabbed people while running at their sides before, tested it with bots on tr_walkway, and had the results corroborated by the description of the mechanics from the article I linked in the OP.

(Admittedly that video is a year or more old, but I don't believe Valve significantly changed how backstabs work since then. I may do another test in the near future now that I think about it though.)
ParanoidDrone is offline   Reply With Quote
Old 03-11-2011, 04:57 PM   #6
CatatonicMan
 
Join Date: Jun 2008
Reputation: 794
Posts: 8,813
Quote:
Originally Posted by ParanoidDrone View Post
To the best of my knowledge, position and direction are important only to the extent that they affect whether or not the target is in range of the melee attack to begin with. I've personally backstabbed people while running at their sides before, tested it with bots on tr_walkway, and had the results corroborated by the description of the mechanics from the article I linked in the OP.

(Admittedly that video is a year or more old, but I don't believe Valve significantly changed how backstabs work since then. I may do another test in the near future now that I think about it though.)
Let me see if I can work up some examples that will better illustrate the point.
CatatonicMan is offline   Reply With Quote
Old 03-11-2011, 04:59 PM   #7
ParanoidDrone
 
 
 
Join Date: Nov 2008
Reputation: 322
Posts: 3,086
That would be much appreciated.
ParanoidDrone is offline   Reply With Quote
Old 03-11-2011, 05:55 PM   #8
CatatonicMan
 
Join Date: Jun 2008
Reputation: 794
Posts: 8,813
Okay, got some images ready. They hopefully demonstrate what I was referring to:

Basic Setup
Rear Angle Test vs Rear Angle Test 2
Backstab Test vs Backstab Test 2
View Angle Dependency Test

Excuse any spelling errors; I'm too lazy to correct them. Hopefully the bandwidth holds out as well.
CatatonicMan is offline   Reply With Quote
Old 03-11-2011, 06:23 PM   #9
ParanoidDrone
 
 
 
Join Date: Nov 2008
Reputation: 322
Posts: 3,086
Okay, I see what you mean. But I have a quibble.

In this picture, I am unconvinced that a melee attack would hit the bot at all. It's partly my gut feeling, but supported by the fact that there is no nameplate showing, unlike the rest of the pictures. (I'm reasonably sure the game uses a simple raytrace against collision hulls to determine if it should show a nameplate or not. The lack of a nameplate thus means that a melee attack would miss, since they fire straight down the crosshair.)

If you feel like doing one more test (and I'd understand if you don't), I'd like to see this situation repeated but with the Spy rotated 90 degrees clockwise, so that he is facing the opposite direction of the bot. This, I feel, would prove one way or the other if the Spy's direction relative to the target matters for backstab detection.

I apologize if it seems like I'm ignoring data. I'm merely trying to account for all possible variables.
ParanoidDrone is offline   Reply With Quote
Old 03-11-2011, 08:56 PM   #10
CatatonicMan
 
Join Date: Jun 2008
Reputation: 794
Posts: 8,813
Quote:
Originally Posted by ParanoidDrone View Post
In this picture, I am unconvinced that a melee attack would hit the bot at all. It's partly my gut feeling, but supported by the fact that there is no nameplate showing, unlike the rest of the pictures. (I'm reasonably sure the game uses a simple raytrace against collision hulls to determine if it should show a nameplate or not. The lack of a nameplate thus means that a melee attack would miss, since they fire straight down the crosshair.)
It would hit, but I can't really 'prove' that it would without a video (and I'm too lazy to make one). I'd suggest you try out a similar test if you want to know exactly what attacks can hit. Also, the name box appearing isn't required to land an attack, nor is looking directly at the opponent.

As an interesting example, here is a primed backstab where the enemy isn't even visible.

Quote:
Originally Posted by ParanoidDrone View Post
If you feel like doing one more test (and I'd understand if you don't), I'd like to see this situation repeated but with the Spy rotated 90 degrees clockwise, so that he is facing the opposite direction of the bot. This, I feel, would prove one way or the other if the Spy's direction relative to the target matters for backstab detection.
Indeed. See here:

Positive Backstab vs Negative Backstab vs Schrödinger's Backstab On vs Schrödinger's Backstab Off

In the last two, the only change was a view rotation. It's a good demonstration of the angle-dependence of the backstab.
CatatonicMan is offline   Reply With Quote
Old 03-11-2011, 09:09 PM   #11
ParanoidDrone
 
 
 
Join Date: Nov 2008
Reputation: 322
Posts: 3,086
Schrodinger's Backstab...I like the sound of that.

Like you said, pictures alone aren't really suited for this. I'll definitely need to do some of my own tests.
ParanoidDrone is offline   Reply With Quote
Old 03-11-2011, 10:07 PM   #12
CatatonicMan
 
Join Date: Jun 2008
Reputation: 794
Posts: 8,813
Quote:
Originally Posted by ParanoidDrone View Post
Schrodinger's Backstab...I like the sound of that.

Like you said, pictures alone aren't really suited for this. I'll definitely need to do some of my own tests.
Incidentally, the third requirement for a backstab (implemented around the time they made the backstab instant) is there to theoretically eliminate (true) facestabs.
CatatonicMan is offline   Reply With Quote
Old 03-11-2011, 10:43 PM   #13
ParanoidDrone
 
 
 
Join Date: Nov 2008
Reputation: 322
Posts: 3,086
And we all know how well that worked. *eyeroll*
ParanoidDrone is offline   Reply With Quote
Old 03-12-2011, 01:57 PM   #14
Heavy is pie
 
Guest
Posts: n/a
Thank you! Now, instead of having to explain all this stuff to someone, I can just link them here. Great job!
  Reply With Quote
Old 03-12-2011, 02:08 PM   #15
stabby stabby
 
 
 
Join Date: Nov 2010
Reputation: 641
Posts: 1,900
Quote:
Originally Posted by ParanoidDrone View Post
And we all know how well that worked. *eyeroll*
Hey now, give Valve a little credit. Facestabs are waaay less ridiculous before the backstab revamp.
stabby stabby is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Game Discussions > T - Z > Team Fortress 2 > Classes and Balance Discussion > Spy


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -7. The time now is 08:15 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2014, All Rights Reserved.