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

Issue/#730 ignore score results #731

Merged

Conversation

Askaholic
Copy link
Collaborator

The score results that the game sends to report ACU kills are messing with the legacy rating code for ladder. This allows people to kill their opponent with a ctrl-k and still receive a win instead of a draw. Strangely, because of when results are written, it seems that the outcomes recorded in the game_player_stats table are still correct. At least that's what happened in my integration test: the results were determined correctly by the new rating code and those got written to the gps table, then the outcome override triggers and causes the rating code to use different results.

I went ahead and refactored the GameOutcome enum into 3 separate enums:

  1. ArmyReportedOutcome - the outcome for an army as reported by FA.
  2. ArmyOutcome - the outcome for an army after the reported outcomes have been resolved.
  3. GameOutcome - the outcome for a team based on the resolved army outcomes.

This helps prevent us from skipping steps in the rating process and also prevents clients from explicitly reporting "unknown" or "conflicting" in their result string (this would have been previously allowed).

Closes #730

We can now distinguish between results in their various stages:
1. Results reported by an individual for a specific army
2. Accepted result for an army based on the individual reports
3. Accepted result for the whole team based on the accepted army results

For instance, it doesn't make sense for a player's game to report the 
status
of a particular result as "conflicting" since conflicts only arise when
multiple players report different results for the same army. The Enum's 
now
reflect that, and you can no longer report a "conflicting" or "unknown"
result directly (as you could have before).

As a consequence, any result string that is not present in the
ArmyReportedOutcome will be ignored. Hence, the ACU kills reported via 
"score"
results will no longer affect the army score calculation (previously 
these
could turn a -10 score from a defeat into a positive number if the 
player got
any acu kills).
@Askaholic Askaholic force-pushed the issue/#730-ignore-score-results branch from 90a31a7 to 20cadcc Compare March 5, 2021 02:53
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #731 (63d8c0a) into develop (9801ef7) will decrease coverage by 0.00%.
The diff coverage is 96.96%.

Impacted Files Coverage Δ
server/games/game.py 95.35% <80.00%> (+0.01%) ⬆️
server/games/game_results.py 98.50% <98.14%> (-0.59%) ⬇️
server/games/ladder_game.py 96.77% <100.00%> (+0.10%) ⬆️
server/stats/game_stats_service.py 98.29% <100.00%> (ø)

@Askaholic
Copy link
Collaborator Author

Ok I did some testing, and it looks like the "Draw Bug" is actually worse than just the score reports interfering with the rating code. It turns out that the person who ctrl-k's doesn't even get a result reported for them at all, by either client. So in the end all the server sees is that one player was defeated, and the other has unknown status. In which case we currently just assume victory for the unknown result.

Here's an example ladder game where my opponent ctrl-k'd me with his commander. You can see that no result was reported for him (army 2) other than the "score":

TRACE    Mar 05  21:56:54 LobbyConnection                << Wainan: {'command': 'EnforceRating', 'args': [], 'target': 'game'}
TRACE    Mar 05  21:56:54 LobbyConnection                << Wainan: {'command': 'GameResult', 'args': [2, 'score 1'], 'target': 'game'}
DEBUG    Mar 05  21:56:54 LadderGame.13757367            Ignoring result reported by 388953 for army 2: score 1
TRACE    Mar 05  21:56:54 LobbyConnection                << Askaholic: {'command': 'EnforceRating', 'args': [], 'target': 'game'}
TRACE    Mar 05  21:56:54 LobbyConnection                << Askaholic: {'command': 'GameResult', 'args': [2, 'score 1'], 'target': 'game'}
DEBUG    Mar 05  21:56:54 LadderGame.13757367            Ignoring result reported by 166198 for army 2: score 1
TRACE    Mar 05  21:56:55 LobbyConnection                << Askaholic: {'command': 'pong'}
TRACE    Mar 05  21:56:57 LobbyConnection                << Askaholic: {'command': 'ping'}
TRACE    Mar 05  21:56:57 LobbyConnection                >> Askaholic: {'command': 'pong'}
TRACE    Mar 05  21:56:58 LobbyConnection                << Askaholic: {'command': 'GameResult', 'args': [1, 'defeat -10'], 'target': 'game'}
INFO     Mar 05  21:56:58 LadderGame.13757367            166198 reported result for army 1: defeat -10
TRACE    Mar 05  21:56:59 LobbyConnection                << Wainan: {'command': 'ping'}
TRACE    Mar 05  21:56:59 LobbyConnection                >> Wainan: {'command': 'pong'}
TRACE    Mar 05  21:57:02 LobbyConnection                << Wainan: {'command': 'GameEnded', 'args': [], 'target': 'game'}
TRACE    Mar 05  21:57:02 LobbyConnection                << Askaholic: {'command': 'GameEnded', 'args': [], 'target': 'game'}

However, it does seem like the scores are reported in custom 1v1's, but still not by the player who ctrl-k's. Here's a custom 1v1 where I ctrl-k'd my opponent:

TRACE    Mar 05  21:32:59 LobbyConnection                << Wainan: {'command': 'GameResult', 'args': [1, 'defeat -10'], 'target': 'game'}
INFO     Mar 05  21:32:59 CustomGame.13757365            388953 reported result for army 1: defeat -10
TRACE    Mar 05  21:32:59 LobbyConnection                << Wainan: {'command': 'GameResult', 'args': [2, 'defeat -10'], 'target': 'game'}
INFO     Mar 05  21:32:59 CustomGame.13757365            388953 reported result for army 2: defeat -10
TRACE    Mar 05  21:33:00 LobbyConnection                << Askaholic: {'command': 'EnforceRating', 'args': [], 'target': 'game'}
TRACE    Mar 05  21:33:00 LobbyConnection                << Askaholic: {'command': 'GameResult', 'args': [1, 'score 1'], 'target': 'game'}
DEBUG    Mar 05  21:33:00 CustomGame.13757365            Ignoring result reported by 166198 for army 1: score 1
TRACE    Mar 05  21:33:00 LobbyConnection                << Wainan: {'command': 'GameEnded', 'args': [], 'target': 'game'}
<...snip achievement reporting...>
TRACE    Mar 05  21:33:00 LobbyConnection                << Askaholic: {'command': 'GameEnded', 'args': [], 'target': 'game'}

@Askaholic Askaholic merged commit 4ff6d60 into FAForever:develop Mar 6, 2021
@Askaholic Askaholic deleted the issue/#730-ignore-score-results branch March 6, 2021 07:38
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.

Ignore "score" results
1 participant