Prateek Shah avatar image
Prateek Shah asked

Matchmaking Flow with Multi-Session Custom Servers


I'm using PlayFab to host a 1v1 turn-based custom game server, integrated with PlayFab's player management and matchmaking. So far I've been auto-allocating game servers through the matchmaker, but due to the limited sessions per VM (60-port restriction), I need to move to multiple games per server instance. I was hoping someone could verify or correct/improve my planned flow for this:

1. Client (Unity): Logs in, joins matchmaking queue, gets matchID, executes cloudscript with matchID, gets server details and connects

2. Server Allocation: Cloudscript checks for servers tagged as accepting clients, if none spins up a new server. In either case, passes details to client

3. Game server: Tags itself as accepting clients until a certain number of clients (cumulative, not concurrent) have joined, then removes the tag and shuts down after games are over. When client connects, verifies matchID, starts a new game once two players with same matchID have joined.

A few questions in this regard:

I - What is the best way to let Playfab know that a player is currently in a game? Is UpdatePlayfabPlayers sufficient or should I Register every game with the matchmaker?

II - The GetMatch API needs an entitytoken - is this automatically provided on the server side C# API if I leave the AuthenticationContext field in the GetMatchRequest empty? Or do I need to create an authentication context using the user's details (which then I'm guessing the client will have to send to the server through my messaging system?)

Glad for any thoughts, inputs and discussions!

Custom Game ServersmultiplayerMatchmaking
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

Seth Du avatar image
Seth Du answered

I want to double-check with you about your requirement before we can deliver a suggestion.

“Servers per machine” determines how many instances can be created in a single server core, which is a VM core. Different server cores will have different computing and storage capability. For example, you are able to see the details about A2_v2 cores at Av2-series - Azure Virtual Machines | Microsoft Docs. Even though the docker will save many resources when running multiple instances, you should test on your own to confirm that whether it can host 60 instances.

Meanwhile 60 instances are not the maximum limit of a server build, titles in development mode will have certain quota of server cores, which can be increased on your own at Quota page. If you increase to 50 Av2 cores at East Us while you have configured 60 servers per machine, you are able to set 50*60 = 3000 max servers at East US, which are 3000 instances in maximum.

Please note that 1 match created by a matchmaking ticket, will only create 1 instance. If you want other matches joining into the same instance, it will require your own management, which can be complicated because there should be an external agent server caching existing running instances information for connection. The cheapest server core is A1v2, if you can confirm that it is able to handle 60 instances. We may dig into your requirement.

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.