-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add outcome override for ladder 1v1 games #669
Add outcome override for ladder 1v1 games #669
Conversation
@@ -34,3 +36,18 @@ def get_army_score(self, army: int) -> int: | |||
as 1 for win and 0 for anything else. | |||
""" | |||
return self._results.victory_only_score(army) | |||
|
|||
def _outcome_override_hook(self) -> Optional[List[GameOutcome]]: | |||
if not config.LADDER_1V1_OUTCOME_OVERRIDE or len(self.players) > 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking the player count isn't actually necessary since max_players
is set to two, but with tmm coming up I wanted to be sure, if it adapts this class.
return None | ||
team_sets = self.get_team_sets() | ||
army_scores = [ | ||
self._results.score(self.get_player_option(team_set.pop().id, "Army")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use self.get_army_score(...)
, since that was overridden to use the reported result instead.
I thought the better way was
self._results.score(self.get_player_option(team_set.pop().id, "Army")) | |
super().get_army_score(self.get_player_option(team_set.pop().id, "Army")) |
but for some reason the super()
call fails, saying that the types aren't related?
super(type, obj): obj must be an instance or subtype of type
Forcing it's hand with super(Game, self)
says that it has no method get_army_score
, I was very confused and still don't know what was going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the right way to explicitly call it would be super(LadderGame, self)
, the docstring for super says:
super() -> same as super(__class__, <first argument>)
But I'm not gonna worry about investigating it right now :P
Ok, I managed to run some test games. Here is the log for a game where I left early and the other player stayed until the end:
My client incorrectly reported that my opponent was defeated, but the game was still rated correctly because my opponent reported that he won. It is still possible to have games incorrectly count as draws if the winner of the game also leaves early, since the victory result doesn't get reported until a few seconds after one player looses. But there's nothing we can do about that on the server side. |
return None | ||
team_sets = self.get_team_sets() | ||
army_scores = [ | ||
self._results.score(self.get_player_option(team_set.pop().id, "Army")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the right way to explicitly call it would be super(LadderGame, self)
, the docstring for super says:
super() -> same as super(__class__, <first argument>)
But I'm not gonna worry about investigating it right now :P
Gives the possibility to decide the outcome of 1v1 ladder games by score instead of by reported result, as it was a year ago.
I added a config variable, so that this can be turned on and off dynamically (e.g. for testing new game patches on the test server).
I hope that the game still reports scores as it did and that that didn't change with recent patches?
Could make this override for all 1v1 games, but I thought I'd rather have as little scope as possible.
Addresses issue #580 but should be regarded a temporary fix.