Matchmaking to maintain fixed distribution of players

Options
Hi,

I have used PUN for almost 4 years now. Have 2 live games using it. We are working on a new game which require a bit more complex matchmaking. I will right away go to the problem we are trying to solve.

Our game requires 10 players. We want to match them using PLAYER LEVEL.

Now we want a fixed distribution (not order) of players in a room. Like below
  1. Player 1 - Level 1
  2. Player 2 - Level 1
  3. Player 3 - Level 1
  4. Player 4 - Level 1
  5. Player 5 - Level 2
  6. Player 6 - Level 2
  7. Player 7 - Level 2
  8. Player 8 - Level 2
  9. Player 9 - Level 3
  10. Player 10 - Level 3
I could use sql lobby to specify something like this

C0 >= 1 AND C0 <= 3 // C0 is key for player level

But this will not maintain the distribution. With this room might get all player with level 1 and so on. I could try to change room property when a player joins to change the criteria but by the time room property is changed, player might already join it.

The solution i think could be something like spots in room with weightage which can be changed on player join call. Something like Check and Swap feature.Please let me know if there is a way to solve this problem.

Sorry for long question but it needed to be explained :)

Best Answer

Answers

  • avinash
    avinash
    edited June 2016
    Options
    Thanks JohnTube for such a detailed reply.

    Both the approaches you explained could eventually do what i wanted. We had already thought about first one. But it would take time to match make players.

    We have used Check and Swap in our game but it's not for match making. What i was thinking if Photon has similar feature for matchmaking. When a player who is searching a game for e.g. of Level1 and finds a room then on same call photon could mark a slot in room as occupied and let this player join. So in details photon room could have slots like 1,1,1,1,2,2,2,2,3,3 (for my case of 10 players) as soon as a player with 1 joins that slot is gone. But i know this is not there.

    One more approach i could try is below:

    Player searches for a room of Level 1. He doesn't find
    Create a room with max players 4 and criteria Level 1
    After 4 players of level 1 join then change max players to 8 and criteria to Level 2
    When 4 more players of Level 2 join then change max players to 10 and criteria to level 3

    This is again time consuming but doesn't require switching rooms of kicking players.

    Note: one issue to manage would be when any player with level 1 leaves while we are searching for players of level 2.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2016
    Options
    I think you can't change MaxPlayers once a room is created. You can still test it to confirm.
    You can make use of CAS in Part 2 of my proposed draft to avoid 2 ex.MasterClients of same level inviting other same level players at the same time. You can send invitations (target room name) using another mean to avoid extra delay of going back to first same level room. Like Photon Chat, web service, Push Notification (data only), etc.
    Also my solution relies on RoomOptions PlayerTTL, EmptyRoomTTL, CheckUserOnJoin, PublishUserIDs, MaxPlayers and IsVisible. I prefer to use different lobbies for matchmaking rather than lobby properties.