Playfab Integration problem

Options
Hello! I am trying to do a PlayFab Integration lesson. And I have a problem with that.

1. I uploaded the .zip file to the Playfab server and made the settings. The virtual machine says State: Running Health, Status: Healthy. But the virtual server State: Initializing is in a loop. After several attempts, I get the status PendingHeartbeat. But I still can’t connect.

2. I tried to do local debugging with MockVmAgent. In the process, I see many repetitions of CurrentGameState: Initializing. And then CurrentGameState: Terminated. CurrentGameState: StandingBy and CurrentGameState: Active I do not see.

I can’t understand what could be the problem.
Maybe I missed something?

Settings
{
    "RunContainer": false,
    "OutputFolder": "C:\\PlayFabTests",
    "NumHeartBeatsForActivateResponse": 1,
    "NumHeartBeatsForTerminateResponse": 60,
    "AgentListeningPort": 56001,
    "AssetDetails": [
        {
            "MountPath": "C:\\Assets",
            "LocalFilePath": "C:\\DATA\\UNITY3D\\MyProjects\\Playfab\\Playfab\\Playfab2.zip"
        }
    ],
    "GameCertificateDetails": [],
    "PortMappingsList": [
        [
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "bolt_server",
                    "Number": 60001,
                    "Protocol": "UDP"
                }
            },
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "master_server1",
                    "Number": 5055,
                    "Protocol": "UDP"
                }
            },
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "master_server2",
                    "Number": 27001,
                    "Protocol": "UDP"
                }
            },
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "game_server1",
                    "Number": 5056,
                    "Protocol": "UDP"
                }
            },
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "game_server2",
                    "Number": 27002,
                    "Protocol": "UDP"
                }
            }, 
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "name_server1",
                    "Number": 5058,
                    "Protocol": "UDP"
                }
            },
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "name_server2",
                    "Number": 27000,
                    "Protocol": "UDP"
                }
            }
        ]
    ],
     "ProcessStartParameters": {
        "StartGameCommand": "Playfab.exe -batchmode -nographics"
    },
    "ContainerStartParameters": {
        "StartGameCommand": "C:\\Assets\\Playfab.exe",
        "ResourceLimits": {
            "Cpus": 0,
            "MemoryGib": 0
        },
        "ImageDetails": {
            "Registry": "mcr.microsoft.com",
            "ImageName": "playfab/multiplayer",
            "ImageTag": "wsc-10.0.17763.973.1",
            "Username": "",
            "Password": ""
        }
    },
    "SessionConfig": {
        "SessionId": "ba67d671-512a-4e7d-a38c-2329ce181946",
        "SessionCookie": null,
        "InitialPlayers": [ "Player1", "Player2" ]
    },
    "TitleId": "",
    "BuildId": "00000000-0000-0000-0000-000000000000",
    "Region": "WestUs"
}

Comments

  • ramonmelo
    Options
    Hello @fill ,

    Thanks for using Photon Bolt.

    We will check the sample again, and let you know if there is something you need to change or not.

    Sorry the inconvenience.
    --
    Ramon Melo
    Photon Bolt Team
  • fill
    Options
    @ramonmelo Thanks!

    In my last attempt to run locally.

    I found an error on shutdown.
    I hope this is how it will help.
    CurrentGameState: Initializing
    info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
    Executing ObjectResult, writing value of type 'Microsoft.Azure.Gaming.AgentInterfaces.SessionHostHeartbeatInfo'.
    info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
    Executed action MockVmAgent.Controllers.SessionHostController.ProcessHeartbeat (MockVmAgent) in 10.8898ms
    info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
    Request finished in 11.3011ms 200 application/json; charset=utf-8
    Server is Shutting down
    (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

    NullReferenceException
    at (wrapper managed-to-native) UnityEngine.MonoBehaviour.IsObjectMonoBehaviour(UnityEngine.Object)
    at UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) [0x00014] in <73b499366e5241bda47e5da76897738b>:0
    at Bolt.Samples.PlayFab.PlayFabHeadlessServer.OnShutdown () [0x00011] in <888cf0df5aff4dbd8f3e572f24b50acf>:0
    at PlayFab.PlayFabMultiplayerAgentAPI.ProcessAgentResponse (PlayFab.MultiplayerAgent.Model.HeartbeatResponse heartBeat) [0x00110] in <c720ccf69fc74bea89c81291df02c542>:0
    at PlayFab.PlayFabMultiplayerAgentAPI+<SendHeartBeatRequest>d__51.MoveNext () [0x00275] in <c720ccf69fc74bea89c81291df02c542>:0
    at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <73b499366e5241bda47e5da76897738b>:0


    (Filename: <73b499366e5241bda47e5da76897738b> Line: 0)

    state: PlayFab.MultiplayerAgent.Model.HeartbeatRequest, payload: {"CurrentGameState":"Terminated","CurrentGameHealth":null,"CurrentPlayers":[]}
    (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

    info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
    Request starting HTTP/1.1 POST http://127.0.0.1:56001/v1/sessionHosts/611f22d4-0c0c-419a-9fc9-0e79983cf2c3/heartbeats application/json 78
    info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
    Route matched with {action = "ProcessHeartbeat", controller = "SessionHost"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] ProcessHeartbeat(System.String, Microsoft.Azure.Gaming.AgentInterfaces.SessionHostHeartbeatInfo) on controller MockVmAgent.Controllers.SessionHostController (MockVmAgent).
    CurrentGameState: Terminated
  • Hi @fill and @ramonmelo

    I was struggling with the same issue and managed to solve it. There is a bug in the sample.

    ***Description***
    Two PlayFabMultiplayerAgentView components are created;

    once in PlayFabMultiplayerAgentAPI.Start() ~lines 103-106
    if(_agentView == null)
    {
    _agentView = new GameObject("PlayFabAgentView");
    _agentView.AddComponent<PlayFabMultiplayerAgentView>();
    UnityEngine.Object.DontDestroyOnLoad(_agentView);
    }

    and again in PlayFabHeadlessServer.GamerServer.PlayFabStart() ~line 34

    this.gameObject.AddComponent<PlayFabMultiplayerAgentView>();

    Since it is a singleton, the second instance gets destroyed and thus destroys your PlayFabHeadlessServer gameobject.

    ***SOLUTION:***
    Comment out ~lines 103-106 so that only one PlayFabMultiplayerAgentView is added to your PlayFabHeadlessServer gameobject and set to DontDestoryOnLoad

    if(_agentView == null)
    {
    //_agentView = new GameObject("PlayFabAgentView");
    //_agentView.AddComponent<PlayFabMultiplayerAgentView>();
    //UnityEngine.Object.DontDestroyOnLoad(_agentView);
    }
    ***
    After this everything worked! Hope this helps!





  • ramonmelo
    Options
    Hello @mybigorangehead ,

    Thanks for your feedback! We will update the sample.
  • fill
    Options
    Hello @mybigorangehead. Thanks for you help!