question

Sim Soon Kim avatar image
Sim Soon Kim asked

Problem with Entity on the serverside,Question about Entities on the Server side.

I was trying to use the Backfill tickets feature on the server side for a small game in Unity when I encounter the error "...must be logged in to use this feature" when trying to call GetMatch. Given that the client side does not have this problem, am I missing an authenication step on the server side? Further digging seems to point at PlayfabSettings.staticPlayer not having an entityToken being the problem.

,

My team is current experimenting with PlayFab for a mini game project on Unity, where I was trying to use the Backfill ticket functions. At the moment, any attempts to call GetMatch will result in an error message where it says I must be logged in to used that feature. I am probably missing a step when working on the serverside, while on the client side, there is no such problem. Further digging seems to show that the Playfab.staticPlayer has no entityToken assigned to it. Please help with this problem.

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.

Sim Soon Kim avatar image Sim Soon Kim commented ·

For some reason... the question I typed earlier got mixed with the one I typed later....

0 Likes 0 ·

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

GetMatch is entity API which requires an Entity Token for authentication, available from the Entity GetEntityToken API. That the client side does not have this problem is because login calls automatically set the EntityToken received from the response , take UnitySDK for example, here is the code that does it:

#if !DISABLE_PLAYFABENTITY_API
            var entRes = result as AuthenticationModels.GetEntityTokenResponse;
            if (entRes != null)
            {
                PlayFabSettings.staticPlayer.EntityToken = entRes.EntityToken;
            }
#endif

https://github.com/PlayFab/UnitySDK/blob/7d2b13284271404527d2dd0b93202d9802b3e30e/ExampleTestProject/Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs#L245

Therefore, in order for the server side to call GetMatch, you first need to call GetEntityToken to get the title-level EntityToken and use that to make the calls.

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

Sim Soon Kim avatar image Sim Soon Kim commented ·

Hi, turns out there was another issue preceding this login issue; I have to update Unity to 2019.3.15f1 to remove a curl error, before GetEntityToken starts working. After that I was able to get BF to work.

I unfortunately encountered another problem where the server will be stuck in WaitingForMatch even though I have a client at the GetMatchmakingTicket loop(every 6s, ticket was created b4 the backfill process started). The only way for me to get the client to connect was to restart the match making process on the client. Any idea about this?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Sim Soon Kim commented ·

"WaitingForMatch" indicates that the Matchmaking system cannot find a match for the tickets in the queue. May I know the configurations of the Matchmaking Queue, details of the server backfill ticket and the tickets created by players?

Repro steps would be helpful for us to investigate further, would it be possible that you share that?

0 Likes 0 ·
Sim Soon Kim avatar image Sim Soon Kim Citrus Yan commented ·

Hi, here's an ss of the queue settings that I am using:

For the player side:

                Creator = new MatchmakingPlayer
                {
                    Entity = new PlayFab.MultiplayerModels.EntityKey
                    {
                        Id = result.EntityToken.Entity.Id,
                        Type = "title_player_account"
                    },


                    Attributes = new MatchmakingPlayerAttributes
                    {
                        DataObject = new
                        {
                            latencies = new object[]
                            {
                                new {
                                    region = "EastUs",
                                    latency = 150
                                },
                                new {
                                    region = "WestUs",
                                    latency = 100
                                }
                            }
                        },
                    },
                },
                GiveUpAfterSeconds = 120,
                QueueName = _configuration._queueName
0 Likes 0 ·
mm-queue.png (39.4 KiB)
Show more comments

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.