question

Dávid Szabó avatar image
Dávid Szabó asked

Server Backfill - How it works? How to get Player Entities for Members?

Hello Forum,

I'm implementing my game with Unity using PlayFab's Matchmaking and auto allocated Servers. Now, I'm trying to implement Matchmaking Backfill on the server and I'm in need of some guidance.

First of all, am I right, that CreateServerBackfillTicket must be called by the server, when it needs more players? So Players don't call this method, only the server does. Players should call the regular CreateMatchmakingTicket and it will match with the server's Backfill ticket right?

What will happen when a Player connects through a Backfill ticket? Does the server's ticket ended? Does the server's Backfill continue?

For example, I have a server with 6 players and it needs 4 more, so I start a Backfill with the 6 Members. Can only a single Player connect through the Backfill ticket? Do I need to cancel and recreate the ticket for the 3 missing players? Or will it wait for the missing 4 players and connect them only together?

CreateServerBackfillTicket needs the Members of the server/match and each of these Member class needs it's Player Entity Key. As far as I see, these can be obtained by Logging in as a Player into Playfab. However, I don't want to log in my Players on the server. How could I acquire this Entity key on the server? Is it safe (or recommended) for the Players to send these Keys to the Server?

Thanks in advance!

Best Regards,

David

entitiesCustom Game Servers
10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

>> First of all, am I right, that CreateServerBackfillTicket must be called by the server, when it needs more players? So Players don't call this method, only the server does.

Yes, it’s right. If you allocate the server for the match. Using API CreateServerBackfillTicket to create the ticket, when the ticket is matched, PlayFab won’t allocate a new server session for it. The players who match with it would get the existed server sessions’ server details in the response of GetMatch. So when an existed match needs to increase the count of participants, you need to call CreateServerBackfillTicket.

>> Players should call the regular CreateMatchmakingTicket and it will match with the server's Backfill ticket right?

Yes, server backfill ticket will match with the regular matchmaking ticket. And backfill tickets cannot match with each other.

>> What will happen when a Player connects through a Backfill ticket? Does the server's ticket ended? Does the server's Backfill continue?

The count of players that can match with the server backfill tickets depends on the configuration of the queue. Similar to the regular matchmaking process. The count of players that be matched in one match should meet the minimum size you configuredin the queue configuration.

>> For example, I have a server with 6 players and it needs 4 more, so I start a Backfill with the 6 Members. Can only a single Player connect through the Backfill ticket? Do I need to cancel and recreate the ticket for the 3 missing players? Or will it wait for the missing 4 players and connect them only together?

If you set the minimum size of the corresponding queue as 10. You can match 4 players through one backfill ticket. If the minimum size is less than or equal to 7. Only a single player would be matched with this ticket in one matchmaking. So, when the minimum size of match is less than or equal to 7, you need to create 4 server backfill tickets for 4 missing players. In this situation, you needn’t cancel any tickets, just create 4 server backfill tickets, then wait for them matched.

Besides, you can check this documentation -- https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/matchmaking/backfill-tickets for more details about Using server backfill tickets.

>> How could I acquire this Entity key on the server?

As the API reference shows, the Entity Key means this player's EntityID, and the EntityTpye. EntityId is the unique Id of the entity, the EntityType here should be title_player_account. They are public information. Players can directly send them to the server. It won't cause security issues.

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.

Dávid Szabó avatar image Dávid Szabó commented ·

Thanks for the super detailed answer! Now, I understand how Backfill works.

I've managed to get Server Backfill working on my Build. Thank You very much for Your help!

0 Likes 0 ·
v-bpaul avatar image v-bpaul commented ·

Hello @Sarah Zhang, isn't there a membership limit preventing you from creating multiples backfill tickets at the same time ?

If I create multiples backfill tickets at the same time, I'll put the informations of the already connected players in all of them. But the documentation says: "Similar to regular matchmaking tickets, at any time a user may be in only one backfill ticket per queue"

So in order to reach the maximum capacity of our lobby when our minimum is already met, do we need to create the backfill tickets one by one and update the members informations each time a new player connect ?

Thanks in advance for your response.

Best regards,

Paul

0 Likes 0 ·
v-bpaul avatar image
v-bpaul answered

Hello @Sarah Zhang, isn't there a membership limit preventing you from creating multiples backfill tickets at the same time ?

If I create multiples backfill tickets at the same time, I'll put the informations of the already connected players in all of them. But the documentation says: "Similar to regular matchmaking tickets, at any time a user may be in only one backfill ticket per queue"

So in order to reach the maximum capacity of our lobby when our minimum is already met, do we need to create the backfill tickets one by one and update the members informations each time a new player connect ?

Thanks in advance for your response.

Best regards,

Paul

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.

Dávid Szabó avatar image Dávid Szabó commented ·

Hello @v-bpaul,

I believe what Sarah meant (and what I do) is to make backfill tickets sequentially not simultaneously. I only have one backfill ticket per server at a time.

When the server detects that it needs more players, it starts a backfill ticket with the members on the server. When a player connects the ticket is completed, the server will detect this at the next GetServerBackfillTicket, which is done in every 6 seconds. If the server still needs more players than it just starts another ticket. However, I delay the creation of the new ticket by 6 seconds after the GetServerBackfillTicket's result, just in case.

I cancel and recreate the ticket even when a player leaves. Similarly, I create the new ticket only 6 seconds after the cancellation.

Best Regards,

David

4 Likes 4 ·
arycama avatar image arycama Dávid Szabó commented ·

Thanks for this, I was struggling with this issue for days, and the only thing I was missing was "delay the creation of the new ticket by 6 seconds after the GetServerBackfillTicket's result".

You can only make 5 backfill requests per minute, which would be once every 12 seconds. So, waiting 6 seconds to poll, and then another 6 seconds before making another ticket would stay under this limit. I'm hoping that's the reason why it works.

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.