Allan Michael SMith avatar image
Allan Michael SMith asked

Multiplayer 2.0 Resources/Documentation/Tutorial


While the whole Playfab suite seems very attractive for our studio, by just reading the documentation and forum posts we are feeling a bit lost about how to go about, mainly, Multiplayer 2.0. We are starting a new game now and ideally we will need an authoritative server to run the game logic. Your solution seems very interesting, but I was looking at the sample provided (Windows Runner) and well, it basically uses the HTTP listener to return a config file...

I am not an experienced backend engineer to be fair, but I dont have a clue how to make the leap from that, which honestly would be much easier to do just using Azure and an ASP.NET core api solution lol, to actually having server-side logic... I mean, how does this server communicates with the players? how do the players connect? how does the server know how to send packets down?

I am sorry if I am being a bit daft but, even though I believe I've read EVERYTHING about Multiplayer 2.0 on your documentation so far, I still have no clue how that becomes a real time server... could you please point me in the right direction?

PS: We are not yet a costumer, but since this is the core concern for us, we need to understand how your solution could help us solve this problem.



Custom Game Serversdocumentation
10 |1200

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

Allan Michael SMith avatar image Allan Michael SMith commented ·

Oh... so that means that in theory that sample windows runner app is supposed to, in your example, spin up a unity instance with some command line parameters or something like that so that instance knows it is a server, the kind of room to create and so on, than that instance just uses that library you were saying to host a new room and inform the runner somehow that it is now officially “ready for players”, which then eventually goes to the clients that now have that IP, and they use the multiplayer library to connect to a room with that IP, that sounds about right @Brandon Phillips?

0 Likes 0 ·
Brandon Phillips avatar image Brandon Phillips Allan Michael SMith commented ·

Yeah, so the WindowsRunnerCSharp is just an example project to show how you can integrate the GSDK with your own server application, and the GSDK itself is what each server instance hosted with 'Multiplayer Servers 2.0' runs. The flow (at least for us) is like this:

We write the server application, and integrate it with the C# GSDK. When our server application is initializing, we call


This lets the PlayFab hosting service know the server instance is now running/ready for players/etc.

PlayFab then has APIs (matchmaking or multiplayer APIs) that you can call to request a server be started, and the call will return the IP and port number to you.

That's about "all" it does in terms of connecting and server logic. When it comes to actually connecting the clients to the server, what the server does and controls, what the clients send and receive, etc. - all of that is what you develop in your game.

0 Likes 0 ·
Brandon Phillips avatar image Brandon Phillips Allan Michael SMith commented ·

@Allan Michael SMith I'm oversimplifying a little bit, but it really is relatively simple to implement once you figure out the quirks. I'm not sure of your level of experience, but two months ago I had almost no experience with multiplayer or networking, and now we have a "fully functional" playfab-hosted server implementation.

Again, though, the actual way you connect clients to your server and manage networking is up to you. There are dozens of ways to implement this, and if you're using a game engine it is probably even easier. For us, we're using Unity with a networking plugin called Mirror (open source replacement for Unity's deprecated networking system), and since our Client and Server are both running the same "scene", we can connect directly and immediately sync the state of all objects, etc.

The downside to using Engine-built server executives (in our case) is the cost. While we save some money using PlayFab's Linux containers instead of Windows, each of our server instances uses around 50mb of memory (minimum!) when idling (which we're hoping to eventually lower).

0 Likes 0 ·

1 Answer

Brandon Phillips avatar image
Brandon Phillips answered

The multiplayer hosting 2.0 is just a way to host and scale server instances. For example, you can use the playfab API to request a server instance, and the API will return an IP and a Port number.

You would need to build the server executable itself and set it up with your game. For example, our game is written in C# in Unity, and our server and clients builds are very similar as we use an open-source version of Unity networking.

So we configure our game (as client) to connect to our game (as server), and configure PF to host our game server.

10 |1200

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

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.