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


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.

  • \$\begingroup\$ 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? \$\endgroup\$
    – BerndBrot
    Commented Aug 29, 2012 at 9:39
  • \$\begingroup\$ 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. \$\endgroup\$
    – csiz
    Commented Aug 29, 2012 at 10:35
  • \$\begingroup\$ 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.) \$\endgroup\$
    – BerndBrot
    Commented Aug 29, 2012 at 11:09
  • \$\begingroup\$ 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) \$\endgroup\$
    – csiz
    Commented Aug 29, 2012 at 11:46

1 Answer 1


Draw a coordinate system with "number of players in a game" on the x-axis (the independent variable) and "fun" on the y-axis (the dependent variable). Add data points for each of the 1 - 20 player scenarios. Connect the data points and look at the graph you just plotted. Try to come up with a formula that characterizes the graph.

You can now compute the maximum accumulated expected fun value for all players given a certain number of players ready to play and allocate players accordingly.

You can make this system more sophisticated by adjusting the expected fun formula in various ways:

  • Are there friends of the player playing in the current game (/ in a different game) that the player would like to keep (/ start) playing with?
  • Has the player specified a number of players with which they like playing the game most? (I.e. has the player defined a fun graph different from your generic one?)
  • Does the fun graph depend on the players' experience and skill level? For example, the game might be more fun for beginners if there are only a couple of other players around, whereas more experienced players might want to have lots of other players around.
  • Does the fun graph depend on the map?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .