Matchmaking system

i need to make matchmaking system, that will work like this:

  1. When player click start in the menu in lobby, it will send request, that will contain 2 ints (tier and class) and his name.
  2. Game servers waiting for player will reconect there new players based on the request with this rules: (there are 2 teams)
  • when there is 1 (or more) conected (i will describe later) empty slot in both teams, it will let join any player with tier ±1 avearge tire (from lines, so it will be same when the line is 1 and 1 or 1 and none) and will put him to team with less players
  • when there is empty space only in one team (not mean, that the second team desnt have space, but means, that the other team have space, that is reserved like this (first num is tier, second class)
    team one team two
    1;1 none
    2;2 2;2
    3;2 3;2
    none 2;1

    this is not empty at both teams, because i cant pair 1;1 and 2;1) so in my example i let join 1;1 and 2;1, because i need them to pair
  • I can pair only same ranks and class 4 must be paired to class 4 and 1 to 1 so i can only permute 2 and 3
  1. when no server can let the player join, it will make new server for him

I DONT want code, I just need the logic how to do this

but if you want to give me code, why not
THX, for every reply to this quite big question

1 Like

Have you even searched or tried to do this yourself first before asking? There’s a whole article about matchmaking on the Developer Hub. There are also many threads regarding matchmaking here on the DevForum, whether it’s help creating or help debugging one.

ok, this i know too, but problem is
a) i need to share the join request between servers
b) i need to share 2 informations
using ordered data store was my 1st idea, but if i do it like this, there can be bug and i need to check class of every player with aceptble tire

For sharing information across servers, you can use MessagingService.

MessagingService exists for you to transfer data cross-server. I’m not sure what you mean by sharing two informations but you can probably file it in the same manner. OrderedDataStores are primarily for saving integer values and fetching them in a certain order to create things like leaderboards.

check link…

Sorry about that, I updated the link.

but the problem is, how to detect, that no server can accept him

I have an idea, when a player joins/removes it PublishAsyncs the current amount of players in the server.
Then when you SubscribeAsync, if it’s under enough players then let them join it.

This can also be done via DataStores the same way, but instead of you have a dictionary of servers and how many players they have - this is possibly a better method as long as you don’t throttle the datastores.

pls reread the topic, i need to use the parametrs there, so i cant get match team 1 = everyone tire 10 class 4 (range so best) vs team 2 everyone tire 1 class 2 (mele multiuse)

Then instead PublishAsync a dictionary showing how many players, Team1’s tier and Team2’s tier and compare them on SubscribeAsync.

MessagingService:PublishAsync("Info", {
    Amount = #game:GetService("Players"):GetPlayers(),
    Team1 = game:GetService("Teams").Team1:GetPlayers()[1].Tier, --However you read their Tier
    Team2 = game:GetService("Teams").Team2:GetPlayers()[1].Tier --However you read their Tier

You can also include other information in the dictionary, just remember the limits.

I have idea, that when i click play, I will send request and gaming server will reply, when it can accept me and it will send its players count, and i will join the fullest server. And if no replies occur in 10 sec, I will put him to new server.
Is this good solution?


Yep! That’s a great idea, I’d make it 20 seconds though just for laggy servers or MessagingService limits.