Closed BlackYps closed 3 years ago
A few things:
It seems to me like this algorithm is broken into 2 separate stages, create teams and then evaluate quality. Since our existing code is already structured like this, all you'd have to do is figure out the "create teams" step for 4v4 (or in general), and our existing algorithm will handle the "evaluate quality" step. Right now we have a special case for creating teams of 2 from parties of 1: https://github.com/FAForever/server/blob/31168aa6b34ba1b81db5831a66fce4b750aecdfe/server/matchmaker/algorithm.py#L289-L308
As well as a general way to handle any party size but without taking rating into account: https://github.com/FAForever/server/blob/31168aa6b34ba1b81db5831a66fce4b750aecdfe/server/matchmaker/algorithm.py#L408-L418
As for the algorithm you described, steps 2 and 3 won't work exactly as written. For instance in step 2 you could get a list of parties with sizes like [3, 3, 2]
and there would be no possible way to split those into even teams in step 3. If you can adapt your step 2 algorithm to create relatively balanced teams of 4, then you can simply ship those off to the existing matchmaker code and it will find appropriate matches between the teams.
The existing matchmaker code can be found here: https://github.com/FAForever/server/blob/31168aa6b34ba1b81db5831a66fce4b750aecdfe/server/matchmaker/algorithm.py#L142-L160 It's based on the stable marriage algorithm but modified for simple (undirected) graphs (since game quality is symmetric).
As I see it we have basically two options. First we could use the general structure of the existing code and generify the "team building" process. So it would look like this:
This would be rather fast to implement, but I see the potential issue that we could get games that are not really optimal. Alternatively we could do this:
This is incompatible with the stable marriage approach.
Does it make sense to implement the first algorithm first, to get a working 4v4 queue out fast and then maybe "upgrade" to the second one later? Or should we aim for the second one right away?
I talked to @BlackYps about how to proceed and we think that the current matchmaker code with the two stages of 1. constructing full-sized teams from parties and then 2. doing 1v1 matching on the full-sized teams is quite complicated and trying to fit his algorithm in that model would be very hacky. I'll make a suggestion for how to refactor the code so that the "queue" logic is separated from the "matchmaker" logic (right now part of the "building teams from buckets" happens in matchmaker_queue
) so that afterwards it would hopefully be easy to swap out the "matchmaker" parts.
I think it would also be helpful to experiment with different matchmaking algorithms and see how they score against each other, something that's probably better done offline. The only thing missing for that is good data for the input - ideally at every queue pop we would like to save a list of all searches present (their trueskill ratings should be enough) to then use as simulation input. I can't think of a good way to achieve this. It's a bit too much data to simply log out (?!), it seems quite annoying (but I think it's possible) to reconstruct from existing log data, it seems overkill to write this to the database. Of these reconstructing from existing log data is maybe the best option for now but I think logs are still hard to obtain, especially if we want lot of data? If graphana was an option then I think that would be ideal, but I'm not yet convinced that we can send this data to graphana in an appropriate format.
Let me know if you have suggestions :)
The planned 4v4 TMM queue needs an algorithm that can match parties of different sizes to create complete teams. here is an outline how that algorithm could work:
I would assign myself for this, but I am missing the rights in this repo