question

Dawid Majdanik avatar image
Dawid Majdanik asked

Server is in standby and players count is 0, but multiplayer is working

Hello,

I was following this repo to get my game working PlayFab Unity and now I have one problem. I developed my build and put it on the server, and then using method

PlayFabMultiplayerAPI.RequestMultiplayerServer 

I requested server and connected one player to the game. Then, on the other PC on the other network(to make sure it is working via server) I have connected to the same server. Both players can see each other, my chat system is working and players can communicate, but server I am using is in Standby mode and shows players count 0.

On server side I am using

PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers

and I have tested it multiple times. Server can see both players, (eg. when I used 3rd PC it loaded previous 2 players).

Have you got any ideas what am I doing wrong or what should I do to make it work like it should?

10 |1200

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

Dawid Majdanik avatar image
Dawid Majdanik answered

Hello again, I have been testing everything, literally debugging every method that is on my side and it was working. Then I checked logs from server line by line and I have found this error:

{"log":"Exception: The given key is defined multiple times in the same type: ConnectedPlayer.playerId\r\n","stream":"stdout","time":"2022-02-17T12:28:16.8963532Z"}

And I went to my class "ConnectedPlayer" and it looked like this:

 public string playerId; 
public ConnectedPlayer(string playerid)
{
PlayerId = playerid; playerId = playerid;
}
[JsonProperty(PropertyName = "playerId")]
public string PlayerId { get; set; }

I removed field "playerId" and everything works now! That is the reason why wasn't it working(updating players) and other things were working(because I use Mirror for networking and communication).

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.

Made Wang avatar image Made Wang commented ·

I'm glad to know you have solved this issue.

1 Like 1 ·
Made Wang avatar image
Made Wang answered

Where are you observing the server status and player count? If it's Game Manager, it may have a delay.

You can use ListMultiplayerServers to get servers and see how many players there are.

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.

Dawid Majdanik avatar image Dawid Majdanik commented ·

First option is PlayFab's dashboard and second is MpsAllocatorSample . Both show 0, I waited almost hour to make sure everything updated(with both clients connected),I have been following this video and when I used 1st option(RequestMultiplayerServer) then requested server went to Active state but even with added users by method from video(strings by console) it still doesn't add players to server.

0 Likes 0 ·
Made Wang avatar image Made Wang Dawid Majdanik commented ·

I tested following the video you mentioned and I can use it normally and return the needed information.

Can you describe your steps, and give some screenshots (be careful to remove sensitive information) so that we can reproduce the issue?

In addition, server-related information is not displayed in Dashboards, you can see the information of currently active servers in Game Manager->Multiplayer->Servers->Builds->[Your Build]->Servers.

0 Likes 0 ·

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.