tomasvymazal avatar image
tomasvymazal asked

Matchmake requests sent in a same time end up beeing placed in different game instances.

Hi, we've come to a problem that is not limited to particular PlayFab TitleId, but we tested it on more PlayFab TitleIds and result always seems to be same. The problem is as follows: when we start matchmaking on multiple devices in a same time (there may be slight delay around 100ms) while having exactly same request, the players end up beeing in different games.

Example of unexpected behavior:

We started exactly same matchmake request on 5 devices. Three of the devices ended up in a same game instance, but two of the devices ended up in their own instances. So there was exactly 3 instances of a game resulting from exactly same matchmake request.

We tried to do a matchmake first on one device, than wait for a few seconds and than do matchmake exactly in the same time on the rest of devices. This ends up correctly, all the devices ending up in the same game instance. It seems that first device matchmake request spun up the game server and rest of the matchmake requests merged to that one instance.

But we would expect that matchmake requests sent in a same time (as in an example of unexpected behavior) would end up in a same instance too.

Is this a bug? How do we achieve an expected behavior of having all clients ending in one instance?

10 |1200

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

brendan avatar image
brendan answered

The way the matchmaker works is that it takes all available sessions that match the required parameters (game build, mode, region) and then randomly pick one with an open slot, so that players are distributed. What happens is that we "lock" a slot in that game session to the player doing the search for two minutes, so that they can join. In the case where there are no running sessions (or none with available slots), we'll start a new session for the player requesting. If multiple calls occur simultaneously, that may result in multiple sessions being started at the same time, since the calls are handled in parallel (serializing them would introduce delays).

If there's a different matchmaking model you'd like to use, you can build any type of matchmaking logic you like using the Matchmaker API.

10 |1200

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

tomasvymazal avatar image tomasvymazal commented ·

Is there any way to start a new session, but not from a client, but i.e. from other server instance or Cloudscript? Because our problem is that when one game ends, we want to start another one, but keep the players from previous game in a same instance for a new game. We know this information in advance when older game ends and server could possibly start a new session by himself...

0 Likes 0 ·
brendan avatar image brendan tomasvymazal commented ·

First question: Why are you moving them to a new server instance, if you want them to continue playing together? Why not just start a new "round" on the server?

If you can't keep the players on the same server, I'd recommend having them negotiate a "leader", and have that client use Matchmake to create the new server, then send that data to the others back on the first server, so that everyone can use Matchmake on the Lobby ID.

0 Likes 0 ·
whirata avatar image
whirata answered

I know this topic is a bit old but regarding the issue that was on topic, is there a way to avoid that behaviour and always have one instance created at a time?


This thread is old but lately I'm facing that issue, in the project we are using PlayFabClientAPI.Matchmake and sometimes it ends in multiple instances.

Is there any way to avoid that issue when no instances are available?

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.