question

kevin-7 avatar image
kevin-7 asked

How to use RequestMultiplayerServer without buildid or alias

We are trying to use RequestMultiplayerServer, but it seems that it must have at least BuildId or BuildAliasParams.

We do not want to have to set the BuildId or BuildAliasParams, because if we update our servers, the BuildId will change and therefore force us to edit recompile our code everytime.

Is there a better way to use RequestMultiplayerServer so that it can find the best server, just like creating a matchmaking ticket does?

Here is our current code for reference:

 PlayFab::MultiplayerModels::FRequestMultiplayerServerRequest ServerRequest;
        
     ServerRequest.BuildId = "16a6090a-8e8f-4ce3-99cb-cfcd03dbde28";
     ServerRequest.SessionId = FGuid::NewGuid().ToString();
     ServerRequest.PreferredRegions = { "EastUS" };
    
     MultiplayerAPI->RequestMultiplayerServer(ServerRequest,
         PlayFab::UPlayFabMultiplayerAPI::FRequestMultiplayerServerDelegate::CreateUObject(this, &APlayfabManager::OnRequestServerSuccess),
         PlayFab::FPlayFabErrorDelegate::CreateUObject(this, &APlayfabManager::OnLookForSessionError));
apisCustom 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

·
Xiao Zha avatar image
Xiao Zha answered

If you want to avoid the need to recompile the code after the BuildId changes by not setting the BuildId in the RequestMultiplayerServer API , playfab doesn’t provide such feature. But you can check the enable server allocation option in the matchmaking Queue. In this case, you don't need to manually request a server instance using the RequestMultiplayerServer API, the matchmaking will try to assign a server to all matches created in this queue. Additionally, you can call the List Build Summaries V2 API to get the BuildId before requesting a server instance. That way, you don't need to recompile your code either.

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

kevin-7 avatar image kevin-7 commented ·

If I enable enable server allocation, how will I find the server to send my players to? Will I need to use something else then RequestMultiplayerServer API?

Also, I didn't look into BuildAliasParams, but if we were to use that, does that mean that we could simply create an alais that would always stay the same and we will just change what server it points to? I feel that this could fix out issue and would make possible to change our servers and not change our client code has long has the alias stay the same (I know I said that I didn't wanted to use it, but I didn't though about this at that moment)

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha kevin-7 commented ·

If you enable the server allocation, you can get the server info in the result of GetMatch API or you can call Get Multiplayer Server Details API with the sessionId(in this situation, it’s the MatchId) to get the server detailed info. The server detailed info includes the IP and Port which you can use to connect your players.

Yes, BuildAliasParams can meet your requirements to change your servers without change your client code. You can refer to Managing a build alias and allocating to it - PlayFab | Microsoft Learn to have more information.

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.