question

adrien avatar image
adrien asked

Parsing server request result in cloudscript ?

Hello,

Is it possible to parse server.GetPlayersInSegment() result in CloudScript ?

And if it's possible how to do that ?

Thx in advance

CloudScript
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

Bear in mind that you only have a few seconds of CPU time to work with when it comes to Cloud Script - it's really meant to be used for lightweight actions. So you could get the first set of users, but if you wanted to take action on each or try to use the continuation token to iterate across the full segment, that likely would not work. We'd instead recommend using a Task (Automation->Tasks) instead, targeting it to perform an action on all users in the segment.

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

adrien avatar image adrien commented ·

I'm trying to make a very simple asynchronous multiplayer system. When a user is searching for a match there is two case.

I requets the tag to know if there is a user who have already create a match.

If not, I tag this user and create a match Object in his playerdata.

When a match can start because opponents are paired, each player progression is saved in his playerdata.

So when I use this GetPlayersInSegment a small set of user is enough. However, I have difficulty to parse the result of the request in cloudscript. Can you show me some example of serialization/parsing in cloud script ?

0 Likes 0 ·
adrien avatar image adrien adrien commented ·

Oups, there is no editing tool ?

0 Likes 0 ·
brendan avatar image brendan adrien commented ·

Questions and Answers are moderated until you have a non-zero reputation, in order to prevent spammers from flooding our forums (we had issue with a previous forum system).

Now, for your feature use, the user segmentation system isn't going to work for matchmaking, the way you have in mind - it's simply not designed for that use case. We'll be providing a true asynchronous matchmaker in a future release, but for now I would recommend using Photon Realtime, as described in this thread: https://community.playfab.com/questions/515/207129407-Persistent-turn-based-games-.html

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.