Skip to content

Instantly share code, notes, and snippets.

@nessus42
Last active May 12, 2018 21:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nessus42/a0e2826683e9fad3027728dde78310e3 to your computer and use it in GitHub Desktop.
Save nessus42/a0e2826683e9fad3027728dde78310e3 to your computer and use it in GitHub Desktop.
Destiny Networking Primer: Why are things like kill "trading" and being killed by someone who is already dead so common in Destiny PvP?

Destiny Networking Primer: Why are things like kill "trading" and being killed by someone who is already dead so common in Destiny PvP?

Additional articles in this series:

Intro

Last week I posted a huge article on how Destiny networking works, but I think it might be worthwhile to break parts of it down into more bite-size pieces. (Alas, even bite-sized, this article is a lot to chew on due to the complex issues involved.)

But let's get started: A common complaint about Destiny PvP netcode is why does "trading" and being killed by someone who is already dead occur so commonly in Destiny PvP?

Executive Summary

Destiny intentionally supports - and even encourages - matches containing players who have high-latency relative to each other. Given this, trading is unavoidable.

And yes, I know that serious PvP players are unhappy with anything other than dedicated servers. There's no need to point this out again. Your disgruntlement has been duly noted.

Detailed Answer

One of the design pillars of Destiny is that you should be allowed to form a fireteam with whomever you want to, even if they are on the other side of the planet. I do not attempt to defend this design pillar here. I only aim to explore its consequences.

This design pillar readily leads to PvP sessions where opponents have high-latency with respect to each other. Consequently, certain lag artifact, such as kill-trading, are unavoidable, unless we wish to unfairly punish those players who the game might decide are on the wrong side of the planet.

Games that use "dedicated servers" typically have it easy in this respect: People who are too far away from the server (or who have poor Internet connections) are screwed. E.g., their damage won't register, they will self-rubberband, etc. Basically, it is made clear to them that they are not welcome to play on the server in question.

For better or worse, Bungie doesn't like that approach, and wants to include everyone, despite the downsides of Bungie's "generous" approach.

More concretely, let's consider a specific game-play scenario: You’re playing on a fireteam with a couple of friends who live in the outbacks of Australia while you live in the rural U.S. Consequently, there are going to be players on both sides of the planet in this Crucible match.

