Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match newbies randomly #492

Merged
merged 40 commits into from
Sep 12, 2019
Merged

Conversation

cleborys
Copy link
Member

@cleborys cleborys commented Sep 1, 2019

As suggested: match newbie players randomly if the stable marriage didn't match them.

Prefers to match two unmatched newbies with each other before matching with a "normal" player.

cleborys and others added 16 commits August 29, 2019 19:20
#1)

* Matchmaking graph only to include preferred match edges where the match is actually possible as determined by matches_with. _rank_partners still runs in O(n + SM_NUM_TO_RANK log n) but now requires O(n) space, with n the number of total searches.

* typo

* adjusting deviation and rating in test_rank_all unit test such that all matches become possible

* add test for rank_all not including unmatchable games

* Dostya test user in test_server_ban integration test now expected to be banned for 980 years, not 981

* tests on reasonable matchmaking thresholds

* determine base minimum threshold for acceptable matches as 80% of quality of a game against yourself

* increase new player threshold boundary

* test that matchmaker gives high quality games to plawers with low deviation and games of any quality to new players with uncertain rating

* adjust values for base rank_all test so that players are matchable

* unit test typos

* fixed preference order of test_rank_all
…yers and low-dev with low-dev if all share the same mean
Typos
@JaggedAppliance
Copy link

I'm delighted you're working on this

Copy link
Collaborator

@Askaholic Askaholic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, this will be great. We should try to get this out soon since FTX is reinstating some sort of ladder league system.

As I mentioned in one of the comments, I think there should be a heuristic for matching new players against non-new players to prevent them from getting matched against top pros. See issue #427 which was opened a while ago in regard to poor match quality for new players.

tests/unit_tests/test_matchmaker_queue.py Outdated Show resolved Hide resolved
tests/unit_tests/test_matchmaker_queue_algorithm.py Outdated Show resolved Hide resolved
tests/unit_tests/test_matchmaker_queue_algorithm.py Outdated Show resolved Hide resolved
tests/unit_tests/test_matchmaker_queue_algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
* rename 2500 rated player to top_player

* refactor matchmaker

* adapt tests to new interface for matchmaking policies

* add test that Random Matching produces symmetric outputs

* correct type annotations for MatchmakingPolicies .find methods

* test for matchmaker class

* remove __repr__ method of search
Copy link
Collaborator

@Askaholic Askaholic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAPF may be able to clean up some of the formatting automatically. Just be aware that sometimes it does weird things, so it's always good to double check what it did and make sure it actually looks ok.

server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
tests/unit_tests/test_matchmaker_queue.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
server/matchmaker/algorithm.py Outdated Show resolved Hide resolved
@cleborys
Copy link
Member Author

cleborys commented Sep 5, 2019

I'll give YAPF a try! Normally I use black and flake8, but I didn't want to impose their doctrine on all of the codebase... The YAPF approach of optimizing instead of only making it PEP compliant looks nice, too!

cleborys and others added 2 commits September 5, 2019 22:28
Co-Authored-By: Askaholic <askaholic907@gmail.com>
server/config.py Outdated Show resolved Hide resolved
@Askaholic
Copy link
Collaborator

Askaholic commented Sep 5, 2019

I haven't heard of black before. The only reason I started using YAPF was because it has a lot of configuration options and I hoped I would be able to configure it to do what I wanted, but that doesn't seem to be the case. What I was really looking for was a formatter that would actually be able to rewrite some of the code by for example converting this:

d = dict(item1=value1, item2=value2)

into this

d = {
    "item1": value1,
    "item2": value2
}

But unfortunately yapf doesn't mess with the token stream. Looks like black does a few things like replacing string literals that use quotes with double quote versions (which I think would be super nice because I always find myself being indecisive over which type of quote to use) so I'll give it a shot.

@Askaholic Askaholic merged commit b04818f into FAForever:develop Sep 12, 2019
Brutus5000 pushed a commit that referenced this pull request Jan 27, 2020
* Fix players with high rating deviations not getting 1v1 ladder matches (#1)

* Matchmaking graph only to include preferred match edges where the match is actually possible as determined by matches_with. _rank_partners still runs in O(n + SM_NUM_TO_RANK log n) but now requires O(n) space, with n the number of total searches.

* typo

* adjusting deviation and rating in test_rank_all unit test such that all matches become possible

* add test for rank_all not including unmatchable games

* Dostya test user in test_server_ban integration test now expected to be banned for 980 years, not 981

* tests on reasonable matchmaking thresholds

* determine base minimum threshold for acceptable matches as 80% of quality of a game against yourself

* increase new player threshold boundary

* test that matchmaker gives high quality games to plawers with low deviation and games of any quality to new players with uncertain rating

* adjust values for base rank_all test so that players are matchable

* unit test typos

* fixed preference order of test_rank_all

* remove now irrelevant check whether match is acceptable in StableMarriage.find

* use filter in _rank_partners

* added test for whether high-dev players are matched with high-dev players and low-dev with low-dev if all share the same mean

* added sanity checks for game quality thresholds of two-player search parties

* remove mocker, loop fixtures from matchmaker_queue tests

* tests for identifying single newbies

* methods for identifying single newbies

* removed more mocker, loop fixtures

* make is_ladder_newbie (actually) static

* tests for forcefully matching newbies

* forcefully matching unmatched newbies after stable marriage

* Typos (#4)

Typos

* suggestions from code review

Co-Authored-By: Askaholic <askaholic907@gmail.com>

*  suggested changes from PR review

* tests for not forcefully matching singles with teams

* only matching with single searches

* typos

* will never force match players with rating above config.TOP_PLAYER_MIN_RATING = 2000

* rename 2500 rated player to top_player

* Refactor stable marriage (#5)

* rename 2500 rated player to top_player

* refactor matchmaker

* adapt tests to new interface for matchmaking policies

* add test that Random Matching produces symmetric outputs

* correct type annotations for MatchmakingPolicies .find methods

* test for matchmaker class

* remove __repr__ method of search

* refactor building the matchmaking graph for stable marriage

* package building the matchmaking graph into a class

* added logging to MatchingGraph

* removed print statement from tests

* style suggestions from code review

Co-Authored-By: Askaholic <askaholic907@gmail.com>

* yapf reformat on algorithm.py

* set forcematch rating cutoff default to 1600

* adapt test numbers to new forcematch default

* adapt tests to multiple ratings

* slight debug message improvement

* matchmaking policy logs invoking class, Matchmaker logs which algorithms are used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants