Guides

Streak bonuses

A pool can give extra rating for win streaks, and take extra away for lose streaks. A bonus is added on top of the rating change the pool's rating system works out, after it has rated the match. It can be a fixed amount, or a multiple of that change. It works with Elo and Glicko-2.

Set bonuses

They go in the pool's mmrConfig, under bonuses, when you create the pool or later:

curl -X POST https://api.inhouseranks.com/v1/pool/update \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "poolId": "6b01eb7991a8d0c2e72af6c5",
    "mmrConfig": {
      "kind": "elo",
      "initialMmr": 1500,
      "bonuses": [
        { "kind": "winStreak", "mmr": 5, "minStreak": 3, "maxStreak": 4 },
        { "kind": "winStreak", "mmr": 10, "minStreak": 5 },
        {
          "kind": "loseStreak",
          "mmrMultiplier": 1.5,
          "minStreak": 3,
          "tiesBreakStreaks": false
        }
      ]
    }
  }'

mmrConfig replaces the pool's whole rating config. Send all of it.

With these settings, a player's third and fourth wins in a row each add 5 on top of the usual gain, and every win after that adds 10 until the streak ends. From the third loss in a row, each loss costs one and a half times what it normally would, and ties don't interrupt that count.

Field Meaning
kind winStreak or loseStreak.
mmr A fixed amount of rating, added as written. A negative value takes rating away: -5 on a loseStreak bonus costs 5 more per loss, while 5 would soften each loss by 5.
mmrMultiplier Multiplies the rating change the match gave, in place of mmr. 1.5 makes a win gain, or a loss cost, half as much again. 0.5 halves it, and 0 cancels it. It must be 0 or more.
streak Pay only on a streak of exactly this length.
minStreak, maxStreak Pay on streaks from minStreak to maxStreak, both included. Leave either out for no limit on that side.
tiesBreakStreaks Whether a tie ends the streak this bonus counts. true (the default): win, win, tie, win is a 1-win streak. false: a tie neither ends nor extends it, so the same run is a 3-win streak.

Rules for the list:

  • Each bonus sets mmr or mmrMultiplier, not both.
  • Each bonus sets streak, or minStreak and/or maxStreak, not both. Lengths are 1 or more.
  • Ranges can overlap. The first bonus in the list that fits pays, and only that one, so put the more specific bonuses first.
  • At most 50 bonuses. A list that breaks a rule is refused with 400 Validation failed.
  • A match is rated with the settings it was created with, like the rest of mmrConfig.

How streaks count

  • The streak includes the match being rated. A player who has won twice in a row and wins again is on a 3-win streak, so a bonus for streak 3 pays on that match.
  • A win bonus pays only on a win, and a lose bonus only on a loss. A tie never pays. In a free-for-all, sole first place is a win, a shared first place is a tie, and every other place is a loss.
  • Unranked matches don't count. They pay nothing and leave the streak where it was.
  • Each rating has its own streak. A match played in a position moves the player's overall rating and that position's rating, and each is paid only when its own streak fits: currentStreak, or streakIgnoringTies for a bonus with tiesBreakStreaks: false, on its stats block.
  • A rating in a rating window gets no bonus, including on the match that closes the window. Its streak still counts, so the first match after the window can pay.

What a match records

Each player's mmrChanges entry has the bonus the match paid on that rating, and after includes it. Here Alice wins her third match in a row against Bob, who loses his third. Alice gets the fixed 5. Bob's loss is multiplied by 1.5, and his mmr is the extra rating that cost him:

{
  "matchPlayers": [
    {
      "mmrEntityId": "6b01eb7991a8d0c2e72af6c8",
      "mmrChanges": [
        {
          "positionId": null,
          "multiplier": null,
          "advantage": null,
          "before": 1530.5304984710244,
          "after": 1548.6660950559597,
          "bonus": {
            "kind": "winStreak",
            "streak": 3,
            "mmr": 5,
            "mmrMultiplier": null
          }
        }
      ],
      "outcome": "win"
      // ...
    },
    {
      "mmrEntityId": "6b01eb7991a8d0c2e72af6c9",
      "mmrChanges": [
        {
          "positionId": null,
          "multiplier": null,
          "advantage": null,
          "before": 1467.6531892200974,
          "after": 1445.486869983019,
          "bonus": {
            "kind": "loseStreak",
            "streak": 3,
            "mmr": -7.388773079026123,
            "mmrMultiplier": 1.5
          }
        }
      ],
      "outcome": "lose"
      // ...
    }
  ]
  // ...
}

bonus is null when a match pays none. Its mmr is always the rating the bonus added, whichever kind of bonus it was, and mmrMultiplier is the multiplier used, or null for a fixed bonus. To show something like "+5 streak bonus" in your game, read it from here. The match's own team results (match.result.teams[].calculations) never include bonuses.