question

Abdelrahman Awwad avatar image
Abdelrahman Awwad asked

Error while running LocalMultiplayerAgent

I get the following output and error when running the LocalMultiplayerAgent I have populated the multiplayersettings.json file with the needed info

Have a nice day!
Check this page for debugging tips: https://github.com/PlayFab/gsdkSamples/blob/master/Debugging.md
No output directory specified, defaulting to agent directory
Warning: SessionCookie is not specified.
TitleId: 632806BC
BuildId: 70677319-5ce6-44a3-bda8-0ebc13ef6573
VmId: xcloudwusu4uyz5daouzl:WestUs:da974f9c-059a-4202-ae1b-e0395d52cfb0:tvmps_c941ec5fe0e64be7bb1a6c8575bd9be231b36d6147314c2cb4110c345f78059a_d
Root output folder: C:\Users\bedoa\AppData\Local\Temp\.net\LocalMultiplayerAgent\20rn4fwl.hd0\PlayFabVmAgentOutput\2021-12-07T09-30-11
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\bedoa\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Local Multiplayer Agent is listening on port 56001
Player1, Player2
info: PlayFabLocalMultiplayerAgent[0]
Starting process for session host with instance number 0 and process info: FileName - C:\Assets\CircleWars.exe, Args - .
info: PlayFabLocalMultiplayerAgent[0]
Creating the configuration file at C:\Users\bedoa\AppData\Local\Temp\.net\LocalMultiplayerAgent\20rn4fwl.hd0\PlayFabVmAgentOutput\2021-12-07T09-30-11\Config\SH0\gsdkConfig.json
Unhandled exception. failSystem.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Azure.Gaming.LocalMultiplayerAgent.MultiplayerServerManager.CreateAndStartContainerWaitForExit(SessionHostsStartInfo startParameters)
at Microsoft.Azure.Gaming.LocalMultiplayerAgent.Program.Main(String[] args)
at Microsoft.Azure.Gaming.LocalMultiplayerAgent.Program.<Main>(String[] args)
: PlayFabLocalMultiplayerAgent[0]
Failed to start process based host with instance number 0. Exception: System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.Azure.Gaming.VmAgent.Core.Interfaces.ProcessWrapper.Start(ProcessStartInfo startInfo)
at Microsoft.Azure.Gaming.VmAgent.Core.Interfaces.ProcessRunner.CreateAndStart(Int32 instanceNumber, GameResourceDetails gameResourceDetails, ISessionHostManager sessionHostManager)

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.

Made Wang avatar image
Made Wang answered

At which step did you get this issue? Is it in process mode or container mode? Please make sure RunContainer is set correctly.

Did you run the setup.ps1 file before starting LocalMultiplayerAgent?

This thread has the same error message as you, you can refer to -When locally debugging game servers, how do you fix the error "fail: PlayFabLocalMultiplayerAgent[0] Failed to start process based host with instance number 0."? - Playfab Community.

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

Abdelrahman Awwad avatar image Abdelrahman Awwad commented ·

-I was running it in Process mode .. now I'm running it in container mode ( set the RunContainer to be true)
-I also hadn't run the setup.ps1 at all so I did..

now I'm getting this error:

fail: PlayFabLocalMultiplayerAgent[0]
Exception encountered when creating image: System.ApplicationException: CreateImageAsync is completed but the image doesn't exist
at Microsoft.Azure.Gaming.VmAgent.ContainerEngines.DockerContainerEngine.<>c__DisplayClass21_0.<<RetrieveResources>b__2>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)

0 Likes 0 ·
Abdelrahman Awwad avatar image Abdelrahman Awwad commented ·

- I get this error when I run it in Process mode ( set RunContainer to false )

fail: PlayFabLocalMultiplayerAgent[0]
Failed to start process based host with instance number 0. Exception: System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.Azure.Gaming.VmAgent.Core.Interfaces.ProcessWrapper.Start(ProcessStartInfo startInfo)
at Microsoft.Azure.Gaming.VmAgent.Core.Interfaces.ProcessRunner.CreateAndStart(Int32 instanceNumber, GameResourceDetails gameResourceDetails, ISessionHostManager sessionHostManager)
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Azure.Gaming.LocalMultiplayerAgent.MultiplayerServerManager.CreateAndStartContainerWaitForExit(SessionHostsStartInfo startParameters)
at Microsoft.Azure.Gaming.LocalMultiplayerAgent.Program.Main(String[] args)

0 Likes 0 ·
Abdelrahman Awwad avatar image Abdelrahman Awwad commented ·

I'm getting both of these errors after running LocalMultiplayerAgent.exe using an administrator Powershell

0 Likes 0 ·
Made Wang avatar image Made Wang Abdelrahman Awwad commented ·

From the error message, the program cannot find the path about sessionhostinfo.

I found this thread - Mock Vm Local testing issue! - Playfab Community, he caused this problem because of compressing the folder at the wrong level, maybe you can check if there is the same error.

If there are still problems, can you provide MultiplayerSettings.json?

0 Likes 0 ·
Made Wang avatar image Made Wang Made Wang commented ·

Refer to MpsSamples/Debugging.md at master PlayFab/MpsSamples GitHub, maybe your game server is missing DLLS.

1 Like 1 ·
Show more comments
Made Wang avatar image Made Wang Abdelrahman Awwad commented ·

Yes, the dll file needs to be uploaded.

Can't run for a long time in process mode?

You can also try to run the server as a standalone process without using LocalMultiplayerAgent.

Refer to Determining required DLLs for Windows game servers - PlayFab | Microsoft Docs

0 Likes 0 ·
Paul Gilmore avatar image
Paul Gilmore answered

Greetings from PlayFab:

We understand that generating your MultiplayerSettings.json file is difficult. We have recently made a tool to try and improve this. Please take a look:GitHub.com/PlayFab/LocalMultiplayerAgent/SettingsJsonGenerator
I can't say that it's guaranteed to help with this issue, but it may improve your ability to make and edit your MultiplayerSettings.json file, which should help in general. Let us know if you have any issues or suggestions.

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.