Redigera

Dela via


MpsAllocator sample

MpsAllocatorSample can be found here along with the rest of the MPS samples.

This sample is a simple .NET Core application that allows you to easily call some frequently used MPS APIs, like the ones that list VMs/servers and allocate game servers (RequestMultiplayerServer). To easily and quickly request a multiplayer server from Game Manager, select the button located at the top of our servers page that can help you do that. To learn more check out our Servers overview. In order to use it, you need to have installed .NET Core 3.1 (download here). You can then use either dotnet build command to build an executable for your platform or just run dotnet run to run the application.

You can find more information about dotnet build command here

In order to authenticate with PlayFab APIs, the app needs your PlayFab TitleID and a developer secret key. To create a secret key for your title, visit the Settings/Secret-Keys page on the PlayFab developer portal here: https://developer.playfab.com/en-US/r/t/<Your_TitleID>/settings/secret-keys. You can provide these keys via environment variables PF_TITLEID and PF_SECRET, or as command line arguments.

The app uses the PlayFab SDK via the corresponding Nuget package

Once you run the application, you can choose which API to call. Each API will ask you to provide necessary parameters. Here's the list of the available options:

  • RequestMultiplayerServer: This option will allocate a game server and return its details (IP, FQDN, Port). Successful invocation of this API call will result in a game server's transition from "StandingBy" state to "Active" (more here)
  • ListBuildSummaries: This option will return summaries about your title's Builds
  • GetBuild: This option will return details about the specified Build
  • ListMultiplayerServers: This option will return summaries about game servers in a specified Build
  • ListVirtualMachineSummaries: This option will return summaries about virtual machines in a specified Build
  • GetMultiplayerServerDetails: This option will return details about a specified game server

See also