question

emreertugrul avatar image
emreertugrul asked

Unity+Mirror Cant connect to allocated gameserver, cant RDP either!

Hi,

I've built a game server using Unity+Mirror, tested it locally with container mode as well, using the remove matchmaking service of Playfab. While developing locally, i just used localhost whenever a match was returned to me from the service. Then i uploaded the same zip file, with all the same port configurations to the Multiplayer servers of playfab, and selected this build to be allocated in the MatchMaking queue. As documented, this returns me the allocated server information in the Match object to the client. Then instead of localhost, i use this Ip4 address and the port information to connect to the game server:

Which is straight forward, but it just doesnt connect. Handshake fails and the connection is never successful. Whats more interesting is that the Playfab portal provides RDP connections to servers and game servers, and even these fail with "authentication error". What could i be missing here??

unity3dMatchmakingmultiplayer
13 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.

emreertugrul avatar image emreertugrul commented ·

Let me add a comment here, that the same behavior is actually persisting in local container! I cannot connect to the game server thru container by specifying port 56100! It works perfectly when its in process mode and listening on 7777.....

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan emreertugrul commented ·
0 Likes 0 ·
emreertugrul avatar image emreertugrul commented ·

@Citrus Yan yes i did, and i actually solved the issue which wasn't playfab related, but something to do with Mirror - which i posted as an answer to this thread.Thanks! One thing that's still missing is the RDP functionality though.. Still giving me authentication errors..

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan emreertugrul commented ·

OK, so, regarding the authentication error, may I know your title id for further investigation?

0 Likes 0 ·
emreertugrul avatar image emreertugrul Citrus Yan commented ·

Sure, its 7C6FA

0 Likes 0 ·
Show more comments
emreertugrul avatar image
emreertugrul answered

Well, issue resolved!


Here are a few tips if anyone else runs into the same issues.. The first thing that i did was to do a netstat-a on the docker container to see if the 7777 port was open.. and it was, but on UDP! For all this time, i thought KCP Transport - what mirror is using right now (talk about lack of documentation) was on TCP, but no.. it's on UDP. So once i've made the port configuration on the MultiplayerSettings.json to be UDP, the game started connecting to the gameserver on my local container. I then uploaded this gameserver to the playfab, and switch the port there to UDP as well, and viola!

Let me say that i really liked the matchmaking workflow that Playfab is doing, integrating it with the multiplayer servers - the whole session is handled on server-side, which gives you opportunity to make security checks while players are connecting and all, really good flow! I can't say the same for Mirror and Unity though, the lack of good documentation and (no) variety of provided examples really makes it difficult for you to fall into the pit of success!...

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.

pmartinet44 avatar image pmartinet44 commented ·

Hello,

I had the same issue, and when i saw your post i was sur that it was the cause of my problem. But it stills not work :( .

I tested in local container with this settings :

"PortMappingsList": [ [ { "NodePort": 56100, "GamePort": { "Name": "game_port", "Number": 7777, "Protocol": "UDP" } } ] ],

I have my server project with Kcp Transport on port 7777.

And i have my client project with Kcp Transport on port 56100.

I've the same error, the timeout during the handshake.

Do you have any idea, what i did wrong ?

0 Likes 0 ·
emreertugrul avatar image emreertugrul pmartinet44 commented ·

Hi @pmartinet44, with this setup of mirror+unity there are a million ways things can go wrong.. But in essence, make sure your server (that is derived from class NetworkManager) listens on port 7777 and is started with StartServer() (and is not marked to run on start from unity designer) and use the client like this.. Your port mappings look correct to me...

0 Likes 0 ·
playfab.png (11.6 KiB)
Weien Meng avatar image
Weien Meng answered
{
    "RunContainer": false,
    "OutputFolder": "",
    "NumHeartBeatsForActivateResponse": 10,
    "NumHeartBeatsForTerminateResponse": 60,
    "AgentListeningPort": 56001,
    "AssetDetails": [
        {
            "MountPath": "C:\\Assets",
            "LocalFilePath": "E:\\mirror_test\\server1\\server3.zip"
        }
    ],
    "GameCertificateDetails": [],
    "PortMappingsList": [
        [
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "game_port",
                    "Number": 7777,
                    "Protocol": "UDP"
                }
            }
        ]
    ],
    "ProcessStartParameters": {
        "StartGameCommand": ".\\Mirror_test.exe"
    },
    "ContainerStartParameters": {
        "StartGameCommand": "C:\\Assets\\Mirror_test.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"
}

Above is my MultiplayerSettings.json

Test locally:

ip set as 127.0.01.

Kcp port set as 7777, connect successfully!

Kcp port set as 56100, handshake Timeout :(

Test on playfab VM:

IP set as returned by RequestMultiplayerServer

Kcp port set as 7777, handshake Timeout :(

Kcp port set as returned by RequestMultiplayerServer, handshake Timeout :(

Please help!

@emreertugrul

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]