question

goncho avatar image
goncho asked

[SERVER or Cloud Script] Retrieving Server CustomData or Tags without Client.GetCurrentGames

I need a way for a custom Server hosted with Playfab to read the changes on its own CustomData or its Tags.

Right now the only way to modify them is via Cloud Script called from a Client. After a GetCurrentGames() I read the CustomData and call the Cloud Script with the CustomData modified so the Cloud Script uses Server.SetGameServerInstanceData to update the value.

Any way I can read that CustomData (or Tags) in the Server instance? It could be a CloudScript function called from the server but I don't find a way to access that data besides the GetCurrentGames().

I actually plan to use a Tag in the server with the LobbyID so in the Client I can update the actual CustomData with a Tag filter in GetCurrentGames. It will be better if I there is a way to ask directly for the CustomData (or Tags) of a Server instance using its LobbyID.

Thanks for your amazing product, our game it's working great thanks to your hard work!

apisCloudScriptMatchmakingCustom 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 recommended way to update the CustomData and Tags for a dedicated server would be for the server to call the appropriate Server API call. Is there a reason that's not an option in this case?

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

goncho avatar image goncho commented ·

Yes, I want the user to add itself to a "waiting list" in the server, so that's why I'm using the CustomData and updating it from the client via Cloud Script. The plan is to be able to do a background matchmaking while the user is playing and connect to the match when enough people is waiting.

This is the process (if there is a better way to do it just tell me):
1. The client call GetCurrentGames() and selects a game to join (or creates one with Matchmake) but it doesn't get into the game yet, just saves its data.

2.The client adds itself to the waiting list in the server adding its ID to the CustomData on the server with a Cloud Script.

3. The client keeps updating the CustomData (using GetCurrentGames()) to see if there is enough players in the waiting list.

4. When the client sees enough players including itself he connects to the game. Once authenticated with the server, removes him from the waiting list.

What I'm looking for it's a way to read that values, from the server/cloud script and the client. I will love the server to watch for its CustomData and clean the waiting list and close if noone is waiting.

Thanks for your help, hope this clarifies a bit.

0 Likes 0 ·
brendan avatar image brendan ♦♦ goncho commented ·

No, I really can't recommend that. What you're attempting to do is create a queued matchmaker using the CustomData for the servers themselves. As the calls in question are all web API based, there's a significant amount of latency involved. A matchmaker requires a dedicated server that maintains state information on all active games in-memory, so that it can quickly turn around match information to players authoritatively. Also, having every client hammering on the GetCurrentGames call would result in the title being throttled - the intended use case is that the client calls GetCurrentGames, picks a server, and joins it (potentially with one or two follow-up calls to the API, if joining the first server didn't work).

0 Likes 0 ·
goncho avatar image goncho brendan ♦♦ commented ·

Okey Breandan, I understand the problem. I was trying to do it using just PlayFab. So what do you recommend for doing a queued matchmaker as you say? Would I need to do my own Matchmaker server to be able to store and manipulate properly the "waiting players" list?

0 Likes 0 ·
Show more comments
goncho avatar image goncho commented ·

Just one last question, is there any way to know the CustomData or Tags from the Server or Cloud Script having the LobbyID?

0 Likes 0 ·
brendan avatar image brendan ♦♦ goncho commented ·

Since the server is the one setting the tags, what is the context in which it would also need to query its own tags? Or are you referring to your matchmaker? If it's the latter, what would it be using the custom data and tags to do?

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.