question

twiixyfr avatar image
twiixyfr asked

Using playfab for a masterserver

Hello, im working on a masterserver using Unity and i would like to implement playfab in it instead of mysql db for users, and have the possibility later on to use steam in my game and maybe some friendlist and stuff. The masterserver provide a secure way to connect to the players gameserver and displaying registered gameserver, but the dedicated gameserver server also need to check if the user connecting to him is correctly auth by asking to the master if they are. Do i need to connect the client localy and then check on the masterserver if they are connected in playfab at each request, or do i need to connect them and manage them in the masterserver ? What is the correct workflow to use playfab in a client/server architecture including playfab for managing the clients accounts ?

The master don't really need custom logic, he just need to register and auth players.

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

·
brendan avatar image
brendan answered

Can you clarify what logic your server will be running, specifically? The normal scenario is what we spell out in our tutorial (https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers), where you would connect the player to the server via our Client/Matchmake API call, and the server would check the player's authentication using Server/RedeemMatchmakerTicket. That call returns the profile data for the user, and then the server could read whatever data it needs for the player, in order to have everything it needs locally. Your server would run the game session for the user, and then update the PlayFab hosted data at the end of the session (possibly periodically updating the data during the session, if they're more than a couple of minutes).

10 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.

twiixyfr avatar image twiixyfr commented ·

Hey @Brendan , Custom game server seems to be good, but i have a question.

As you probably understand, i can't use the PlayFab cloud for the reason below, so, how does it work now if my registered count reach 1000 whitout using the cloud ? Do i need to pay 299$ each month just for the data management of my masterserver ? Seems quit expensive to me, PlayFab can really help me to save cpu and bandwith usage on my masterserver, since playfab can act as a relay and allowing me to simply create multiple masterserver instance using PlayFab for having an overload security

For the logic, actually, my dedicated gameservers are hosted by the players, when a player launch a server instance (headless), a message is sent to the masterserver who register it in a list, and when auth clients request a list of host, the masterserver send the list. So the problem is that i can't let the dedicated gameserver having secret api.

I need to have a masterserver for that kind of architecture i am right ?

0 Likes 0 ·
brendan avatar image brendan twiixyfr commented ·

I see - so the issue is that you have player-hosted game servers that you want others to be able to find and join. You'll need to build your own custom server to support that, since our matchmaker is designed for servers using our Server API - not player-hosted servers.

As to the use of PlayFab, I'd recommend looking at the full range of features. We provide far more than data systems. The LiveOps capabilities on their own are one of the most valuable things you can use to improve the retention and monetization of your titles (if you didn't get a copy of our guide to LiveOps at GDC this year, we'll have it on the site shortly).

And the $299 per month minimum is only for our Professional tier. The Indie tier is a flat rate of $99 a month until you have 100K MAU or more, and both those tiers do not start billing until you have 1,000 or more player accounts. And, of course, we also have our Essentials tier, which is free.

0 Likes 0 ·
twiixyfr avatar image twiixyfr commented ·

So i need to implement playfab in my masterserver and my client, but not on the dedicated gameserver, this one will need to ask to the masterserver if the client is auth using some ticket system, like playfab do, this his how a dedicated gameserver should act i suppose (he doesn't have acces to private users data since a client hold it), but the workflow seems to be a little bit weird in my mind, i mean, is that ok that have 2 core server for a masterserver architecture (Mine and PlayFab) ?

Also the indie tier is only a limited time offer.

0 Likes 0 ·
brendan avatar image brendan twiixyfr commented ·

Our Indie tier will remain available for the foreseeable future - we have no plan to change it right now.

The version of the game you send to players must not have the Secret Key for your game, so it cannot make Server API calls. The version you refer to as your "masterserver" would need to make Server API calls for multiple reasons, one of which will be to do matchmaking (assigning players to servers). What I would recommend is that you generate a GUID in your matchmaking logic, and send that to the player. The player-hosted server would verify the player with you, using that GUID.

0 Likes 0 ·
twiixyfr avatar image twiixyfr brendan commented ·

Of course i don't give the secret key to the client. But why playfab don't support custom key with defined authorization ? For example i could make a special key for the gameserver, so he can register himself to the custom gameserver list, or checking if a user is correctly auth directly in the gameserver code instead of sending useless message to my server ? Last thing, can we publish the game using the free plan before upgrading to pro or indie plan ?

0 Likes 0 ·
Show more comments
Show more comments
Caleb Smith avatar image Caleb Smith commented ·

@Brendan Is there any way you could explain this a little more? I'm trying to figure out how to use Playfab with either mirror or photon to make a turn based multiplayer game. Initially I was set on using mirror, and I assumed that the idea would be using playfab to store everything/authenticate/etc. and starting up a mirror server build that would manage the matchmaking and match logic. I made the assumption that one build would be used to manage multiple matches at a time, but the more I dig it seems as though the idea is actually to have a server spun up by playfab for EACH match? I'm having difficult time for some reason understanding how the matches are handled in regards to master/game servers. If I do in fact design it in such a way that my build is duplicated for each match, I just want to be sure that wouldn't be using too many playfab resources as opposed to managing many matches with each game server. Hopefully this all makes sense. Thank you in advance for any advice you'd have.

0 Likes 0 ·
brendan avatar image brendan Caleb Smith commented ·

First, the answer above is quite old, and talks about the old matchmaker. I'd highly recommend using the new one: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/matchmaking/

The thing to bear in mind about "server" is that it's an overloaded term. When you spin up a game session - an instance of your executable, you could call that a "server", but it's really just a containerized instance of your exe running on a VM. The server hosting it could have several of those running on it - it's up to how you configure your build.

Next, whether your exe hosts two players in a one-on-one match or 100 players in 50 one-on-one matches is up to you. Matchmaking is more complex if you want to subdivide within the sessions like that, but it can be done. You'd lean heavily on backfill tickets in that model. If you're not a veteran with servers though, I'd go the simple route and just have your build host one match. You can always experiment with going the more complex route later.

1 Like 1 ·

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.