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

# Connect to Cloud-Hosted Unreal Server

> Connect Unreal Engine clients to a PlayFab Multiplayer Servers (MPS) hosted dedicated server build using a dev utility that bypasses standard allocation.

# Connect to MPS hosted build

This article describes how you can connect clients to PlayFab Multiplayer Servers (MPS) hosted servers using a utility tool. This tool is used during development to bypass typical steps to provision and activate servers. Earlier steps in this example sequence covered adding the Unreal GSDK to a standard ThirdPersonMP tutorial project. In doing so, we set up the server connection side, but we ignored a proper client connection sequence. PlayFab requires servers to be provisioned and activated before clients can connect to them. We won't cover that process here, but more details are available in the [MPS Documentation](/services/playfab/multiplayer/servers/connecting-clients-to-game-servers). Instead, for this example, we'll bypass those complicated steps and instead use a manual utility to rapidly test connections between the client and server.

## Prerequisites

* Clone or download the [MpsSamples repo](https://github.com/PlayFab/MpsSamples)
* A fully deployed ThirdPersonMP server in "Deployed" status, with at least one server fully propped and in "Standby" mode
  * ThirdPersonMP is the sample project [built](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/building-the-third-person-mp-example-project) and [deployed](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/third-person-mp-example-project-cloud-deployment) in earlier pages of this guide.
  * A build's status becomes "Deployed" when it contains servers that are ready for connections. These servers are considered in "Standby"
* A [built game-client](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/building-the-third-person-mp-example-project), ready to connect
* Visual Studio with .NET Core 3.1 (available as an optional checkbox in the Visual Studio Installer)

## How to connect a client automatically to the server

Your built game-client will likely be **ThirdPersonMP.exe** and be located in or near your project. If you didn't use ThirdPersonMP as a starting template, then your built game-client will be **\{YourProjectName}.exe**, similarly located in or near your Unreal project. Find this file.

* Find `ThirdPersonMP.exe`
* Create a new adjacent file `RunCloud.bat`
* Open this file in a text editor of your choice, and set the following contents:

```Batch theme={null}
ThirdPersonMP {IP-ADDRESS}:{PORT} -log
```

NOTE: Replace `ThirdPersonMP` with your project name if necessary.

* For now, we don't yet know the IP-ADDRESS or PORT, so just save, and leave the editor open.
* Find the file `{MpsSamples Repo}/MpsAllocatorSample/MpsAllocatorSample.csproj`
* Open this file in Visual Studio
* Run this program
* Follow the on-screen instructions, and input the following values when prompted:
  * \{Your PlayFab TitleId}
  * \{Any valid and active secret key for your PlayFab Title}
  * Choose **1** to **RequestMultiplayerServer**
  * Enter the \{BuildId} for the **Deployed**-Status server build you wish to test
    * This can be found next to the name in the list of all builds, in the **Details** tab of the specific build, or in the URL for any of the build specific pages
  * If you have multiple regions defined, you are prompted to select one. Otherwise, it auto-selects if there's only one available region.
  * For Player IDs, you can type real, or fake hex-number value
    * For users who followed the ThirdPersonMP setup, you can pick any hex-number, such as 1337, abc123, or etc.
    * Input at least one number, and then hit enter an extra time to finish
* You should receive a response that looks like this:

```json theme={null}
{
  "ConnectedPlayers": [],
  "FQDN": "...",
  "IPV4Address": "52.180.68.101",
  "LastStateTransitionTime": "2021-12-06T22:12:46.212Z",
  "Ports": [
    {
      "Name": "gameport",
      "Num": 30000,
      "Protocol": "UDP"
    }
  ],
  "Region": "WestUs",
  "ServerId": "...",
  "SessionId": "...",
  "State": "Active",
  "VmId": "..."
}
```

* NOTE: Values unimportant to this example have been replaced with `...`
* Look for **IPV4Address** and **Ports.Num** in your response
  * In the example above, these values are: `52.180.68.101` and `30000` respectively
  * Your values can/will be different
* Return to your `RunCloud.bat` file, and fill in these values for IP-ADDRESS and PORT. Example:

```Batch theme={null}
ThirdPersonMP 52.180.68.101:30000 -log
```

* From windows explorer, double click this .bat file, to run the game-client, wait a moment, and then double click it again
* This should start two instances of your game-client, both connected to your cloud hosted game server
* From here, you can run around in both games, and you should see that both users' movements and actions are reflected in both game clients, for both players
  * SUCCESS! If you see that, you've completed the full Setup/Build/Deploy/Connect process

## Navigation

For some users, this guide sequence is now finished. You can return to the main [Unreal GSDK Plugin](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk) guide.

If your test was run on Windows servers, then you can try the more advanced [Linux Server](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/setting-up-a-linux-dedicated-server-on-playfab) deployment guide.


## Related topics

- [Deploy Linux Unreal Server to MPS Cloud](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/setting-up-a-linux-dedicated-server-on-playfab.md)
- [PlayFab Online Subsystem (OSS) Dedicated Server Setup](/services/playfab/multiplayer/networking/party-unreal-engine-oss-dedicated-servers.md)
- [GSDK Project Cloud Deployment](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/third-person-mp-example-project-cloud-deployment.md)
- [Connecting clients to game servers](/services/playfab/multiplayer/servers/connecting-clients-to-game-servers.md)
- [GSDK Project Setup](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/third-person-mp-example-gsdk-project-setup.md)
