Skip to content

Instantly share code, notes, and snippets.

@nessus42
Created January 18, 2018 22:37
Show Gist options
  • Save nessus42/55c1260d88e2028689de0c49381ddfd7 to your computer and use it in GitHub Desktop.
Save nessus42/55c1260d88e2028689de0c49381ddfd7 to your computer and use it in GitHub Desktop.
Destiny Networking Primer: Why does Destiny 1 do P2P mesh networking?

Destiny Networking Primer: Why does Destiny 1 do P2P mesh networking?

Executive Summary

Destiny 1 maintains a P2P mesh so that other players won't appear frozen in place during a host migration.

Or at least that's my educated guess.

Detailed Answer

Over the past few weeks, I've posted several articles I wrote on how Destiny networking works:

This primer will be my final installment before Destiny 2 goes live. Once that happens I'll be too busy playing Destiny 2 to fill up /r/DestinyTheGame with any more networking theory (AKA noise). This is probably for the best!

In any case, today's primer is on, Why does Destiny 1 do PvP mesh networking? Especially when doing so incites so much flack from those who believe that all P2P game networking is inherently evil?

So... Destiny 1 seems to do PvP mesh networking. I.e., it seems that every console in a Destiny Bubble (AKA a "zone") communicates with every other console in the Bubble. The evidence for this initially came as a surprise to me, since such a mesh is not mentioned in any of Bungie's technical presentations that I'm aware of. But there is some decent evidence for a P2P mesh. The evidence is documented here and here. Also, as I will argue, we also have good reasons from first principles to believe that Destiny does indeed implement a P2P mesh.

This in contrast to most FPS games that use P2P networking. I believe that most FPS games that reply on P2P do not typically use a mesh. Instead, they typically use only a P2P "host". Such a host is sometimes called a "listen host". A "listen host" is kind of a like a dedicated server, only it isn't actually dedicated. I.e., instead of running in a server farm somewhere, it runs on one of the consoles in the game, which is selected either randomly by the netcode, or via some metrics that determine which console is best-suited for the job.

When playing an FPS game that uses such a host, consoles in the zone don't typically communicate directly with each other. Each console (except for the host) communicates only with the host, and then the host communicates with all the other consoles.

Destiny 1 also has such a P2P host. Bungie calls this host the "Physics Host". The term "Physics Host" is something of a misnomer, since the Physics Host is responsible for a lot more than just calculating physics. Also every console in the Bubble is also calculating all of the physics all of the time, anyway, so Bungie's terminology here tends to cause some amount of confusion. But, the Physics Host does maintain the authoritative version of the physics state of the game, in addition to maintaining additional authoritative game state.

Given that Destiny 1 has a listen host, why would it also need a P2P mesh? The answer to this question starts becoming clearer if you start to ponder upon the question of how Destiny achieves its "seamless" host migrations. I.e., when the player whose console is running the Physics Host leaves the Bubble (or perhaps when Destiny decides that the current Physics Host is not the best console for the job), a host migration must be performed.

In every other FPS game that I have played, when a host migration occurs, the game pauses for a while with an on-screen notification that a host migration is in progress. You then have to wait a while for the game to continue. Bungie's previous game, Halo: Reach behaved in exactly this manner, which is, of course, rather annoying. Especially when it happens frequently. Fortunately, this never happens in Destiny. If you want to know more details about how this is achieved, then please read the first article I posted, which is listed above.

One thing that was left out of both Bungie's explanation and my previous explanation for how seamless host migration is implemented, is the following: How can we see other players moving around if there is no Physics Host? Shouldn't they appear frozen in place until the host migration has completed?

The answer to this is yes! At least according to everything that has been said so far. But clearly this isn't the case. And if it were the case, it would defeat the whole point of seamless host migrations to begin with. I.e., they wouldn't be "seamless"; they'd be annoying and wrong.

So how is it that we can and do see all the other players moving around even during the time when there is no Physics Host in the Bubble? Well, there are all sorts of ways that this feature might have been achieved, but the simplest explanation is that there is a P2P mesh in which each console is continually sending to every other console in the Bubble the location of its player in the Bubble.

And this simplest explanation seems to be backed up by the netscope data that I cited above.

I think that it is premature to consider this conclusion to be definitive at this point, but I do think that this explanation is the best current theory.

Q. Will Destiny 2 still require a P2P mesh?

A. At first blush we might think not, since Bungie has stated that for Destiny 2, the Physics Host will always be located in Bungie's server cloud and because of this fact, there will not be any host migrations in Destiny 2.

I'm not sure, however, that we should take Bungie's stated word on this completely literally. I think it likely that there will still be host migrations at times, and consequently, there will still be a need for a P2P mesh.

To see my reasons for believing what I just stated, see this FAQ I wrote. Read the first entry.

Q. Are there any serious disadvantages to using a P2P mesh?

A. For PvP, there are some definite advantages to using "dedicated servers", which would not utilize a P2P mesh. But there are also disadvantages to using dedicated servers. For a discussion of these issues, see my first two articles, which are listed above.

Also, a P2P mesh requires more upstream bandwidth for each console than other approaches. For a 6v6 crucible match, the amount of upstream bandwidth required may be more than some slow Internet connections provide. Consequently, this may be one of the reasons that Destiny has moved to 4v4 for PvP.

For more information on this issue, see my primer on PvP "kill trading", which is listed above. In particular, read "Note 2" in that primer.

Q. Are there any advantages to using a P2P mesh, other than for implementing "seamless" host migrations?

A. Yes, a P2P mesh can reduce the latencies for which you observe the movements of other players. Without a P2P mesh, such information has to go from another player's console to a server, and then from the server to your console. But with a P2P mesh, it can go directly from another player's console directly to your console. The direct route will typically be significantly faster.

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