Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 3.37 KB

README.md

File metadata and controls

33 lines (24 loc) · 3.37 KB

OpenArena GSDK sample for Azure PlayFab Multiplayer Servers (MPS)

OpenArena

This sample demonstrates a way to wrap any existing game with the PlayFab Multiplayer Game Server SDK. For this to work, game server should output relevant information about its lifecycle into its output and error streams.

In this sample, we are using the Linux build of an open source game OpenArena and a simple .NET Core app that starts the game and processes its output. When the game starts, the .NET Core app calls the proper GSDK methods. Since PlayFab Multiplayer Servers needs Docker Containers for Linux Builds, we're using one of the available OpenArena Docker images on Docker Hub as a base image, available here.

Specifically, OpenArena game server outputs messages (like "Opening IP socket", "ClientBegin", "ClientDisconnect") that allows the .NET Core app/wrapper to call the specific GSDK methods. For example, on "Opening IP socket" the app will call GameserverSDK.Start().

Usage

  1. Make sure you have an account on playfab.com and have enabled Multiplayer Servers
  2. Git clone this repo. You should have installed Docker
  3. Create a new Linux Build and get the Azure Container Registry information, it will be appear in the Multiplayer page like docker login --username customervz4l34rmt7rnk --password XXXXXXX customervz4l34rmt7rnk.azurecr.io. You can also use the GetContainerRegistryCredentials API call to get the ACR credentials
  4. Replace the TAG and the ACR variables with your values
TAG="0.4"
ACR="customervz4l34rmt7rnk.azurecr.io"
docker login --username XXXXXX --password XXXXXXX ${ACR}
docker build -t ${ACR}/openarena:${TAG} .
docker push ${ACR}/openarena:${TAG}

You can run the above script on Windows Subsystem for Linux.

  1. Create a new MPS Build either via playfab.com or via the CreateBuildWithCustomerContainer API call. On this Build, select Linux VMs, the image:tag container image you uploaded and a single port for the game, 27960/UDP.
  2. Wait for the Build to be deployed
  3. To allocate a server and get IP/port, you can use the MpsAllocator sample or use the RequestMultiplayerServer API call. For more information you can check the documentation
  4. Download OpenArena client, open the game executable for your platform and connect to your server. Enjoy!

Is this the recommended way I should use GSDK?

Definitely not. Standard output/error stream processing is hacky at its best. For best results, you should use the proper GSDK for your language of choice.