question

lordsplendidhumility avatar image
lordsplendidhumility asked

Local debugging of game servers

I've been following the documentation for local debugging of game servers, as documented here:

https://api.playfab.com/docs/tutorials/landing-tournaments/multiplayer-servers-2.0/debugging-playfab-multiplayer-platform-integration-locally

The first step is to edit `MultiplayerSettings.json` and set `RunContainer` to false and `OutputFolder` to somewhere to save output. And then to run MockVmAgent.exe in PowerShell.

When I do this, I get the following error:

```

Unhandled Exception: System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.Azure.Gaming.VmAgent.Common.Interfaces.ProcessRunner.CreateAndStart(Int32 instanceNumber, GameResourceDetails gameResourceDetails, ISessionHostManager sessionHostManager) in D:\t2\src\VmAgent\VmAgent.Common\Interfaces\ProcessRunner.cs:line 55
at Microsoft.Azure.Gaming.MockVmAgent.MultiplayerServerManager.CreateAndStartContainerWaitForExit(SessionHostsStartInfo startParameters) in D:\t2\src\VmAgent\MockVmAgent\MultiplayerServerManager.cs:line 49
at Microsoft.Azure.Gaming.MockVmAgent.Program.Main(String[] args) in D:\t2\src\VmAgent\MockVmAgent\Program.cs:line 69

```

After much trial and error, I worked out that it's trying to open the asset, specified in the "ServerStartParameters/AssetDetails/LocalFilePath" field, which in the default MultiplayerSettings.json is left as an empty string. Eventually I found that the only way to make things work was to put a zipfile there, and then to point 'StartGameCommand' at an executable inside that zip file (via the MountPath variable), which it duly launches by itself.

The documentation suggests that in this mode, MockVmAgent should just be a listener; that we'd need to run the server program ourself (perhaps through a debugger, which would be fab).. but MockVmAgent is launching the program itself, which.. doesn't seem like what the documentation suggests should be happening?

How can I actually put MockVmAgent into a passive listener mode so that I can actually run my server from a debugger and see it interact with the agent? Or am I completely misunderstanding how that is supposed to work?

Thanks for any advice/support!

Custom Game Servers
10 |1200

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

lordsplendidhumility avatar image
lordsplendidhumility answered

The documentation I linked to in the question is quite clear on the topic (bolding is mine, to point to the relevant bits):

  • In the extracted folder, you will find a MultiplayerSettings.json file, open it in a text editor (such as Visual Studio Code) and update the following properties:
    • OutputFolder: Path to a drive or folder where the outputs and config files will be generated. Ensure there is sufficient space available since the game server will be extracted under this path.
    • RunContainer: Set it to false.
  • In a Powershell Window (as Administrator):
    • cd in to the folder where the toolset was extracted.
    • Run MockVmAgent.exe. At this point, the MockVmAgent acts as http listener, waiting for heartbeats from the GSDK integrated with your game server.
  • Run your game server executable as it would started on the PlayFab platform (if the game server needs cmdline arguments, you may need to run it from a cmd window).

If running the server executable manually to test GSDK integration is no longer supported, or if the documentation on the PlayFab site that I was following is out of date or simply wrong, then I'd very much appreciate if you'd just say that.

Telling me that I've "misunderstood" really doesn't help matters. Thanks!

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

lordsplendidhumility avatar image lordsplendidhumility commented ·

Accidentally posted as an answer instead of as a comment on the answer by @Sarah Zhang, and the software won't let me convert it to a comment or delete it. So.. just leaving it here with a ping to Sarah to hopefully get her attention.

0 Likes 0 ·
JayZuo avatar image JayZuo ♦ commented ·

As Sarah said, the document you've linked is out of date, please refer to this new documentation: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab.

0 Likes 0 ·
lordsplendidhumility avatar image lordsplendidhumility JayZuo ♦ commented ·

Thanks for the link to the updated document! I'll take a closer look when I'm back at work tomorrow. FYI, Google is still referring people to the old documentation, and the old documentation gives no indication that it's out of date.

Similarly, the "Docs" link at the top of this very page also links only to the old out-of-date documentation. I assume that somebody's already working on these issues, but figured that I should mention them just in case they're oversights during the documentation migration that's apparently been happening.

Thanks!

0 Likes 0 ·
JayZuo avatar image JayZuo ♦ lordsplendidhumility commented ·

Thanks for your kind reminder. Our new documentation portal is now in live public preview. Current documentation will remain active for a short period of time, during this transition phase we will be making sure that all the old links from api.playfab.com will redirect to the appropriate place. More details can be found at this blog:https://blog.playfab.com/blog/new-documentation-portals.

0 Likes 0 ·
Zhi Kang Shao avatar image Zhi Kang Shao commented ·

Thank you for posting this question as I stumbled here while having issues following the same outdated documentation. Google brought me there indeed,

0 Likes 0 ·
Dinh Trung Hieu avatar image Dinh Trung Hieu commented ·

@lordsplendidhumility Sorry, but can you help me? It's likely that i'm facing this problem. So to sumarize, the answer is that the documents is wrong/ out of date? What could i do if i want to run MockVmAgent acts as http listener, and client call api to start server instance instead of MockVMAgent start server instance itself when run? Or i can't do that?

Thank you very much!

0 Likes 0 ·
Sarah Zhang avatar image
Sarah Zhang answered

I think you may have misunderstood. The MockVmAgent that you used is a mock PlayFab VmAgent that provides mock responses to the GSDK.

Your local zip file is a mock of the asset you need to upload. The MultiplayerSettings.json is a mock of your build config. Just like this doc said.

Actually when you call the PlayFab API RequestMultiplayerServer, the agent will help you launch your game server application automatically,so you can control what time to launch your server application yourself. StartGameCommand is a shell command, when a build is created through Game Manager or APIs, it will be specified. Check this paragraph.

You can try our new documentation, check docs about Multiplayer Servers for more details.

10 |1200

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

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.