question

Joe Fender avatar image
Joe Fender asked

Communication between PlayFab and server for room IDs

We're preparing the use of PlayFab Multiplayer in our multiplayer game. Players will have an option in the menu to "host" a new game, which should just join an empty server that is ready to accept players.

For this to work, I have a couple of questions:

  1. Can we always assume that an empty server on PlayFab will be available for them to join? I guess thats the whole "standby server" stuff?
  2. When our server build executes, it automatically creates an empty game via our relay network (we use Photon Bolt) using a uniquely generated room ID (e.g. ABCDEFG). For the "host" player to connect, they need to know that unique room ID. How can we communicate that ID back from the server build to PlayFab and subsequently the user when they "host"?

We're loving the PlayFab platform so far, so looking forward to going live with this.

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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> Can we always assume that an empty server on PlayFab will be available for them to join? I guess thats the whole "standby server" stuff?

For the clarification, the count of the Standby Severs has its limits. It will always be less than the Maximum Servers’ count you set. You can set the count of Standby Servers when you deploy the build. After you deployed the build, you still can modify it in the build settings.

Dynamic Standby can prop more servers depending upon demand.You can check this documentation -- https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/dynamic-standby for the details for Dynamic Standby.

>> When our server build executes, it automatically creates an empty game via our relay network (we use Photon Bolt) using a uniquely generated room ID (e.g. ABCDEFG). For the "host" player to connect, they need to know that unique room ID. How can we communicate that ID back from the server build to PlayFab and subsequently the user when they "host"?

Could you please clarify that, what is the purpose of sending the ID to PlayFab? After players connect to the server, the server can send the ID via socket directly.

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.

Joe Fender avatar image Joe Fender commented ·

Thanks for the response. We are using Photon Bolt for our servers (i.e. multiplayer SDK) and for a client to join a server it requires that they pass the "session ID" to Bolt. Photon's servers relay the connet request to Playfab. (We are not able to do direct IP connections with Bolt without paying for their higher subscription)

The "session ID" is a string that we can define to be whatever we want. So we can make it a random string like "ABCDEFG".

I guess there is 2 ways to approach this:

  1. When a server starts on PlayFab we automatically generate a session ID and then associate it to some metadata for that server. Is there an API for the server to do this with PlayFab? Then, the first client who wants to "host" would ask PlayFab for a server that is empty and ready and it retrieve the metadata (session ID) for it (is there a client API for this part?). Then the client can connect to it via Bolt.
  2. The first client who wants to "host" a new game would create a random session ID locally and then send that to PlayFab via an API which would then pass that metadata when creating a new server. The problem here is that it takes time for the new server to initailize so there will be a delay.
0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Joe Fender commented ·

>> When a server starts on PlayFab we automatically generate a session ID and then associate it to some metadata for that server. Is there an API for the server to do this with PlayFab?

There is no such API can be used to associate the custom ID to the server's metadata. When the server session is allocated by PlayFab, PlayFab would generate a SessionId for the server. Can you use this SessionId?

If you use the SessionId generated by PlayFab, you can get it from getting the configuration settings. For more details, please check this section -- https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/integrating-game-servers-with-gsdk#getting-configuration-settings-within-your-game-server.

0 Likes 0 ·
Joe Fender avatar image Joe Fender Sarah Zhang commented ·

Ah, I see. Is it possible that we pass a custom SessionId with the RequestMultiplayerServer API call? Then PlayFab can pass that SessionId to our game build running on your servers? If possible, that should be sufficient for our needs.

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.