Montana Tuska avatar image
Montana Tuska asked

My confusion of Matchmaker API

I am working on my OnlineSubsystem again, doing a pass over of the different UE4 interfaces and seeing what I can work on, and have reached this point again where I get confused on PlayFab’s design. I’m not sure where I should use the Matchmaker API versus Server API and, I don’t see a reason for Matchmaker to have it’s own API at all... Let me explain how I see things, what I think should be changed, then you can tell me about how I have no clue what I’m talking about then correct me.

What I think I understand:

Matchmaker::StartGame should be called from a custom matchmaker when it wants to start a PlayFab game instance. Pretty simple, and then PlayFab will send back to the “External…Endpoint” when that session closes, with the corresponding ID.

Matchmaker::PlayerJoined should be called only when using a custom matchmaker? Maybe?

Matchmaker::PlayerLeft same as PlayerJoined

Matchmaker::AuthUser has no purpose? I mean, Server::RedeemMatchmakerTicket already checks the validity of session tickets…

Matchmaker::UserInfo is called by the custom matchmaker to get user info, honestly this should be a server function so servers can get the info. You’ll probably say servers can already do that, but, there doesn’t seem to be much of uniform in the functions when it comes to PlayFab player info… Matchmaker:UserInfo is the best function franky.

What I think should change:

Server::StartGame should have an optional “External…Endpoint” and then when playstream events occur for that game id, they get forwarded to the endpoint. Just this simple change, and, the Matchmaker API is gone, and that stops all the confusion of how the hell the custom matchmaker is supposed to work I believe.

But of course, I probably have misconceptions, so, that’s the point of this.

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.

Montana Tuska avatar image Montana Tuska commented ·

Why does Server::RedeemMatchmakerTicket even send a "PlayerJoined"? Authentication is different then "Oh yeah, the player joined". There's a Server::NotifyMatchmakerPlayerLeft why not a function to match?

And bringing up Server::NotifyMatchmakerPlayerLeft also agains makes me wonder why have Matchmaker::PlayerLeft...

0 Likes 0 ·

1 Answer

brendan avatar image
brendan answered

All the Matchmaker API calls are intended for use in an external matchmaker. So yes, Matchmaker/StartGame is what you would use to start a new session instance, so that you have one for players.

The Matchmaker/PlayerJoined call is for that matchmaker to let us know that a player has entered a game session. The idea is that when you "assign" a slot in a session to a player, that's the call you make to us. You should also have your custom game servers communicating with your matchmaker, to validate players trying to join them (so that people can't hack your game to jump into whatever server they want). If the player doesn't join that server after a minute or so, just use Matchmaker/PlayerLeft to remove them from our data. By the same token, when the server tells your matchmaker that the player left, you would also use Matchmaker/PlayerLeft to inform our service.

Matchmaker/AuthUser is what you use when a player connects to your matchmaker to get a session, so that you know it's actually a legitimate player, with a valid session ticket. You should not be using Client/Matchmake (which is where you get a matchmaker ticket, for Server/RedeemMatchmakerTicket) if you are using your own matchmaker.

Matchmaker/UserInfo is so that you can query for the user details (rather than letting the client tell your matchmaker - and potentially cheat that data), for the purposes of picking the session you want to put the player in.

On the PlayStream events, I'm not clear on what your goal is, so yes, this is probably just a disconnect on the intended usage.

So to summarize:

If you are using your own custom matchmaker server, use the Matchmaker API calls. Do not use Client/Matchmake, Server/RedeemMatchmakerTicket, or Server/NotifyMatchmakerPlayerLeft.

If you are using the PlayFab matchmaker, do not use the Matchmaker API calls. Use Client/Matchmaker and/or Client/StartGame to get info on sessions to join. Use Server/RedeemMatchmakerTicket to join the session, and Server/NotifyMatchmakerPlayerLeft to tell our matchmaker when the player leaves the session.

10 |1200

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

Montana Tuska avatar image Montana Tuska commented ·

Awesome, yeah, it was mostly misconceptions on my part.

Thank you, hopeful as always.

0 Likes 0 ·
Montana Tuska avatar image Montana Tuska commented ·

So, if Matchmaker/AuthUser is the custom matchmaker equal of Client/Matchmake, then what about Server/RedeemMatchmakerTicket? Shouldn't there be an equivalent for that in the Matchmaker API for authorization?

0 Likes 0 ·
brendan avatar image brendan Montana Tuska commented ·

There is no Matchmaker API equivalent of Client/Matchmake. You use the Matchmaker API to build an equivalent.

PlayFab's matchmaker:

Client/Matchmake - asks our matchmaker to provide a session slot for a player, returns a ticket specific to that session slot.

Server/RedeemMatchmakerTicket - the client passes the ticket the PlayFab matchmaker gave it, and the server uses this to both validate that the player can legitimately join the session, and to notify PlayFab that the player actually joined.

Server/NotifyMatchmakerPlayerLeft - tells PlayFab that the player left the session.

Your custom matchmaker:

Matchmaker/AuthUser - your matchmaker uses this to determine if the player is actually signed into PlayFab.

Your matchmaker uses your custom logic to decide when to start sessions and which ones to put players in.

Matchmaker/StartGame - tells PlayFab to start a new session instance, as needed.

Your custom game servers communicate with your matchmaker.

Matchmaker/PlayerJoined - tells PlayFab that the player joined the session.

Matchmaker/PlayerLeft - tells PlayFab that the player left the session.

0 Likes 0 ·
Montana Tuska avatar image Montana Tuska brendan commented ·

I don't understand why the custom matchmaker is designed this way, it seems like such a hindrance. Any communication between the matchmaker and server now has to be a direct communication. Why wouldn't you want to use your already provided functions for these and just forward PlayStream events to the endpoint that a StartGame is specified with?

0 Likes 0 ·
Show more comments
colinchiu avatar image colinchiu commented ·

So for externally hosted games, we can also use an external match making server? But Playfab is there to facilitate a lobby system for what current lobbies and players are online and playing?

0 Likes 0 ·
brendan avatar image brendan colinchiu commented ·

You can use an external matchmaker whether you're using our host or not - either way. If you're using external server hosting and an external matchmaker, you could still register your external servers with us, in order to use GetCurrentGames as a recovery mechanism for if your matchmaker has to be rebooted.

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.