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

Improve matchmaker info message #954

Merged
merged 1 commit into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions server/ladder_service/ladder_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,28 +416,17 @@ def write_rating_progress(self, player: Player, rating_type: str) -> None:
"command": "notice",
"style": "info",
"text": (
"<i>Welcome to the matchmaker</i><br><br><b>Until "
"you've played enough games for the system to learn "
"your skill level, you'll be matched randomly.</b><br>"
"<i>Welcome to the matchmaker</i><br><br><b>The "
"matchmaking system needs to calibrate your skill level; "
"your first few games may be more imbalanced as the "
"system attempts to learn your capability as a player."
"</b><br><b>"
"Afterwards, you'll be more reliably matched up with "
"people of your skill level: so don't worry if your "
"first few games are uneven. This will improve as you "
"play!</b>"
)
})
elif deviation > 250:
progress = (500.0 - deviation) / 2.5
player.write_message({
"command": "notice",
"style": "info",
"text": (
"The matchmaking system is calibrating your skill level; "
"your first few games may be slightly more imbalanced "
"as the system attempts to learn your capability as a player."
"<br><br>"
f"<b>The learning phase is {progress:.0f}% completed</b>"
)
})

def on_match_found(
self,
Expand Down
28 changes: 6 additions & 22 deletions tests/unit_tests/test_ladder_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,11 @@ async def test_write_rating_progress_message(
"command": "notice",
"style": "info",
"text": (
"<i>Welcome to the matchmaker</i><br><br><b>Until "
"you've played enough games for the system to learn "
"your skill level, you'll be matched randomly.</b><br>"
"<i>Welcome to the matchmaker</i><br><br><b>The "
"matchmaking system needs to calibrate your skill level; "
"your first few games may be more imbalanced as the "
"system attempts to learn your capability as a player."
"</b><br><b>"
"Afterwards, you'll be more reliably matched up with "
"people of your skill level: so don't worry if your "
"first few games are uneven. This will improve as you "
Expand All @@ -1055,21 +1057,6 @@ async def test_write_rating_progress_message(
})


async def test_write_rating_progress_message_2(
ladder_service: LadderService,
player_factory
):
player = player_factory(ladder_rating=(1500, 400.1235))
player.write_message = mock.Mock()

ladder_service.write_rating_progress(player, RatingType.LADDER_1V1)

player.write_message.assert_called_once()
assert player.write_message.call_args[0][0].get("command") == "notice"
assert player.write_message.call_args[0][0].get("style") == "info"
assert "40%" in player.write_message.call_args[0][0].get("text", "")


async def test_write_rating_progress_other_rating(
ladder_service: LadderService,
player_factory
Expand All @@ -1084,7 +1071,4 @@ async def test_write_rating_progress_other_rating(
# and global is an available rating that's not ladder
ladder_service.write_rating_progress(player, RatingType.GLOBAL)

player.write_message.assert_called_once()
assert player.write_message.call_args[0][0].get("command") == "notice"
assert player.write_message.call_args[0][0].get("style") == "info"
assert "40%" in player.write_message.call_args[0][0].get("text", "")
player.write_message.assert_not_called()