question

Ross Klettke avatar image
Ross Klettke asked

PlayFabParty: proving 'host' role?

Hi, I'm implementing a networked Unity game using PlayFabParty through the PlayFabMultiplayerManager -- peer-to-peer with one acting as the host.
The question I have is: how do newly-joined peers know who the host peer is? And how can this be done in a way that doesn't leave it open to a non-host peer maliciously claiming to be host?

Is there a recommended way to handle this within PlayFabParty or PlayFab?


A few paths I suspect might be worthwhile checking out(?):

  • Right now in Unity I'm using the provided PlayFabMultiplayerManager -- which creates one network and, as each peer joins, every peer on that network is made aware of every other peer on that network. I need to do more reading about this but possibly there's a way to create multiple networks within each contest (a round of gameplay) so that each peer in that contest is only able to communicate gameData directly with the host?
  • The other route would involve something like the host writing publicly-readable data containing the matchId to PlayFab somewhere -- and then, when there are multiple peers claiming to be the host to a newly-joined peer, the new-peer can compare DateModified metadata for each of the claimants' files to determine who has the *true* claim -- in the case of my game it'd probably be whoever has the oldest DateModified time. This is under the assumption of course, that whoever creates the initial network is also the host and that they would wait for confirmation of their file having been written to PlayFab before inviting additional peers.
  • Perhaps Entity Groups is a path forward?


Possibly I'm missing something obvious.


Thanks,
--Ross

multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

What do you mean by host peer? Is there some document about that? Party Networks are initially created by the game as empty, but devices connect to them and authenticate at least one local user into the network. Networks that don't have any authenticated users are automatically destroyed after a timeout. Please refer to PlayFab Party objects and their relationships for more detail.

If you just want to control how your players can communicate with each other, you could check to this document PlayFab Party chat permissions and muting and learn how to configure the chat permissions.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ross Klettke avatar image Ross Klettke commented ·

The idea is that one peer is given an elevated status -- here called "host" and meaning that they have control of the game: they are the peer that decides who has won, how input-data received from other peers changes the game state, etc.

So, for the game it's very important that each peer knows who the "host" is -- that is, who to trust for information about the game state. And it's very important they don't trust some malicious actor -- e.g. a non-host peer sending messages saying that they themselves have won.

So the question is: how does a just-joined peer learn who the host is?

Using the Unity PlayFabMultiplayerManager provided by PlayFab I'm not quite sure how to accomplish this separate from maybe paths similar to the 2nd or 3rd bullet points above?

Alternatively, making multiple networks within the game sounds promising (bullet point 1) -- e.g. maybe the host peer creates a separate network for each peer in a way that each non-host peer can only communicate dataMessages with the host peer. I don't believe this is possible using the PlayFabMultiplayerManager currently but would be interested if this is the best path. (and I'd, of course, be very interested in this article)

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Ross Klettke commented ·

There is no such “host” in Party Network. Everyone who joins the party shares the same permissions. You may use some external service to mark the host and keep track of it.

0 Likes 0 ·
Ross Klettke avatar image Ross Klettke Rick Chen ♦ commented ·

For the "external service to mark the host" -- is some feature of PlayFab suited to this? For example, would Entity Groups be the recommended path?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.