Skip to content

Instantly share code, notes, and snippets.

@nessus42
Last active May 12, 2018 21:12
Show Gist options
  • Save nessus42/42c112d1f9eb3de147ab6e01439683da to your computer and use it in GitHub Desktop.
Save nessus42/42c112d1f9eb3de147ab6e01439683da to your computer and use it in GitHub Desktop.
Destiny Networking Primer: Kill "trading" also happens in PvE!

Destiny Networking Primer: Kill "trading" also happens in PvE!

Additional articles in this series:

Executive Summary

Q. Destiny 1 has an annoying PvE misfeature, seen mostly in raids, where you do something like kill all the Atheon Oracles, but then you end up getting wiped by an Oracle anyway. Why? And will this be fixed in Destiny 2?

A. Latency between the "Physics Host" (i.e., the P2P host that runs on a console in Destiny 1) and the "Mission Host" (a host that runs in Bungie's server cloud) causes important information for some raid activities to not always reach the the Mission Host in time to prevent a wipe.

In Destiny 2, since the Physics Host will be operated by Bungie in their server cloud (as will all "hosts"), rather than running on a console, this latency will probably be significantly reduced in the typical case, and consequently the frequency of such annoying wipes will hopefully also decrease significantly in Destiny 2.

Detailed Answer

I recently posted a couple of articles I wrote on how Destiny networking works:

Today's installment will be on the fact that in Destiny, kill "trading" not only occurs in PvP, but it also occurs in PvE. Most notably in raids, where, for example, your team kills all of the Atheon Oracles, and yet one of them still manages to wipe you posthumously. Or you shoot the Vosik monitor until it breaks and yet it still kills you all. Or you kill the Shade of Oryx and yet he still wipes you via "Doxology".

What causes these "interesting" lapses of fair death ordering? (AKA, infuriating bugs that make you want to throw your controller at the TV screen?)

I argued in the one of the articles listed above that kill-trading in PvP is a "feature, not a "bug", at least in Bungie's opinion. (Or rather, they consider it to be a necessary evil that is more fair than the alternative in the face of network latency between opponents.) I think that we can all safely acknowledge that the aforementioned "trades" we've all seen in raids, however, are not features; they are bugs or misfeatures.

In the course of posting my two previous articles, I've learned that some vocal "serious", "competitive" PvP players have no good words to say about Destiny's "netcode". And, in fact, if you happen to have anything good to say about their netcode... such as the fact that, for instance, you never suffer from self-rubberbanding in Destiny, which is a very annoying lag artifact frequently seen in games that use dedicated servers, some of these passionate folks will eagerly exalt you with the title of "Sock Puppet" or "Principal Apologist" or "Secretly-Employed Bungie Spin Doctor".

In this article, however, I will disappoint these enthusiastic protectors of the netcode realm by agreeing with them that these raid bugs could have been completely avoided with better netcode. But first let me explain why these bugs occur.

(Caveat: Bungie hasn't described in exhaustive detail how their networking works, so a few of the details described herein are educated guesswork.)

In Destiny 1 there a number of different "hosts". The Physics Host is what would just be called the "host" in many games. It runs on a "randomly" selected console in the raid. (It's probably not really randomly selected. Bungie's netcode probably selects it based on some sort of metrics designed to determine which console might be best able to due the job well, according to the quality of its network connection, etc.) Most of the authoritative game state is maintained on the Physics Host.

The Mission Host, on the other hand, runs in Bungie's server cloud. The Mission Host stores smaller amounts of authoritative game state, and it also runs an "Activity Script". The Activity Script does things like control when Oryx moves to a platform, which platform he moves to, etc. The Activity Script also will wipe you after Oryx claps his hands, or if you don't kill the Shade of Oryx before it is Doxology time.

You might now wonder, Why is there this separate Mission Host? Why doesn't everything just run on the Physics Host? That would be a lot simpler, wouldn't it?

Yes, indeed it would! But Destiny is designed to allow for "seamless host migrations". So let's say that Destiny decides that the current Physics Host is suffering from too much latency or too much packet loss. It might then decide that the Physics Host should run on a different console. (Or perhaps one of your fireteam members rage quits the game shortly after he's teleported right into Shade Oryx's slamming sword, and it just so happens that the Physics Host was running on his console. Once again, a Physics Host migration is required.) The reason for the separate Mission Host is so that the Physics Host can quickly be changed from one console to another without losing the most important game-state information. I.e., the most important game-state information is stored on the Mission Host, so even if the Physics Host ends up moving from one console to another, the game can continue on with barely a hiccup.

Now let's consider what happens when your fireteam is shooting at the Shade of Oryx. The damage from everyone's collective weapons is being accumulated by the Physics Host and subtracted from Shade Oryx's health. This is performed at 30 ticks. (I.e., 30 times per second.) The connection with the Mission Host, however, is only 10 ticks. So ten times a second, the Physics Host updates the Mission Host with the current health of Shade Oryx.

Uh, oh! The shade world is starting to get tinged with a bit of pink. Better kill Shade Oryx quick! Golden Gun to his head! And victory! Shade Oryx is dead! Victory dance ensues. Everybody is wiped by Doxology!

What? Wait? What happened??? You killed Shade Oryx and yet he killed you anyway? That's not right!

Remember that Activity Script running on the Mission Host that I mentioned earlier? In order for that Activity Script not to wipe you from Doxology, it needs to be told by the Physics Host that Shade Oryx's health reached 0. Unfortunately, that message did not reach the Mission Host in time. D'oh! Bungo puh-lease!

Could this unfortunate situation have been avoided? Or is such an unfortunate series of events sometimes unavoidable in a complex, distributed game such as Destiny?

Well... Bungie kind of dropped the ball on this one. For one thing, as any "serious", "competitive", PvP player could stridently inform you, Bungie could have used "dedicated servers" for all multiplayer activities. If they had done that, then this form of trading would not occur in raids. Unfortunately, you then might suffer from self-rubberbanding more often than you would like, and this is anathema to Bungie. (See my first article if you want to know more details about this.) Also, for Destiny 1, Bungie didn't feel financially confident enough to invest in the computing and networking infrastructure required for dedicated servers.

Well, then, could Bungie have avoided these raid trades without spending big bucks on dedicated servers?

Absolutely!

Here's how: Let's say that instead of the Mission Host wiping you directly, the Physics Host were to implement a "wipe" command that the Mission Host could send to the Physics Host when Doxology time arrived. And let's also say that the Physics Host could cancel this "wipe" command in the case in which Shade Oryx was already dead. If Bungie had implemented things in this way, then everything would be fine.

So why didn't Bungie do this?

[Begin sarcasm]

I'm an expert PvE player, so I can state with absolute authority that Bungie is a cheap and lazy outfit that would rather give us sub-par raids than spend a few extra man-minutes to cut and paste in five lines of code from Portal 2 that would have avoided this whole tragic situation. It doesn't matter that I've gotten thousands of hours of great gameplay out of Destiny for my $180. This shoddiness is just not acceptable for any AAA game, and even though I'm going to continue to play this dreadfully-implemented game until I've milked it for all it's worth, I'm going to complain and whine about every awful moment of torment that Bungie's shoddy and cheap programming has inflicted upon me. Clearly they care more about making as much money as possible than they do about providing gameplay that meets even the most minmal requirements of any serious PvE player.

Never mind that I know nothing about the complexities of programming large systems, or have any comprehension for the fact that sometimes software implementation decisions get made early in the design process that in retrospect turn out to be problematic, but which are difficult to correct after-the-fact in a large code base. Or that there are probably 1,000 other bugs and problems in the code base that are higher on Bungie's list of priorities to fix, I'm going to spout my opinion anyway! Because if I don't, then who knows what levels of depraved, buggy crapiness Bungie will subject us to next!

[End sarcasm]

Fortunately, in my experience, PvE players don't tend to talk in the above manner, even when engaging in the inevitable griping session about an infuriating raid glitch.

Q. Why does going to orbit and coming back again often help with these sorts of issues, when they are particularly pronounced?

(1) You are likely to get a different Mission Host when you reenter the raid. The Mission Host you were using previously connected to might have been running on an overloaded server, or on a server with bad network connectivity for some reason. (2) You might end up with a different Physics Host, and the Physics Host that you were using previously might have not had a great network connection.

Q. Considering that all that Bungie needs to do is paste in five lines of code from Portal 2 in order to fix the problem, surely they've done this for Destiny 2 and consequently, eliminated the issue. Right?

Ummm, well... maybe? Anything is possible. But I'm a software engineer myself, and even when I know in theory how a misfeature should and can be fixed in software that I myself am developing, and conceptually the fix is not rocket science, it often turns out, in practice, that implementing such a fix is a mountain of hurt. Consequently, I have to disagree with Mr. Expert PvE Player's opinion from above. Adapting a large, complex existing code base to do the "right thing", can be notoriously difficult, even when it seems to be quite simple in one's mind's eye.

Q. Does this mean that we're screwed? That we're going to continue to have to put up with these raid glitches forever?

Well, not necessarily. If we're really lucky, Bungie may have implemented the type of fix that I described above. I tend to doubt that they have, however. As important as Destiny's raids are, only a relatively small percentage of players actually seem to play them, and Bungie has had a lot of other things to worry about for Destiny 2.

On the other hand, all is not doom and gloom. In Destiny 2, since the Physics Host will be operated by Bungie in their server cloud (as will all "hosts" in Destiny 2), the latency between the Physics Host and the Mission Host will probably be significantly reduced in the typical case, and consequently the frequency of such annoying wipes will hopefully also decrease significantly in Destiny 2.

It's also possible that the Mission Host and the Physics Host for a raid will always run on the same server computer. This would eliminate networking latency altogether. (Though there could still be some residual small computational and communication latency.)

Another possibility is that since there will be no host migrations during raids in Destiny 2, the need for a separate Mission Host has gone away completely. Consequently, it's possible that Bungie have have merged the Physics Host and Mission Host for raids in D2, and this approach could eliminate these raid glitches.

In conclusion, I expect that "trades" in raids (and other raid glitches caused by latency between the Physics Host and the Mission Host) should occur significantly less often in Destiny 2 than in Destiny 1. And, if we're really lucky, maybe even not at all.

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