question

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) asked

Can I get a conceptual explanation of how a custom Matchmaker would work?

As I understand it, the Client API Matchmake call either

1. Succeeds and returns connection info

2. Returns GameNotFound

3. Returns an error

Then it is up to the client how to handle those responses.

However, the Matchmaker that I am looking to implement would support the following:

  • If GameNotFound, jump on a queue of players waiting to be matched.
  • Only form matches with 8 players, no less, no more.
  • Be able to implement a "match score" that ranks how healthy a match is, as a function of each player's skill level, time in queue, and other factors. The matchmaker should attempt to form healthy matches.

Can I get a conceptual explanation of what PlayFab services and APIs I'd use?

I'm looking for an answer with a similar level of depth as:

https://community.playfab.com/questions/5418/custom-server-order-of-operations.html

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

1 Answer

·
brendan avatar image
brendan answered

Correct, the Matchmaker API set is for developers who want to build their own custom matchmaking server. In general, the way one would work is:

  • Player sends request to match to your server
  • Your server
    • Manages active game server info (you need to have your game servers communicate status to it, so that it knows what's available)
      • If you're hosting custom game servers with PlayFab, that may include using StartGame to start game instances
      • The "match score" is entirely up to you - it's any logic you need (and the whole reason you want to run your own matchmaking)
  • Validates the player is good with AuthUser, and optionally uses UserInfo to get any info needed
  • Replies to client with info on the server it should connect to
  • Player joins that session
  • Your custom game server tells your matchmaker that the player joined (you'll want to use some form of validation on this, like our matchmaker receipt), and if it's valid, your matchmaker calls PlayerJoined to let our service know
  • Player plays in the game session, and eventually either disconnects or leaves cleanly
  • Your server determines when players have left servers and calls PlayerLeft to let our service know
  • So for your model, for players who can't get into a game right away (which I'm curious about - if games must be exactly 8 people, how could they ever join one that's already going - join in progress if someone leaves a game?), you would need to maintain a connection to the players until you've got the set needed to start a game session, start that session, and then send the players the info on that session so that they can join it.

    I will say that what some titles are doing is a basic matchmaking call in PlayFab to join players to a "lobby" server, which they use for persistent connections to the player while they decide how to group up players for actual gameplay. They then call StartGame and send the info on the session to those players, as described above. Some of those games are even using the lobby as another part of the game - a place for players to chat or even interact with parts of the world which require much less compute power than the action part of the game, so that they can have a smaller number of lobby servers.

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

Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Thanks for the great explanation @Brendan.

Manages active game server info (you need to have your game servers communicate status to it, so that it knows what's available)

Would it make more sense for the Matchmaking Server to keep track of the Game Servers' availability whenever it spins one up/down? That way it wouldn't have to query the Game Servers every time it formed a match.

if games must be exactly 8 people, how could they ever join one that's already going - join in progress if someone leaves a game<br>

In my game, you cannot join a game that is already in progress, unless you were the player that left.

If you cannot get into a game right away, you just wait.

It's like League of Legends and Dota 2.

0 Likes 0 ·
brendan avatar image brendan ♦♦ Brent Batas (Lisk) commented ·

Sorry if I wasn't clear - when I said "Your server" in the second bullet above, I was specifically referring to your custom matchmaker server. What I was saying was that servers need to inform the matchmaker of when they're available, and should have a heartbeat mechanism to make sure the matchmaker knows they're still available (if they are). So it's not the matchmaker querying the game servers - it's the other way around, with the servers telling it they're available. That way, if a server drops for any reason (hardware or software failure), the matchmaker removes it from its list after it misses a heartbeat (or two, usually).

It sounds like in your model though, you want to do a matchmaker queue, where players accumulate until there are enough for the session. In that case, you'll be starting game sessions and sending clients the connection info. In your case, it sounds like you won't need to keep track of game instances at all, so that heartbeat concept likely isn't necessary.

1 Like 1 ·
Joshua Strunk avatar image Joshua Strunk brendan ♦♦ commented ·

When using a custom matchmaker with PlayFab hosted game servers do our game servers still need to be sure to heartbeat to PlayFab through Server.RefreshGameServerHeartbeat? RegisterGame/DeregisterGame?

Does Matchmaker.StartGame/Client.StartGame return the spun up instance's info before the instance is even ready.(before has registered itself?) Asking because have noticed at times when using StartGame through client will have massive delays between info being returned and client's being able to succefully connect.

How much tracking will we get in the GameManager with a custom matchmaker or will we need to build out our own panel to monitor game/server states.

0 Likes 0 ·
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.