Let’s say for the sake of argument that it takes 1.0 seconds for a packet to travel from the outbacks of Australia to the rural US or vice versa. (That's a very high ping time; more realistically, the ping time might be 0.5 seconds. But this is just an illustrative example. We can make the following scenario work with much shorter ping times.) Now let's also say that player A on the opposing team is in such an area of Australia. When you first encounter this player, she is entering into a tunnel that is 1.0 seconds long at her running speed. While she is in her tunnel, you can't see her or shoot at her, so you run toward a tunnel that is 1.0 seconds away from you and is 0.5 seconds long at your running speed.

At time t+0.1, you can’t see each other. At time t+1.0, you have reached the tunnel, but from A’s point of view, you are 1.0 seconds away from the tunnel. She shoots you with a TTK of 0.95 seconds, and so from her point of view, she has killed you right as you are about to enter your tunnel.

You exit your tunnel at t+1.5, but the fact that you have been killed (while in the tunnel from your point of view) won’t reach you for another 0.5 seconds. You pop out of your tunnel and shoot A with your Sleeper Simulant in the head at T+1.6, and you see yourself killing A just as she exits her tunnel.

What is Destiny to do?

Well, I don't know for sure. As I mentioned above, games with dedicated servers would typically try to prevent such high-latency situations by forcing people to leave the game who do not have low enough latency to the server. Given the presumption that a game is going to allow high latencies such as described above, there are a number of choices that the game could make:

(1) Some games might decide that the lag between you two was too great and deny both of your kills. That would probably make you both mad. (We know how mad people get in Destiny when they post their videos of unkillable opponents. What might cause that problem is a discussion for another day.)

(2) Some games might decide that A killed you before you killed her in absolute time, and so even though you were in a tunnel from your point of view and A never even had a bead on you from your point of view, you must die. This decision will likely piss you off.

(3) Some games might decide that you both made a fair kill from your respective points of view and grant you both the kill. Though both of you might end up confused about how you ended up dead too. (Overwatch shows you a replay of how you were killed, and players in Overwatch often discover from this "killcam" that they were killed because the shooter had a bead on them when they were behind cover from their own point of view. It might be nice if Destiny had some a killcam replay, so you could see this too.)

Overwatch has a system called Favor the Shooter, and while it doesn’t allow for time skews as large as the one I've described here, it will grant the kill to the shooter, even if from the victim’s point of view, it doesn’t make any sense. (Given that the kill was made within the allowed time skew.)

My guess, which seems to be borne out in people's posted experiences and complaints, is that Destiny choses option #3 and grants both player’s the kill. Also I know that Bungie has said in their GDC talk "I Shot You First" that they think that trades are more fair and cause less anguish than seemingly arbitrary decisions about who won a fight based on who has the least lag. You may end up feeling annoyed at being killed "unfairly", but at least you get to enjoy having made a kill and having your gun skill acknowledged.

Wouldn't Having Dedicated Servers Fix This?

If you read carefully what I wrote above, you will notice that using dedicated servers is completely orthogonal to whether trades are allowed. Dedicated servers typically enforce relatively low-latency games [See Note 1], which lessens having to worry about this issue as much. Despite this, trading can happen even with relatively low-latency games, and exists in Battlefield, Infinite Warfare, and Overwatch, all of which have dedicated servers.

Furthermore, just because Destiny uses P2P in its netcode doesn't mean that it has to allow high-latency matches. It could require that everyone in a match have a maximum latency with respect to each other. Bungie just doesn't want to place this restriction on matches.

One benefit of Destiny's hybrid P2P model that rarely goes acknowledged is that it should actually typically reduce latency. The apparent P2P mesh traffic in Destiny's netcode (documented here and here) bypasses the server, and consequently, this information is transmitted between players faster than it would be if it had to make extra trips to and from a server, rather than going directly from one player to another. [See Note 2]

Another benefit is that given that Destiny wants to support high-latency matches, it's not clear that this is even possible using dedicated servers. The biggest problem would be that given high latencies between players and the server, the position of a player, as represented on the server, will diverge from the position of the player as represented on his console or PC. If this discrepancy becomes too large, resolving the discrepancy in a reasonable manner becomes untenable. This is why dedicated servers will rubberband a player's position when this discrepancy becomes too large.

But another one of Bungie's design pillars is no self-rubberbanding, ever. And even if Bungie did not have this design pillar, self-rubberbanding is very unpleasant as a game-play experience. Destiny's networking model, in which each player's position is authoritative on their console or PC allows for arbitrary amounts of latency (whether or not this is a noble goal), without any player ever having to suffer from self-rubberbanding.

But I'm playing solo. And Destiny keeps matching me up with people on the other side of the world, resulting in a terrible, laggy experience for me. WTF???

That seems like a valid complaint. This is an issue with Destiny's matchmaking, rather than its networking model, however. Why would Destiny match you with people too far away for you to enjoy a low-lag game?

There are several possible causes for this:

(1) Destiny has decided that you are very skilled and doesn't want you going on endless mad rampages of killing every less skilled player. This makes the game not fun for the less skilled players. Bungie has been constantly tweaking their balance between SBMM (skill-based matchmaking) and CBMM (connection-based matchmaking) and it seems that no matter what they do, some significant group of people end up unhappy. If you are deemed to be very skilled, Destiny may have a hard time finding players close to you that are at your skill level.

(2) You live someplace where there aren't many other Destiny players and so Destiny has no choice but to match you with players who are far away.

(3) A dwindling player base: As time progresses and fewer people play Destiny 1, the number of people near you also decreases.

(4) Too many game mode options. Destiny provides you with a bunch of different PvP game mode options. It may be that the game mode you want to play isn't very popular at the moment, and so there aren't many players nearby who also want to play this game mode.

It seems like the proper solution to #4 would be for Bungie to keep stats on the game modes and to disable game modes that aren't popular enough. Or at least give you a warning that you are unlikely to get a low-latency match.

Reducing the number of game-mode choices at any given time would also help out here.

(5) A match was put together with several globally distributed fireteams, but there were some empty spots that needed to be filled. You're the lucky winner!

(6) Someone who doesn't live near other Destiny players needed a match to play in, and your match is the lucky recipient!

(7) Bugs. No matter how much Raid you spray, it seems impossible to stamp out those things!

Now combine causes 1, 2, 3, and 4 all at the same time, and finding yourself in a low-latency game may be a minor miracle.


Note 1: A dedicated server doesn't typically have to explicitly enforce low-latency matches. This typically happens implicitly by "punishing" players who have high-latency connections to the dedicated servers. Such players will then either quit playing, since their experience is so bad, or they will put up with it, and just be easy targets for the players who have good connections to the servers. In either case, the players with the good connections will end up happy.

How do dedicated servers "punish" players with high-latency connections? Usually through three different mechanisms. (1) They will be killed by low-latency players before they ever have a chance to see them coming. (2) They will experience self-rubberbanding. I.e., their character's position will be adjusted by the server to match what the server has decided is "reality", and consequently, the lagging player will experience themselves being unpleasantly teleported around and/or stuck in place as if being held in place by a giant invisible rubberband. Here's a video of bad self-rubberbanding, if you want to see what it is like. (3) Their weapons damage will be denied. E.g., Overwatch has a system called "Favor the Shooter" where weapons hit-detection is done client-side so that if you see yourself dealing the damage, the target will experience the damage. This feature is disabled, however, for players that have too much latency with respect to the server. This makes it much more difficult for the high-latency player to deal damage to their targets.

Note 2: Yes, Destiny's hybrid P2P approach also has serious downsides. E.g., Its client-side player position authority allows cheating via lag switches. And its apparent P2P mesh allows cheating via DDOS attacks.

Additionally, if Destiny used dedicated servers for 6v6 matches, it would require about 700 kbps of download bandwidth and 50 kbps of upload bandwidth. Almost everybody has a network connection capable of this. Unfortunately, with Destiny's apparent P2P mesh, it requires 700 kbps of bandwidth in each direction. This is problematic for some non-trivial number of players.

E.g., I recently corresponded with someone who lives on an island. He has only one choice of Internet provider, and the only choice they provide is a DSL service that is 5Mbps down and 1Mbps up.

Notice that his upload bandwidth is barely adequate in theory to handle Destiny's 6v6 upload bandwidth requirement. In practice, it seems to fall short of that. He is able to play 3v3 matches without problem, but when he tries to play in 6v6 matches, he often ends up not being able to register damage on targets. The probable reason for this is that the packets representing his bullets are getting lost due to insufficient upload bandwidth.

This may be one of the reasons that Bungie is switching from 6v6 in D1 to 4v4 in D2. Perhaps Bungie has noticed that too many of their loyal customers have crappy DSL connections with insufficient upload bandwidth for their P2P mesh approach to work well for 6v6 matches

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment