question

Malik Allen avatar image
Malik Allen asked

Hey, I am looking to get information/data from all the players in a match from the server using cloud script. How do I go about it?

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

Malik Allen avatar image Malik Allen commented ·

This is in order to send information out to all the players in the match

0 Likes 0 ·

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

First of all, it might not be a good idea to get the data of all the players using Cloud Script, there are limits for the number of API requests issued in a Cloud Script function, hence it will certainly hit the limit if the number of players in a match is huge. A better way to do this would be enabling PlayFab SDK for your servers to call server APIs to get the data of those players, which would give you far more flexibility than using Cloud Script. And please also note that your server should manage a list of PlayFabIds of those players for the APIs to consume.

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

Malik Allen avatar image Malik Allen commented ·

Some context:

Each match consists of only two players. Turn based async game. Players need to submit a request to end their turn, server has recieved information from both participants, I would like to send out data to the players in the match.

I have set up the cloud request on the client. Is there functionality in the server to send information to a group of players? I really only need the PlayFabID of the players in the match, hence maybe using the MatchId to locate the match and get the members from there.

Been looking through the documentation, just having a hard time finding what functions I need on the cloud scripting side of things and this seems like it is something simple. Can you point me in a direction?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Malik Allen commented ·

Hi @Malik Allen,

Based on your description, it looks like you are not using a dedicated server for each match, and the server you talked about is actually PlayFab, is that right? If that's the case, then "the functionality in the server to send information to a group of players" is actually the functionality for PlayFab to send information to players, which is more like a Pub/Sub system.

PlayFab does offer such functionality: PubSub, allowing PlayFab to send information to game clients. However, this is currently in Private Preview, only restricted to select titles. If you are interested in trying it, please contact us at helloplayfab@microsoft.com

Regarding some directions on this, you may find this thread helpful: Persistent turn based games?

1 Like 1 ·
Malik Allen avatar image Malik Allen Citrus Yan commented ·

Thank you, that clears things up. I will reach out to the email to find out more about PubSub. For the time being I will be using Photon inside of the to communicate between players.

Is there an ETA on the PubSub?

Thank you

0 Likes 0 ·
Show more comments

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.