KeyHunt: Unfair scoring when key is destroyed when playing with 4 teams
Version: 0.8.2
When a player “destroys” a key (e.g. by falling with the key into the endless pit), the team will “lose” the round which triggers a message and awards all other teams a couple of points. However, when you play with 4 teams, the awarded score is unfair.
How to reproduce
- Play KeyHunt with 4 teams on the map “Implosion”
- Have 4 total players, 3 of which should be passive (so they don't screw up your scoreboard while testing)
- The score should be 0 for everything. If not: Restart!
- Wait for the first round to start then one player walks into the abyss to lose the key
- Look on the scoreboard again
This should trigger the “destroy” conditon. The team that lost the key into the abyss should “lose” the round. The 3 enemy teams are also awarded a couple of points. However, the score that the other teams receive does not make sense. Two teams get +17 points, while the third team only gets +16 points. The loser team gets no points (this is correct).
This is unfair. One team is getting one point less than the other teams for no fault of their own (just bad luck).
I also tested what happens when I play with different number of teams. These are the scores:
- For 2 teams: +50 for the other team (good)
- For 3 teams: +25 for the 2 other teams (good)
- For 4 teams: +17, +17 and +16 (BAD)
Analysis
First of all, I noticed that 17+17+16=50.
Second of all, it seems that the cvar g_balance_keyhunt_score_destroyed is the setting that sets the score that is awarded to the other teams, although indirectly. Apparently the awarded score is <value>/ <number of teams>-1.
- 2 teams: 50/(2-1)=50
- 3 teams: 50/(3-1)=25
- 4 teams: 50/(4-1)=16.66666666666666...
A non-natural number is the result when playing with 4 teams. Looks like the weird score could be the result of a rounding error.
Possible fix
Force the awarded score to be equal to all teams. If the division has a remainder, round to the nearest integer and use that value for all teams, even if the sum would no longer be equal to g_balance_keyhunt_score_destroyed.
For the default value of 50, this algorithm would imply the following scores:
- 2 teams: +50 for the other team (sum = 50)
- 3 teams: +25 for the 2 other teams (sum = 50)
- 4 teams: +17 for the 3 other teams (sum = 51)