question

Sung Joon Kim avatar image
Sung Joon Kim asked

UDP connection in LocalMultiplayerAgent (Docker Environment)

Hello, I'm integrating Unity Mirror project with PlayFab Multiplayer Server.

Previously, Mirror used Telepathy Transport (TCP) and I was able to connect to Azure cloud server and Docker LocalMultiplayerAgent.

Currently, Mirror uses KCP Transport (UDP) and I also wanted to use UDP, so I switched to KCP transport. I was able to connect Azure Multiplayer Server. But, I failed on Docker LocalMultiplayerAgent environment.

I'm guessing I need to add additional firewall rules, such as Setup.ps1.

Any suggestion or commands to connect UDP Docker environment?

MultiplayerSettings.json

{
    "RunContainer": true,
    "OutputFolder": "E:\\PlayFabLogs",
    "NumHeartBeatsForActivateResponse": 10,
    "NumHeartBeatsForTerminateResponse": 60,
    "AgentListeningPort": 56001,
    "AssetDetails": [
        {
            "MountPath": "C:\\Assets",
            "LocalFilePath": "C:\\Users\\joon\\Documents\\FastRTS\\Build\\Server\\Build.zip"
        }
    ],
    "GameCertificateDetails": [],
    "PortMappingsList": [
        [
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "game_port",
                    "Number": 7777,
                    "Protocol": "UDP"
                }
            }
        ]
    ],
    "ProcessStartParameters": {
        "StartGameCommand": "FastRTS.exe"
    },
    "ContainerStartParameters": {
        "StartGameCommand": "C:\\Assets\\FastRTS.exe -nographics -batchmode -logFile C:\\GameLogs\\UnityEditor.log",
        "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"
}


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

Gosen Gao avatar image Gosen Gao commented ·

We will dig into it.

1 Like 1 ·
Sung Joon Kim avatar image Sung Joon Kim Gosen Gao commented ·

Alright, I'll wait for solution. Thanks

0 Likes 0 ·
Gosen Gao avatar image
Gosen Gao answered

When you build your server, if the option Dual Mode of Kcp Transport is set to true, then it will cause the issue. For now, I suggest you to set Dual Mode to false on the server-side as well as client-side. Also, when you use the client to connect to the server, the Network Address should be set to “127.0.0.1” not “localhost”.

I don’t know much about Mirror, so I am not sure if there is a more appropriate way to fix this issue. If you have any further question, please feel free to let me know.

10 |1200

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

Paul Gilmore avatar image
Paul Gilmore answered

One issue I see with your json file is: "NumHeartBeatsForTerminateResponse":60. This means that, working properly, your server terminates itself in about 30 seconds. This might not be enough time for you to actually do a proper test.

We understand that not all the options in MultiplayerSettings.json are well understood. We have recently made a tool to try and improve this. Please take a look: GitHub.com/PlayFab/LocalMultiplayerAgent/SettingsJsonGenerator

This utility has a slider and a default for NumHeartBeatsForTerminateResponse. The defaults and sample ranges should give you a sense of some time thresholds you might expect in the live cloud environment. It's still possible that real values might be outside these ranges, but your server should handle these ranges as "typical". In the case of NumHeartBeatsForTerminateResponse, the default is set much higher than 60 ticks.

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.