question

joehot200 avatar image
joehot200 asked

PlayFab matchmaker doesn't seem to know how many players server has.

I've been testing if PlayFab will assign players to a new server if the server is full, as specified by the max player count setting in the game modes tab.

If I set the max player count to 1, and start up two clients, then both of them end up on the same server.

This means that PlayFab isn't automatically firing up a new server when the last server becomes full. Obviously, this isn't good for scalability.

How do I let the PlayFab matchmaker know how many players a server has on it, or that the server is full?

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

Actually, the PlayFab matchmaker is designed to only assign as many players to a server instance as is specified by the max player count for the game mode that instance in running. A server host machine, of course, can run many instances, just in case that's what you're referring to.

However, it sounds like you've found a corner case based upon a non-supported condition. There's no scenario in which a max player count of one would be valid. If you only allow one player per instance, you're going to be racking up some pretty high server hosting costs, since that means you'll be starting an instance for every single player. If what you're trying to do is have a single-player game, but with server authority, the way to do that would be to allow N players per server instance, where N is some non-trivial number based upon what you can support in a single VM. In your game server code, you would maintain separate state information for each player, but you would not then be losing all the CPU, memory, and disk costs that each OS instance would incur.

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

joehot200 avatar image joehot200 commented ·

Sorry. By "server", I mean game instance.

My example of 1 player per server (which I used for testing) was just a test case, which has proved to me that PlayFab matchmaker is not behaving the way it needs to for my game to work.

Basically, I want anywhere between 1 and x players to be playing on instance 1 (on release, x = 20. For my test case, x = 1). If a player leaves server 1, I would like that slot to be open again for another player to join again.

x is the game modes max players option.

So if a server can have 20 players (so x = 20), I would like the first 20 players to log in to join instance 1. If another player joins, I would like them to join instance 2, because instance 1 is now full.

If a player now leaves instance 1, and another player connects to the matchmaker, I would now like them to be directed to join instance 1.

Which leaves 20 players on instance 1, and 1 player on instance 2.

0 Likes 0 ·
brendan avatar image brendan joehot200 commented ·

What you're describing is how the matchmaker works. If you have a Game Mode defined as having a max of 20 players, it will allocate that many slots for players in each instance running that game mode. As players matchmake and join, they consume slots. If someone leaves the server, or doesn't use their allocated slot for a couple of minutes, it's freed up for someone else. Now that said, this logic does require that you use the Server matchmaking API calls - RedeemMatchMakerTicket, NotifyMatchmakerPlayerLeft, etc.:

https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers

When a matchmake call is made, we find all servers matching the requirements which have open slots and allocate a slot from one of those. So it's not necessarily going to be the server that most recently had a player leave, unless that's the only one that matches (or, in the case of using statistics for matchmaking, it's the best match).

This system is currently being used by live titles (and has been for years), so if you're running into issues, it would be best to give us all the details (Title ID, etc.) so that we can help you track down the cause.

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.