question

zero avatar image
zero asked

Uncommon Match Making Design

I am implementing match making system similar to a game like Clash of Clans where the opponents that you are matched against are always offline. You don't play against them directly in real-time you just pull some of their user data and play against their saved player data. I have custom game servers that can validate all the results of the match and update both players' data records. But the one part I am missing is how to actually match players. Thanks in advance.

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

Thanks for your full information. For clarification, we do not provide game developers with arbitrary query into the PlayFab core service database tables, since the enormous number of queries will cause the potential performance issues. For your case, you can get a leaderboard of players around the current player's score, then randomly pick one of them for the challenge. In addition, PlayFab does not automatically record the online and offline status of players. You can write the custom event to trigger the CloudScript to store the statuses to their publish player data.

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

Currently, PlayFab provides a matchmaking feature that designed for the synchronous matchmaking (the players should be online). And there is no ETA for the asynchronous matchmaking system. We would suggest you use the Photon Turn-based for the asynchronous matchmaking. There is a thread discussed on the topic of asynchronous matchmaking for turn-based games: https://community.playfab.com/hc/en-us/community/posts/207129407-Persistent-turn-based-games-. You can check this thread for the suggestion on asynchronous matchmaking.

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

zero avatar image zero commented ·

@Sarah Zhang

I have read that topic and I don't think that the Photon-Turn based system is going to solve my problem. Let me try to give some more details:

  • Player A logs into the game
  • Player matchmakes/joins a custom game server (the single player part of the game has validation the the server needs to do)
  • Player A searches for a match
  • This is the part that is missing I need to find a Player that matches these criteria:
    • Player is offline
    • Player's level is equal to the requesting player
  • Player X is found for the match
  • Server sends Player A game data from Player X
  • Player A plays the match and sends the server the result
  • Server validates the result and updates Player A and Player X stats/data

The first solution that comes to my mind is a simple DB with a row for each player with a data model like this:

{
player_id string (PlayFabID - unique key)
player_state int (offline = 0, offline = 1, under attack = 2, etc.)

player_level int

}

On login/logout update the player state

For match making it would be a query something like this:

SELECT player_id FROM matchmake_table
WHERE player_state == 0 AND player_level == reqLevel
ORDER BY RAND()
LIMIT
0 Likes 0 ·
zero avatar image zero commented ·

The problem with that solution is that I don't want to create, maintain and scale my own DB and was hoping there was something you guys provided that I could use but I have not been able to find it. Please advise, thanks.

0 Likes 0 ·
zero avatar image zero commented ·

Also to help clarify there is no multiplayer in the normal sense where 2+ players are competing at the same time in the same room/lobby/game. You build a virtual base with your resources and you can attack other players' virtual bases. When you are offline other players can attack your virtual base.

0 Likes 0 ·
zero avatar image
zero answered

@Sarah Zhang

I don't think that the Photon Turn-based system would work for what I am trying to build, let me try to give some more details about the problem:

  • Player A starts the game (login, pull their player data, etc.)
  • Player A starts searching for a match

This is the part that I'm struggling with. I need to find a random player who is offline and has a player level equal to the requesting player

  • Player A is matched with Player X
  • Server Requests game data for Player X and sends it to Player A
  • Player A plays the match
  • Player A reports the results to the Server
  • Server updates Player A and Player X's data/stats with game result

The most obvious solution in my mind is to have a DB with an entry for each player like this:
[player_id, player_state (online, offline, under attack), player_level ]


When a player logs in or logs out the Player's state would be updated in the DB.

When a player requests to find a match the server would make a DB call which would look something like this:

SELECT player_id FROM player_table
WHERE player_state = "offline" AND "player_level" = request.PlayerLevel
ORDER BY RAND()
LIMIT 1

This would get a random player that is offline and has a matching level. I can then update that player's "player_state" to "under_attack" so they can't be matched again while this match is in progress.

I don't want to have to manage, maintain, and scale my own DB for this project. I was hoping that there was some solution that you guys provided which I have not found that can solve this problem.

Please advise, thanks.

10 |1200

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

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.