question

Evan Maxey avatar image
Evan Maxey asked

Cannot get PlayFab/MPSSamples/UnityMirror working with PlayFab Build Deploy

Looking to use PlayFab services for our new title and starting with PlayFab/MpsSamples/UnityMirror...

Have the sample working local host on desktop docker...

Deploying this to playfab; the Client is unable to connect, error below from client log (can reproduce running in unity editor)...

I'm guessing there's something either in the client build or in the playfab server settting I have goofed up. Server deploys and is ready for connection. I can RDP to the server and it looks healthy...

On the client side do I put the public IP of the game server in the IP address for the network manager? or?

Open to any guidance folks have! :)

Client Recv: failed to connect to ip=xx.xx.xxx.xxx port=56100 reason=System.Net.Sockets.SocketException (0x80004005): Connection timed out at System.Net.Sockets.TcpClient.Connect (System.String hostname, System.Int32 port) [0x0019d] in <xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>:0 at Telepathy.Client.ReceiveThreadFunction (Telepathy.ClientConnectionState state, System.String ip, System.Int32 port, System.Int32 MaxMessageSize, System.Boolean NoDelay, System.Int32 SendTimeout, System.Int32 ReceiveTimeout, System.Int32 ReceiveQueueLimit) [0x00011] in <xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>:0 Shutting down client. disconnected

1 comment
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

How do you get the IP address and port number? Is it returned from the callback result of RequestMultiplayerServer API or through GetMatch API when the matchmaking ticket is matched?

0 Likes 0 ·
JayZuo avatar image
JayZuo answered

As I understand it, you've deployed UnityServer into PlayFab Multiplayer Servers (MPS). And now you are trying to connect to the server with UnityClient. In the Client, you set the IP address for the network manager to the one you've found in Game Manager and the Port remains to 56100.

This is not the right way to get the IP address and Port. As this sample doesn't use PlayFab Matchmaking, you can refer to Allocating multiplayer sessions to get the right IP address and Port. The easiest way would be using Postman to send a RequestMultiplayerServer request.

Once you've got the correct IP address and Port and set them in UnityClient properly, the client should be able to connect to your server hosted on MPS with no issue.

10 |1200

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

Evan Maxey avatar image
Evan Maxey answered

@SethDu

Hi Seth, thanks for the reply.

This is the straight PlayFab published MPS sample for working with unity and mirror.

Link: https://github.com/PlayFab/MpsSamples/tree/master/UnityMirror

I'm familiar with the notion of using RequestMultiplayerServer or GetMatch though I don't believe for this PlayFab published sample it uses that. I believe it simply authenticates and connect to the server though this is PlayFab's code not mine. Not a lot of code there; if you have a moment take a look. Figured I get it working with a PlayFab deployment before I started poking at the code for our title.

I have it working fine locally with Docker by specifying "localhost" in NetworkManager's Network Address.

What I tried for the PlayFab services deploy is to specify the public IP address of the game server as available on the game manager console with the Client project as the NetworkManager's Network Address.

Thoughts?

-Evan



10 |1200

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

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered
10 |1200

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

Evan Maxey avatar image
Evan Maxey answered
@SethDu

had thought...is it that the MpsSample here is not intended to be deployable to PlayFab? Just for running local host?

1 comment
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

The sample can be deployed on PlayFab, but there are additional configuration steps indicated by the tutorial. You cannot simply run locally without PlayFab VM agent because the server build requires certain network environment.

PlayFab also provides document about Locally debugging game servers and integration with PlayFab - PlayFab | Microsoft Docs for both container mode and process mode.

0 Likes 0 ·
Evan Maxey avatar image
Evan Maxey answered
@dgkanatsios

Hey! :)

Thanks for chiming in; That's actually what I used to get the local, desktop docker version to run. Challenge is how to get it to run when server piece is deployed to PlayFab services.

10 |1200

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

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

which is the port you are trying to connect to? In your original post it says "56100". I don't think this is the correct port, you should try and connect to the port that comes after a successful "RequestMultiplayerServer" call.

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.

Dimitris-Ilias Gkanatsios avatar image Dimitris-Ilias Gkanatsios commented ·

You can check our quickstart video for mode details regarding the allocation flow :) https://www.youtube.com/watch?v=kj2TcMlvWgk

0 Likes 0 ·
Evan Maxey avatar image Evan Maxey commented ·

thanks, checking it out!

0 Likes 0 ·
Ryan Steckler avatar image
Ryan Steckler answered

Make sure you have your mirror port exposed when you deploy the build. It's probably udp 7777.

Then, as Dmitris pointed out, you can get the ip address and port from RequestMultiplayerServer. You'll also need to make sure that the "Client Can start games" setting is enable on your title in playfab

10 |1200

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

Evan Maxey avatar image
Evan Maxey answered

Thanks to everyone for the replies. I got this working with full playfab deployment once I figured out that I had to get the port from the GetMatchResult. Appreciate everyone chiming in.

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.