question

connorhallman29 avatar image
connorhallman29 asked

Why isn't local multiplayer working in Unity?

I have followed all the guides, and I cannot get this to work again. It worked a couple of times and then stopped working. I have re-installed windows, the playfab editor extension, the sdk, tried in different projects, everythings, it will not work. Here is a link to a video where a include everything I think is necessary video. In the videos I've seen, the GSDK_CONFIG_FILE Not Defined error and the other error go away once the container is running but for me it persists even once I have the container running; so that may have something to do with it. If theres any other logs or files you need me to send I can send them. Here is a copy of the logs from the container server build logs.

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.

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

The "GSDK_CONFIG_FILE Not Defined" error can appear when you are NOT running using the LocalMultiplayerAgent. Are you using it? PlayFab/MpsAgent: Azure PlayFab Multiplayer Servers LocalMultiplayerAgent project and helper libraries (github.com)

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

connorhallman29 avatar image connorhallman29 commented ·

Okay, I figured out my problem. The first time I built it I had the server built to run on ports 7777. After that I changed my transport port to 56100 and never thought to change it back to 7777 when I built the server again (Thats why it worked once but not once I rebuilt the server). Im so mad I never thought of that. Though I do have a lot of questions that I would love answers to if you don't mind me asking. Firstly why are the transport ports different for the client and the server (Server - 7777, Client - 56100)? What is the difference between the transport port (The one on the KCP Transport or Telepathy Transport) and the network server/manager port? How does the AgentListeningPort (56001) play into all of this, I don't have my transport port or network manager port set to 56001 on the client or server? And finally, do I need a completely seperate build for the server and client like in the MPS Samples or could I just have 1 build? If 2 builds are required or preferable, how should the client and server builds differ?

1 Like 1 ·
Dimitris-Ilias Gkanatsios avatar image Dimitris-Ilias Gkanatsios connorhallman29 commented ·

1. For port mapping on containers, you can check the video here, around minute 20 (9) PlayFab Multiplayer Hosted Servers part 1: Multiplayer Servers Quick Start - YouTube. On container mode, your server process starts at 7777 but (since containers use their own network namespace) during container creation the 7777 is mapped to 56100 on the VM level. So the client will send packets to 56100 on the VM and these will end up to 7777 on the container. This is why you can have >1 servers on the same VM listening to 7777, since each one will get a different port on the VM.
This is not true for process mode however, since all game servers are using the VM network namespace so they have to use a different port (which you get via a GSDK call).

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

2. You can ignore the AgentListeningPort and just use 56001. This is the port that the GSDK will send the heartbeats to. You should change it only if you are using another program that reserves this port.

3. We provide two projects (client/server) for the Unity Mirror sample in an effort to keep the code clean, for easy copy/paste. However, we understand that people like to have a single project with #if defines separating client/server, you can do that

0 Likes 0 ·
Made Wang avatar image
Made Wang answered

From the information you provided, the server can be started and shut down normally, but the client cannot connect to the server. You can try outputting the port in your code to see if the port is configured correctly. Also, you can use this case to do some testing to make sure the configuration is correct on the Linux container.

The two errors reported in Unity are normal, this is the content of the GSDK, and it is not used when you start the project as a client.

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.

connorhallman29 avatar image connorhallman29 commented ·

Okay, I figured out my problem. The first time I built it I had the server built to run on ports 7777. After that I changed my transport port to 56100 and never thought to change it back to 7777 when I built the server again (Thats why it worked once but not once I rebuilt the server). Im so mad I never thought of that. Though I do have a lot of questions that I would love answers to if you don't mind me asking. Firstly why are the transport ports different for the client and the server (Server - 7777, Client - 56100)? What is the difference between the transport port (The one on the KCP Transport or Telepathy Transport) and the network server/manager port? How does the AgentListeningPort (56001) play into all of this, I don't have my transport port or network manager port set to 56001 on the client or server? And finally, do I need a completely seperate build for the server and client like in the MPS Samples or could I just have 1 build? If 2 builds are required or preferable, how should the client and server builds differ? I asked Dimitris the same questions as well.

1 Like 1 ·
Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

FWIW, yesterday we updated the Unity Mirror sample and we validated that it works with Windows Containers/Processes and Linux containers. MpsSamples/UnityMirror at main PlayFab/MpsSamples (github.com)

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.