question

tldQuantic avatar image
tldQuantic asked

Debugging a deployed multiplayer server

Hello,

I want to remotely debug a game server with visual studio.

Before trying to remotely debugging a game server deployed in Azure, is it possible to locally debugging a game server running in a container?

(I know that I can already debug a game server running in process mode.)

My assumption is that it is possible and the steps are the same than a game server deployed in Azure.

So I tried to follow this documentation:

https://docs.microsoft.com/fr-fr/gaming/playfab/features/multiplayer/servers/allocating-game-servers-and-configuring-vs-debugging-tools

And there are some points that I don’t understand.

1/ Include the VS2017 Remote Debugging tools in my game server asset package:

Should I include the downloaded file rtools_setup_x64.exe directly or should I first install the tools and copy all directories and files into my asset package?

2/ As part of creating your server build in Game Manager or with the Entity API, configure port 4022 TCP as a debug port.

In MultiplayerSettings.json, I added the debug port but I don’t know what should be the NodePort?

"PortMappingsList": [
    [
        {
            "NodePort": 56100,
            "GamePort": {
                "Name": "game_port",
                "Number": 3600,
                "Protocol": "UDP"
            }
        },
        {
            "NodePort": ??????,
            "GamePort": {
                "Name": "debug_port",
                "Number": 4022,
                "Protocol": "TCP"
            }
        }
    ]
]

3/ You will need to run msvsmon within the container, to enable remote debugging.

In MultiplayerSettings.json, in StartGameCommand flag, I listed 3 commands (separated by ‘;’):

1/ msvsmon.exe /prepcomputer /quiet

2/ msvsmon.exe /nostatus /noauth /nosecuritywarn /anyuser /nofirewallwarn /nodiscovery /port 4022

3/ MyGameServer.exe

"ContainerStartParameters": {

	"StartGameCommand": "C:\\Assets\\RemoteDebugger\\Common7\\IDE\\Remote Debugger\\x64\\msvsmon.exe /prepcomputer /quiet;C:\\Assets\\RemoteDebugger\\Common7\\IDE\\Remote Debugger\\x64\\msvsmon.exe /nostatus /noauth /nosecuritywarn /anyuser /nofirewallwarn /nodiscovery /port 4022;C:\\Assets\\MyGameServer.exe",

Is that correct?

4/ Attempt to debug via VS, using the external debug port returned from the allocate call.

How can I achieved this step?

In Visual, in Debug -> Attach to Process

What should I choose in Connection type?

- Default

- Remote (no authentication)

- Docker (Windows Container)

What should I set in Connection target?

Thanks for your help.

multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Phil Woods avatar image
Phil Woods answered

I have been trying to debug a local server in the Windows container today, so I will share my findings. In my case the MockVmAgent.exe was stuck on "Waiting for heartbeats from the game server....." and I wanted to try and debug the server to see what had happened.

1.) I included the remote debugger folder in the asset package, which is my case was copied from: 'C:\Program Files\Microsoft Visual Studio 16.0\Common7\IDE'

2.) For the NodePort I used the same port number, for example 4024 (as I was debugging with Visual Studio 2019 remote tools)

I opened a command prompt in the Windows container and ran "msvsmon.exe /nostatus /noauth /nosecuritywarn /anyuser /nofirewallwarn /nodiscovery /port 4024" within the x64 remote tools folder.

I could attach to process by using the connection type "Remote (no authentication)" and connnection target "localhost:4024"

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tldQuantic avatar image tldQuantic commented ·

Hi Phil and thanks for your help!

I succeeded to remotely debug a local server running in a windows container thanks to your feedbacks.
So, the first issue I had was using the remote debugger linked in the Playfab documentation as it is the version for Visual Studio 2017 and I use VS2019.

The second issue was an empty space in the path of msvsmon.exe in the StartGameCommand.

C:\\Assets\\RemoteDebugger\\Common7\\IDE\\Remote Debugger\\x64\\msvsmon.exe /prepcomputer /quiet;

I renamed the folder Remote Debugger to RemoteDebugger and updated the path and it's work perfectly.

So, if it could help you, there is no need to manually launch msvsmon from the windows container.

Here is my StartGameCommand flag in MultiplayerSettings.json:

"StartGameCommand": "C:\\Assets\\RemoteDebugger\\Common7\\IDE\\RemoteDebugger\\x64\\msvsmon.exe /prepcomputer /quiet;C:\\Assets\\RemoteDebugger\\Common7\\IDE\\RemoteDebugger\\x64\\msvsmon.exe /nostatus /noauth /nosecuritywarn /anyuser /nofirewallwarn /nodiscovery /port 4024;C:\\Assets\\MyGameServer.exe",
1 Like 1 ·
Phil Woods avatar image Phil Woods tldQuantic commented ·

Adding the call to msvsmon.exe in the MockVmAgent's MultiplayerSettings.json is a great idea. We are going to update our build scripts to include that too. Thanks, Phil.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.