My CloudScript needs to find the best server to tell the client, but if the server is not active I can't get the SessionId, and I can't get the IP prot
My CloudScript needs to find the best server to tell the client, but if the server is not active I can't get the SessionId, and I can't get the IP prot
You could use the RequestMultiplayerServer API to activate a multiplayer server. On CloudScript, there is a predefined variable call “multiplayer”, you could use “multiplayer.xxx” to call the Multiplayer API on CloudScript. For example,
handlers.RequestMultiplayerServer = function(args, context) { return multiplayer.RequestMultiplayerServer (args); }
Thank you, but I'm looking at the RequestMultiplayerServer documentation and I see that it still needs a SessionId, but my server is not active. How do I get the SessionId?I tried to generate a GUID myself, but it didn't work,It was wrong:"PlayFab API request failure",Please help me thank you
request={"PreferredRegions":["EastUs"],"SessionId":args["SessionId"],"BuildId":g_gameServerBuildID};server = multiplayer.RequestMultiplayerServer(request);
@Rick Chen Thank you, but I'm looking at the RequestMultiplayerServer documentation and I see that it still needs a SessionId, but my server is not active. How do I get the SessionId?I tried to generate a GUID myself, but it didn't work,It was wrong:"PlayFab API request failure",Please help me thank you
request={"PreferredRegions":["EastUs"],"SessionId":args["SessionId"],"BuildId":g_gameServerBuildID}; server = multiplayer.RequestMultiplayerServer(request);
The session ID is a value you have to generate yourself and is related to the unique session of the game. Feel free to check our quickstart video for further details (19) PlayFab Multiplayer Hosted Servers part 1: Multiplayer Servers Quick Start - YouTube
Here is my summary in the hope of helping the newcomers:
RequestMultiplayerServer :
The actual intention is to activate a new server.
It will not return the currently active server and the document address is 404:
https://docs.microsoft.com/zh-cn/gaming/playfab/features/multiplayer/servers/mps-allocator-sample
The prerequisite is that the number of active servers is smaller than the number of standby servers.
Usage:
let Regions = ["EastUs"];
multiplayer.RequestMultiplayerServer({"PreferredRegions":Regions,"BuildId":g_gameServerBuildID,"SessionId": NewGuid });
5 People are following this question.