# How can I implement a matchmaker?

I'm making a multiplayer game, where players are separated in to rooms that would ideally have about 20 players.

So I need a few pointers on an algorithm to distribute the players in to these rooms.

A few more constraints:

• When a players gets in to a room, he should stay there until he decides to exit (the room itself changes levels)
• There may be more room servers, every server should create more rooms until near full capacity
• There's a central server that manages all the room servers, and directs the players towards their room

EDIT

Because the question is too specific to my game and it is very likely that I will never mention all the details necessary (because they are hidden in my brain until someone asks) I'm considering deleting this question.

I'm not deleting it any longer because I've received an interesting answer.

Although for now I'm implementing a trivial solution, and I will improve it later if needed.

• Could you provide more information? For example: Do you have a scoring system to rate the players' skill level? Do you want similarly skilled players to play together? How many players do you expect to distribute in a given time? How long do you think your players are willing to wait until their game starts? Commented Aug 29, 2012 at 9:39
• I've been thinking about implementing scoring, but i've decided against it because the game is pretty simple. I don't know how many players I should expect. And the game will start instantly, if it can't find a half filled room, and empty one will be made and it should be given priority for the next few players that join.
– csiz
Commented Aug 29, 2012 at 10:35
• This is unclear to me. Does the game start when the room is half full? Can the players decide to start the game once the room is half full? Is a new empty room created whenever no other room is less than half full? Are less than half full rooms given priority to reach the critical threshold of being half full (which means that the game can start), or can games only start if the room is full? (In the latter case the prioritization mechanism would prevent rooms from ever getting full.) Commented Aug 29, 2012 at 11:09
• OK, my fault in not explaining that. The game starts as soon as the room is created and then it goes to a random new level if someone wins, and so on. The "room" is more of a collection of players that are synced together. What I wanted to say in the previous comment was that a player will play alone when a new room is created (this rooms is given priority up to about 10 players to make the game not boring), then it goes back to normal priority where it gets filled up to max players. (also i'm considering deleting the question now, because it is too specific to my game)
– csiz
Commented Aug 29, 2012 at 11:46