question

Viachaslau avatar image
Viachaslau asked

PlayFabSettings::staticSettings->baseServiceHost for local testing

If I want to test my client with LocalMultiplayerAgent should I set value for PlayFabSettings::staticSettings->baseServiceHost? For production acces this value is ".playfabapi.com". In this case how should I tell my client that playfab (emulator) is located on same machine?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

@Viachaslau

>> But now I want to implement a game server from scratch without any socket libraries. I see that I can use GSDK on server part and PlayFabAPI on client part. How to organize processing of client connections?

Could you please clarify why you want to implement a server without the socket libraries? Do you want to implement a web server that can handle your custom API requests? If so, you would need to develop the interface on your own. The PlayFab Client API is designed to interact with the PlayFab main web server to use the PlayFab features such as Authentication, etc., and isn't designed to connect the clients to the severs you host on PlayFab Multiplayer Servers.

>> I want my server to handle all the new players connections and then run some logic of my game - handling clients requests. As I understand PlayFab allows it. But how to do it?

To let your custom server can handle the API requests, you need to implement the web server logic on your own. We don't provide a C++ web server sample, instead of it, we provide a C# one here - gsdk/csharp at master PlayFab/gsdk GitHub. You can search a C++ web server sample on your own, then integrate the PlayFab GSDK with it like our sample.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

If you are testing the connection between your custom server and the client, it’s not necessary foy you to install the PlayFab Unreal Marketplace plugin or PlayFab C++ SDK for them. Hence, you also needn’t fill in the TitleId. Only when you plan to call the PlayFab API in your server or your client, will you need to import the PlayFab SDK to your projects.

Please follow the documentation - Integrating game servers with the PlayFab Game Server SDK (GSDK) - PlayFab | Microsoft Docsn to integrate the GSDK with your server and follow the documentation - Locally debugging game servers and integration with PlayFab - PlayFab | Microsoft Docs to debug it locally.

You can also check our official GitHub repositories - MpsSample and gsdk for the GSDK samples. Please note, if the prerequisites of the sample require you import the PlayFab SDK and fill in the TitleID, please follow the prerequisites to let the sample code work.

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.

Viachaslau avatar image Viachaslau commented ·

Ok. So when I run LocalMultiplayerAgent, it runs my server which is wrapped with GSDK. Then I can use my own client (without PlayFAB API) to connect to my server?

In this case it's hard to understand why we need LocalMultiplayerAgent? It just tests my server - if I did all needed GSDK calls or not. Correct? Thank you

0 Likes 0 ·
Viachaslau avatar image Viachaslau commented ·

The general question is how client set address for playfab service? How client says that he wants to connect to local Multiplayr agent?

0 Likes 0 ·
Viachaslau avatar image Viachaslau commented ·

Thank you, bu I don't understand the answer. I have integrated PlayFABSDK into my client application. I have integrated GSDK to my server application. Now I want to use local multiplayer agent to test my server before uploading it to PlayFab.

0 Likes 0 ·
Sarah Zhang avatar image
Sarah Zhang answered

@Viachaslau Thanks for your response.

>> So when I run LocalMultiplayerAgent, it runs my server which is wrapped with GSDK. Then I can use my own client (without PlayFAB API) to connect to my server?

Yes, the process is you run the local multiplayer agent, the agent help you run the server according to the MultiplayerSettings.json file. Then the client can use the Http methods or socket, etc. to connect to the server.

>> In this case it's hard to understand why we need LocalMultiplayerAgent? It just tests my server - if I did all needed GSDK calls or not. Correct?

Except helping to verify the GSDK integration, it also helps to verify the containerization. The MpsAgent is designed to mock the online environment to help you complete the GSDK integration verification - https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab#verifying-gsdk-integration and containerization verification - https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab#verifying-containerization. It mimics PlayFab Multiplayer Servers (MPS) operations to aid in local debugging. You can also refer to our official GitHub repo page - https://github.com/PlayFab/MpsAgent to learn more about MpsAgent.

>> The general question is how client set address for playfab service? How client says that he wants to connect to local Multiplayr agent?

If you mean when you locally debug the server, what the server's IP address is and how the clients connect to it, you can try localhost the LAN IP of your local machine. You can fill in the IP address when you build the connection using your own method. For example, for a Unity Mirror client, the code could be something like this.

NetworkClient.Connect("localhost");

It's not necessary to configure the "*.playfabapi.com" for the MPS locally debugging.

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.

Viachaslau avatar image Viachaslau commented ·

Thank you very much for the answer. Now it's clear for me. I can test my server with LocalMultiplayerAgent.

But now I want to implement a game server from scratch without any socket libraries. I see that I can use GSDK on server part and PlayFabAPI on client part. How to organize processing of client connections? I want my server to handle all the new players connections and then run some logic of my game - handling clients requests. As I understand PlayFab allows it. But how to do it? Is the a simple example for C++ server and client? Something like sending a request from client and receiving in server application? Thank you.

0 Likes 0 ·
Viachaslau avatar image
Viachaslau answered

Thank you very much for the answer. Now it's clear for me. I can test my server with LocalMultiplayerAgent.

But now I want to implement a game server from scratch without any socket libraries. I see that I can use GSDK on server part and PlayFabAPI on client part. How to organize processing of client connections? I want my server to handle all the new players connections and then run some logic of my game - handling clients requests. As I understand PlayFab allows it. But how to do it? Is the a simple example for C++ server and client? Something like sending a request from client and receiving in server application? Thank you.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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.