question

martin-2 avatar image
martin-2 asked

Is There A Way To Setermine Lobby Player Index?

Hello,

I am currently working with the PlayFab Lobby in Unity/C#. Each player in the lobby has a different colour, which is associated with their lobby index/order (red = player 1, blue = player 2, etc).

I am trying to find a way of determining that player order across all the lobby players.

I originally tried to get the order of players via Lobby.GetMembers(), however that list order seems to be different across each lobby player.

I next tried setting a member property. The first player ("host") to create the lobby would be authoritative, and would use it's own lobby member list order to set a MemberProperty on the other players when they're added, stating their index in that list. This also does not work due to those players not being authenticated on the lobby "host"s game. The players cannot locally set it either, as they do not know their index (which is what I'm trying to solve).

Is there an easy method of determining this lobby index/order which I am missing? Any help would be appreciated :)

Thank for your time,

Martin

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

martin-2 avatar image martin-2 commented ·

Although there is a "See revisions" button, there appears to be zero methods of actually editing my post.

Just a comment to say the title should say "Determine" instead of "Setermine".

I'd also appreciate if someone could let me know how to edit a post.

0 Likes 0 ·

1 Answer

·
Neils Shi avatar image
Neils Shi answered

I think you can let the Lobby owner manage the color info by storing it in the LobbyData. After a player creates a lobby, as the Lobby owner, he can call UpdateLobby to set LobbyData, for example, {"Bule": "PlayerId0"}. When the next player joins the lobby, lobby owner can repeat the action, {"Bule": "PlayerId0", "Red" : " PlayerId1"}. The LobbyData is visible to members of the lobby and only lobby owner can modify it. So, you don't have to worry about players(who joined later)modifying it.

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.

martin-2 avatar image martin-2 commented ·

This was going to be my next approach. Not ideal, and there'll be a fair bit of extra work required when players leave and the order needs to be reshuffled, but it should work. Would be a nice feature to have build-in though :)

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.