D
D
dulingleb2022-04-03 22:14:57
Game development
dulingleb, 2022-04-03 22:14:57

How to properly implement matchmaking for multiplayer?

I would like to ask how to properly create a player search system for a 5x5 lobby, following the example of CS:GO, faceit, Dota 2. To take into account the rating of players (weak with weak, strong with strong based on previous games). If possible using Laravel as an example.

What I could come up with is that when a player presses "search", they are added to the game's search table (approx. Searching) and the table is checked to see if there are players with a similar rating. And when 10 players are recruited with the appropriate rating, then I send a response to everyone with a web socket and already there I create a lobby in another table. But I'm not sure that this is the right option, from the point of view of optimization.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dollar, 2022-04-03
@dollar

I think you need to google something like: matchmaking algorithm
By the way, I hope you know English well.
I recommend sharing:

  1. Matchmaking logic
  2. Concrete algorithm (optimization of this logic)
  3. Implementation on specific programming languages ​​and databases

These are all different questions. And they should be addressed to different experts, not 3 in 1. A PL expert may not be good at game design and vice versa.
As for the first one (recruiting logic), the most subtle point is the definition of "weak" and "strong" players, and on what scale their strength is measured. This has more to do with game design, where the goal is to make the game interesting. The following points are already related to something else - to speed (not to be confused with the waiting time for a player when searching for a group), the cheapness of a solution, the fight against cheaters, etc.

V
vilinyh, 2022-04-03
@vilinyh

- take an array of players in the queue, sort it by rating,
- go through the array in ascending order of rating, trying to collect a lobby of the required size from nearby players, in which the difference between the ratings of the weakest and the strongest does not exceed a given number (bracket),
- if the lobby fits the condition - take the players out of the queue, divide them into teams with a close average rating,
- if the array is over - wait for new players to appear in the queue, after the appearance, go to the first step,
- if the queue hangs too long, increase the bracket, giving the opportunity to play along with a larger ranking difference.
Example:

team_size = 3
max_bracket = 250
pool = {Player1: 100, Player2: 200, Player3: 450, Player4: 460, Player5: 600}

# берем первых трех игроков:
{Player1: 100, Player2: 200, Player3: 450} # разница min/max = 350 > 250, не подходит

# сдвигаемся на одного, берем следующую тройку:
{Player2: 200, Player3: 450, Player4: 460} # разница min/max = 260 > 250, не подходит

# сдвигаемся еще на одного, берем следующую тройку:
{Player3: 450, Player4: 460, Player5: 600} # разница min/max = 150 < 250, команда подобрана

# убираем игроков из пула:
pool = {Player1: 100, Player2: 200}

# ждем появления новых игроков...

T
ThunderCat, 2022-04-03
@ThunderCat

The task is more on logic and basic algorithms, nothing fantastic...

when the player presses "search",
We check whether there are understaffed teams, and if there is, whether the average team rating +- error satisfies the player's rating. If there are no teams, we create a new one, write a player there, (average) rating, and wait for filling. All.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question