How to run a game server using LocalMultiplayerAgent in Process mode
This tutorial describes how to:- Create a Build using the Wrapper sample
- Configure MultiplayerSettings.json
- Run LocalMultiplayerAgent
- Test your game connection
Create a Game Build
To test your game servers using LocalMultiplayerAgent(LMA), your need to create a game build and save it as archive format. To make it easier for you, we provide the Wrapper sample with an instruction and PowerShell script. Next, follow the step “Wrapping an existing game server using the wrapper app” to get your game server ready for this tutorial.Configure MultiplayerSettings.json
Navigate to the folder where you extracted the LMA toolset and open the MultiplayerSettings.json file. This file is a build configuration mock file that simulates the build on MPS. You can populate json using LMA MultiplayerSettings.json Generator. The Generator is a simple web page that creates json based on your options. You can find the Generator under extracted folder of LMA. Here’s the example of MultiplayerSettings.json for Wrapper sample to run LMA in Process mode.-
LocalFilePath- Full Local Path (on your workstation) to the game server asset zip file created earlier, for example: D:\MyAmazingGame\asset.zip (note that backslashes need to be escaped for JSON formatting). -
StartGameCommand- The StartGameCommand path for a process is a relative path. The working directory will be where your game asset is extracted. -
PortMappingsList- These are the ports that are available to your game while running.-
NodePortis the port that is opened on your workstation -
GamePort.Numberisn’t required for Process mode. Port number will be bound to Node Port via GSDK when your game server is running. In the real scenario, MPS will bind the port dynamically for each Process-based game session. -
Set the
GamePort.Nameto the same value as defined in your game server. You can check the GSDK config at runtime for the value with the key GamePort.Name. If you’re using the Wrapper Sample, port name is already defined to “game_port”, so you should set the same value here. -
GamePort.Protocol- Specify protocol type: TCP or UDP
-
-
OutputFolder- Path to a drive or folder where the outputs and config files are generated. Ensure that there’s sufficient space available since the game server will be extracted under this path. If not specified, the agent folder is used. -
AgentListeningPort- This is the port for the LMA to communicate with the game server. Any open port will work, 56001 is a default value. If you have another process binding to 56001, you must change this value or kill the other process on port 56001. -
ResourceLimits- not required for Process mode. -
MountPath- not required for Process mode. -
SessionCookie(optional) - Any session cookie that is passed to your game server as part of the RequestMultiplayerServer API call. In the real scenario on MPS, after the connection is established, server will notify the client to load corresponding resources from SessionCookie.
Run LocalMultiplayerAgent
Now you’re ready to run LocalMultiplayerAgent.-
In a PowerShell window :
Navigate to directory under LMA that contains LocalMultiplayerAgent.exe. -
Run
LocalMultiplayerAgent.exe. At this point, LMA sets up the http listener, unzips the game asset, and starts the game server in a separate process.If you are running your game server as a Process, the Windows Firewall may pop-up and ask if you want to allow traffic to the NodePort you specified. If you want to avoid that, you can either run the LocalMultiplayerAgent in admin mode or enable the port in the firewall.
CurrentGameState - Initializing
(This may not show up if your game server directly calls GSDK::ReadyForPlayers and doesn’t call GSDK::Start)CurrentGameState - StandingByCurrentGameState - ActiveCurrentGameState - Terminating
