You can use LocalMultiplayerAgent on Linux to debug your game servers using either container mode (Linux containers) or process mode (bare processes).
Container mode runs your game server inside a Docker container natively on Linux.
- Install Docker Engine on your Linux machine
- Make sure Docker is running (
sudo systemctl start docker) - Your game server image can be published on a container registry or can be locally built
-
Download the latest version of LocalMultiplayerAgent for Linux (linux-x64) from the Releases page on GitHub
-
Run the
setup_linux.shscript which will create a Docker network called "playfab":
chmod +x setup_linux.sh
./setup_linux.sh- Configure your MultiplayerSettings.json file. Below you can see a sample, included in
Samples/MultiplayerSettingsLinuxContainersOnLinuxSample.json:
{
"RunContainer": true,
"ForcePullContainerImageFromRegistry": true,
"OutputFolder": "",
"NumHeartBeatsForActivateResponse": 10,
"NumHeartBeatsForTerminateResponse": 60,
"TitleId": "",
"BuildId": "00000000-0000-0000-0000-000000000000",
"Region": "WestUs",
"AgentListeningPort": 56001,
"ContainerStartParameters": {
"ImageDetails": {
"Registry": "mydockerregistry.io",
"ImageName": "mygame",
"ImageTag": "0.1",
"Username": "",
"Password": ""
}
},
"PortMappingsList": [
[
{
"NodePort": 56100,
"GamePort": {
"Name": "gameport",
"Number": 7777,
"Protocol": "TCP"
}
}
]
],
"DeploymentMetadata": {
"Environment": "LOCAL",
"FeaturesEnabled": "List,Of,Features,Enabled"
},
"SessionConfig": {
"SessionId": "ba67d671-512a-4e7d-a38c-2329ce181946",
"SessionCookie": null,
"InitialPlayers": [ "Player1", "Player2" ]
}
}Notes:
- Set
RunContainerto true for container mode.- Modify
ImageDetailswith your game server Docker image details. The image may be built locally (using docker build command) or be hosted in a remote container registry.- If your image is hosted in a remote container registry, set
ForcePullContainerImageFromRegistrytotrueso the agent pulls it before starting. If your image is locally built, set it tofalse(or omit it) to skip the pull.StartGameCommandandAssetDetailsare optional. You don't normally use them when you use a Docker container since all game assets + start game server command can be packaged in the corresponding Dockerfile.DeploymentMetadatais also optional and can contain up to 30 dictionary mappings of custom metadata to be passed to the container as thebuildMetadatafield.
- Run LocalMultiplayerAgent:
./LocalMultiplayerAgentThe agent will automatically detect that it is running on Linux and configure itself for Linux game servers.
Process mode runs your game server as a native Linux process without Docker.
- Your game server must be a Linux executable
- Docker is not required for process mode
-
Download the latest version of LocalMultiplayerAgent for Linux (linux-x64) from the Releases page on GitHub
-
Configure your MultiplayerSettings.json file. Below you can see a sample, included in
Samples/MultiplayerSettingsLinuxProcessOnLinuxSample.json:
{
"RunContainer": false,
"OutputFolder": "",
"NumHeartBeatsForActivateResponse": 10,
"NumHeartBeatsForTerminateResponse": 60,
"TitleId": "",
"BuildId": "00000000-0000-0000-0000-000000000000",
"Region": "WestUs",
"AgentListeningPort": 56001,
"AssetDetails": [
{
"MountPath": "",
"LocalFilePath": "<path_to_game_server_package>"
}
],
"PortMappingsList": [
[
{
"NodePort": 56100,
"GamePort": {
"Name": "gameport",
"Number": 7777,
"Protocol": "TCP"
}
}
]
],
"ProcessStartParameters": {
"StartGameCommand": "<your_game_server_executable (relative to extracted assets, e.g. MyServer or MyServer --port 7777)>"
},
"SessionConfig": {
"SessionId": "ba67d671-512a-4e7d-a38c-2329ce181946",
"SessionCookie": null,
"InitialPlayers": [ "Player1", "Player2" ]
}
}Notes:
- Set
RunContainerto false for process mode.AssetDetailsis required for process mode. SetLocalFilePathto the path of your game server zip package.StartGameCommandinProcessStartParametersis required for process mode. It should be the executable name relative to the extracted assets root (e.g.MyServerorMyServer --port 7777). Arguments can be appended after a space.
- Run LocalMultiplayerAgent:
./LocalMultiplayerAgentgit clone https://github.com/PlayFab/MpsAgent.git
cd ./MpsAgent/LocalMultiplayerAgent
dotnet publish --runtime linux-x64 -c Release -o LocalMultiplayerAgentPublishFolder -p:PublishSingleFile=true --self-contained true- If you encounter permission issues running LocalMultiplayerAgent, make it executable:
chmod +x ./LocalMultiplayerAgent - For container mode, ensure your user is in the
dockergroup or usesudo:sudo usermod -aG docker $USER - If the Docker socket is not accessible, verify Docker is running:
sudo systemctl status docker