> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Windows Runner sample

> Set up the Windows Runner C# sample for PlayFab Multiplayer Servers to build and deploy a minimal GSDK-integrated Windows game server for testing MPS features.

# Windows Runner C# sample

This tutorial lists the steps to get the sample set up ready for use with the PlayFab Multiplayer Servers.

<Note>
  In order to use and view the PlayFab Multiplayer Servers, you need to enable the feature from Game Manager. For instructions, see [Enable the PlayFab Server feature](/services/playfab/multiplayer/servers/enable-playfab-multiplayer-servers).
</Note>

1. [Configure API feature option](#configure-api-feature-option)
2. Create a PlayFab Multiplayer Game Server Build: [Server set up](#server-set-up)
3. [Create servers by deploying a build](#create-servers-by-deploying-a-build)
4. Request multiplayer servers: [Client set up](#client-set-up). This request is needed so you can start a client that connects to the servers

## Configure API feature option

<Note>
  This step is needed only for running this sample. You do not need to allow clients to start games unless your title requires this set up.
</Note>

* Log into your developer account on [PlayFab.com](https://developer.playfab.com) to use the Game Manager portal
* Select your game title
* Select the settings icon > **API features** as shown in the image below.

<img src="https://mintcdn.com/microsoft-4404708b/U1LR64ZWxo45eXwl/images/playfab/multiplayer/servers/create-your-first-server/windowsrunner-api-settings.png?fit=max&auto=format&n=U1LR64ZWxo45eXwl&q=85&s=6dc935f952e754c3f14ff8c744c90ac7" alt="API feature tab in Game Manager" width="800" height="405" data-path="images/playfab/multiplayer/servers/create-your-first-server/windowsrunner-api-settings.png" />

* Under **Options**, select **Allow client to start games** as shown in the image below.

<img src="https://mintcdn.com/microsoft-4404708b/U1LR64ZWxo45eXwl/images/playfab/multiplayer/servers/create-your-first-server/windowsrunner-api-settings-option.PNG?fit=max&auto=format&n=U1LR64ZWxo45eXwl&q=85&s=c6d6ad00718feb7293797b0e102875d7" alt="Select allow client to start games in Game Manager" width="374" height="177" data-path="images/playfab/multiplayer/servers/create-your-first-server/windowsrunner-api-settings-option.PNG" />

## Server set up

Describes how to get the PlayFab Multiplayer Game Server Build.

* [PlayFab Game Server SDK](https://github.com/PlayFab/gsdk) of the PlayFab Multiplayer Server Build for the Windows Runner sample.
* If you prefer to build this on your own:

  * Get the [Windows Runner C# sample](https://github.com/PlayFab/MpsSamples/tree/master/WindowsRunnerCSharp) using standard Git methods or downloading this as a zip file.
  * Open the project using Visual Studio 2017 or later. This should automatically trigger dependencies like the latest [PlayFab Game Server SDK (GSDK) NuGet package](https://www.nuget.org/packages/com.playfab.csharpgsdk) to be downloaded.
  * Compile and build the WindowsRunnerCSharp.csproj in release x64 configuration. You would get a game server build that is integrated with the GSDK, making it a valid PlayFab Multiplayer Game Server Build.
  * Go to the bin folder and zip up all the x64 release binaries. There should be no internal folder structure. The zip file should be a flat collection of files, as shown in the image below.

  <img src="https://mintcdn.com/microsoft-4404708b/U1LR64ZWxo45eXwl/images/playfab/multiplayer/servers/tutorials/gsdk-sample-output.png?fit=max&auto=format&n=U1LR64ZWxo45eXwl&q=85&s=ca4973938707eae40c4e869aa470c148" alt="GSDK Sample Output" width="1136" height="450" data-path="images/playfab/multiplayer/servers/tutorials/gsdk-sample-output.png" />

<Tip>
  To cross-check, you can compare your build output with the compiled version provided in the link.
</Tip>

When you have the zip file, you're ready to start [deploying a build](#create-servers-by-deploying-a-build).

## Create servers by deploying a build

You can deploy a build using one of the following methods.

* [Use Game Manager to deploy and configure servers](/services/playfab/multiplayer/servers/quickstart-for-multiplayer-servers-game-manager)
* [Use PowerShell to deploy and configure servers](/services/playfab/multiplayer/servers/quickstart-for-multiplayer-servers-api-powershell)

For some settings, it might be easier to configure using the web interface—Game Manager.

Next, [set up and run the client](#client-set-up) to connect to the deployed servers.

## Client set up

Describes how to get the Windows Runner client application to connect to the game servers you've created using PlayFab Multiplayer Servers. This can only be set up after you have servers in standby.

* After [deploying a build](#create-servers-by-deploying-a-build), wait for standby servers to be available

* Get the **titleId** and **buildId** of the build

  * Using Game Manager:
    * Go to **My Studios and Titles** page and look for your game title. Copy the ID value listed there and paste it somewhere convenient that you can access later. This is the **titleId**
    * Select the game title to view the dashboard
    * Go to **Multiplayer** > **Servers** > **Builds**
    * Copy the ID for the build you want to use and paste it somewhere convenient. This is the **buildId**

  * Using PowerShell, this information is in the output after the build is deployed successfully.
    * Copy the **titleId** and **buildId** and paste it somewhere convenient

* Get the [Windows Runner C# sample](https://github.com/PlayFab/MpsSamples/tree/master/WindowsRunnerCSharp) using standard Git methods or downloading this as a zip file. Skip if you have done this earlier.

* Open the project using Visual Studio 2017 or later. This should automatically trigger dependencies like the latest [Game Server SDK NuGet package](https://www.nuget.org/packages/com.playfab.csharpgsdk) to be downloaded.

* Compile and build the **WindowsRunnerCSharpClient.csproj** in release x64 configuration

* Open Command Prompt and navigate to the output folder of this project

* Run the WindowsRunnerCSharpClient using this command line, replacing \<TitleId> and \<BuildID> with the values above: **dotnet WindowsRunnerCSharpClient.dll --titleId \<TitleId> --buildId \<BuildId>**

Example:

```sample code theme={null}
cd C:\Users\UserName\Documents\GitHub\MpsSamples\WindowsRunnerCSharp\WindowsRunnerCSharpClient\bin\Release\netcoreapp3.1

dotnet WindowsRunnerCSharpClient.dll --titleId CBE66 --buildId 36083326-3bd5-4b8f-a97d-7e82f066aa40 --verbose
```

When the client successfully connects to the server, the Command Prompt would display a log message informing you that a server is allocated with an IP address.

## See also

* [Create your first server](/services/playfab/multiplayer/servers/create-your-first-server)
* [Resources and samples](/services/playfab/multiplayer/servers/server-samples-resources)
* [PlayFab Multiplayer Server SDKs](/services/playfab/multiplayer/servers/server-sdks/overview)
* [API Reference](xref:titleid.playfabapi.com.multiplayer.multiplayerserver)


## Related topics

- [Wrapper sample](/services/playfab/multiplayer/servers/wrapper-sample.md)
- [Multiplayer Servers samples and resources](/services/playfab/multiplayer/servers/server-samples-resources.md)
- [Walkthrough: Deploy builds using PowerShell/API](/services/playfab/multiplayer/servers/quickstart-for-multiplayer-servers-api-powershell.md)
- [Use QoS beacons to measure player latency to Azure](/services/playfab/multiplayer/servers/using-qos-beacons-to-measure-player-latency-to-azure.md)
- [Party samples](/services/playfab/multiplayer/networking/party-samples.md)
