question

davidepons97 avatar image
davidepons97 asked

Question about GetCurrentGames()

Hello!
I'm developing a multiplayer game using Unity, Mirror, and the PlayFabAPI, and I want to implement a list of available servers (Playfab servers) from which I can select one and connect to it.
The problem I am facing is that GetCurrentGames() always returns an empty list of games.

I feel like I'm missing something server-side, as my client is able to login and perform the API request perfectly.
Do I need to do something to "subscribe" newly created servers to the list of available games?

Thanks in advance!

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.

davidepons97 avatar image davidepons97 commented ·

Nevermind, I just discovered that GetCurrentGames() is part of the legacy API, therefore it needs the server to work in a different way.

This makes me rise a new question: is it possible to obtain the same behaviour given by GetCurrentGames() also with the Multiplayer 2.0 API?

0 Likes 0 ·
Citrus Yan avatar image
Citrus Yan answered

I believe the MPS (Multiplayer Servers) equivalent of the GetCurrentGame API you’re looking for is:

Multiplayer Server - List Multiplayer Servers (PlayFab Multiplayer) | Microsoft Docs - Lists multiplayer server sessions for a build.

Multiplayer Server - Get Multiplayer Server Details (PlayFab Multiplayer) | Microsoft Docs - Gets the details for a specific multiplayer server session

Hope you find this helpful.

10 |1200

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

davidepons97 avatar image
davidepons97 answered

Thank you for your answer Citrus Yan.
Eventually, since those two methods are only available on the server, I wrote a Cloud Script function to to retrieve the available sessions (together with their IPs, ports and IDs) exploiting those two functions.

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.