Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Allan Michael SMith · May 31, 2019 at 05:34 PM · Custom Game Serversdocumentation

Multiplayer 2.0 Resources/Documentation/Tutorial

Hi!

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.

Best,

Allan

Comment

People who like this

0 Show 3
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Allan Michael SMith · Jun 01, 2019 at 09:14 AM 0
Share

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?

avatar image Brandon Phillips Allan Michael SMith · Jun 01, 2019 at 09:41 AM 0
Share

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

GameserverSDK.Start();
GameserverSDK.RegisterShutdownCallback(OnShutdown);
GameserverSDK.RegisterMaintenanceCallback(OnMaintenanceScheduled);
GameserverSDK.RegisterHealthCallback(IsHealthy);

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.

avatar image Brandon Phillips Allan Michael SMith · Jun 01, 2019 at 09:48 AM 0
Share

@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).

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brandon Phillips · Jun 01, 2019 at 02:13 AM

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.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Multiplayer with authoritative server hosted by PlayFab with Unity Networking 2 Answers

    what if we decided to move our game from playfab to custom backend infrastructure in future?,what if we want develop a custom backend for our game in future ?? 1 Answer

    what if we want to stop using playfab and shift our title to our custom backend in future after a year from game launch 1 Answer

    I want to develop the game by Unity and configure the server using UWP. Which document should I refer to? 1 Answer

    Playfab instance costs & resource allocation? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges