question

Matt avatar image
Matt asked

Multiplayer Server Setup and Pricing

Hi folks,

I'm having a lot of trouble understand how I should setup my game and what I could expect the costs to be. My question is actually very similar to this question: matchmaking-with-multiplayer-servers-costs

My game is built in Unity for mobile: iOS and Android. Players can choose 1 of a dozen different levels to battle another player. Players are matched by the level chosen and their in-game rating. When match completes, players gain/lose rating based on results.

I previously used a legacy server. I built the server so that one instance would run, and it'd manage every single player that enters the arena (chooses level to battle a player). I simply had a list of all players, and they'd be paired into matches until they finished. The server would call the cloud script to conclude their battles and they'd disconnect (or rematch if they wanted).

With the new Multiplayer Server system, is that still a correct way to approach this (all players in a list in a single instance on a single VM)? Having a single server instance that takes in every player and handles everything internally? If so, the Matchmaking service (which I can only access via the Rest API since I'm in Unity) seems like it wouldn't work, since a Match holds the players that can join?

I know some of this isn't PlayFab specific, and just how servers are typically setup, but in the context of PlayFab, it's still infinitely valuable to me. I appreciate the help!

-Matt

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.

Neils Shi avatar image
Neils Shi answered

With the new Multiplayer Server system, is that still a correct way to approach this (all players in a list in a single instance on a single VM)? Having a single server instance that takes in every player and handles everything internally?

PlayFab Multiplayer Server is designed for session-based games, the server instance starts when there are a group of players want a match, and it shuts down when this match is over, so, you cannot use a single server instance to handle all logic. For more info about multiplayer server’s lifecycle, you can refer to Lifecycle of a multiplayer server - PlayFab | Microsoft Learn. If your games are just 1v1 with minimal server usage, you could run many server instances on one VM (you can configure it via “server per machine”). Please note that you need to run some performance tests by yourself to figure out how many instances your server can run on a single VM without having performance issues. In addition, you can refer to our complete documentation which guide you to integrate, debug, and deploy the server build with new Multiplayer Servers. And if you want to learn more about PlayFab Multiplayer Server pricing, you can refer to Multiplayer Servers - detailed price sheet - PlayFab | Microsoft Learn.

If so, the Matchmaking service (which I can only access via the Rest API since I'm in Unity) seems like it wouldn't work, since a Match holds the players that can join?

The PlayFab Multiplayer Server and Matchmaking service are independent functions, so, you don't have to worry about the Matchmaking service not working. If you want to integrate Matchmaking with PlayFab Multiplayer Servers. You can enable “server allocation” when configuring the matchmaking queue. Once you enable this feature, matchmaking will attempt to allocate a server for all the matches created within the queue. After matchmaking allocates a server for the match, the resulting server details can be read from the Match object itself by calling GetMatch, then clients can use the IP and port from the server details section of the response to connect to the server. For more info, please refer to Integrating with PlayFab Multiplayer Servers - PlayFab | Microsoft Learn.

10 |1200

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

Dimitris Gkanatsios avatar image
Dimitris Gkanatsios answered

You can also use this preview feature if you integrate MatchMaking and MPS -> https://github.com/PlayFab/MpsSamples/blob/main/MatchmakeSample/matchMakingAndMps.md

1 comment
10 |1200

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

dev-9-1 avatar image dev-9-1 commented ·

This worked for me in Unity (2021.3.19f) Big Thanks to Dimitris for providing this finally!

0 Likes 0 ·

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.