RiotGames / developer-relations

Riot Games Developer Ecosystem Bug Reporting
http://developer.riotgames.com
746 stars 44 forks source link

[Feature Request] [LoL] Unify the Livestats esports feed API and Live Client Data API #260

Closed hanscauwenbergh closed 10 months ago

hanscauwenbergh commented 4 years ago

Currently there's two separate APIs out there for live data: one for esports games and one for all the rest. This is a request to combine both efforts into a single system.

Livestats esports feed API

Current

The Livestats esports feed API can be found on https://feed.lolesports.com/livestats/v1/details/{gameID} and is used to power live stats shown on https://watch.lolesports.com. This API is not documented but the format and available data points can be seen here:

{
    "participantId": 3,
    "level": 5,
    "kills": 0,
    "deaths": 1,
    "assists": 0,
    "totalGoldEarned": 1868,
    "creepScore": 40,
    "killParticipation": 0.0,
    "championDamageShare": 0.25987407220305614,
    "wardsPlaced": 3,
    "wardsDestroyed": 0,
    "attackDamage": 62,
    "abilityPower": 50,
    "criticalChance": 0.0,
    "attackSpeed": 106,
    "lifeSteal": 0,
    "armor": 41,
    "magicResistance": 31,
    "tenacity": 0.0,
    "items": [
        3340,
        1056,
        1056
    ],
    "perkMetadata": {
        "styleId": 8100,
        "subStyleId": 8200,
        "perks": [
            8112,
            8139,
            8120,
            8135,
            8226,
            8210,
            5008,
            5008,
            5002
        ]
    },
    "abilities": [
        "Q",
        "E",
        "W",
        "Q",
        "Q"
    ]
}

Deprecated

Before this API, a Websocket connection was used instead, also undocumented and with yet another format but also with way more data points available:

{
  "1002380485": {
    "teamStats": {
      "100": {
        "teamId": 100,
        "baronsKilled": 1,
        "dragonsKilled": 0,
        "firstBlood": false,
        "towersKilled": 5,
        "inhibitorsKilled": 1,
        "matchVictory": 0,
        "matchDefeat": 1,
        "color": "blue"
      },
      "200": {
        "teamId": 200,
        "baronsKilled": 0,
        "dragonsKilled": 3,
        "firstBlood": true,
        "towersKilled": 10,
        "inhibitorsKilled": 1,
        "matchVictory": 1,
        "matchDefeat": 0,
        "color": "red"
      }
    },
    "playerStats": {
      "1": {
        "participantId": 1,
        "teamId": 100,
        "summonerName": "C9 Impact",
        "championName": "Maokai",
        "championId": 57,
        "skinIndex": 6,
        "profileIconId": 3081,
        "summonersSpell1": 4,
        "summonersSpell2": 12,
        "kills": 2,
        "deaths": 2,
        "assists": 5,
        "doubleKills": 0,
        "tripleKills": 0,
        "quadraKills": 0,
        "pentaKills": 0,
        "level": 18,
        "maxHealth": 3496,
        "maxPower": 1408,           // mana/energy
        "attackDamage": 129,
        "abilityPower": 15,
        "armor": 283,
        "magicResist": 148,
        "attackSpeed": 151,
        "ccReduction": 14,
        "movementSpeed": 380,
        "spellVamp": 0,
        "lifesteal": 0,
        "armorPen": 0,
        "magicPen": 0,
        "armorPenPercent": 0,
        "magicPenPercent": 0,
        "healthRegen": 167,
        "powerRegen": 34,            // mana/energy regen
        "wardsPlaced": 17,
        "wardsKilled": 4,
        "runes": [
          {
            "runeId": 5247,
            "count": 9
          },
          {
            "runeId": 5287,
            "count": 9
          },
          {
            "runeId": 5316,
            "count": 9
          },
          {
            "runeId": 5347,
            "count": 1
          },
          {
            "runeId": 5351,
            "count": 2
          }
        ],
        "masteries": [
          {
            "masteryId": 6114,
            "rank": 5
          },
          {
            "masteryId": 6122,
            "rank": 1
          },
          {
            "masteryId": 6134,
            "rank": 5
          },
          {
            "masteryId": 6143,
            "rank": 1
          },
          {
            "masteryId": 6211,
            "rank": 5
          },
          {
            "masteryId": 6223,
            "rank": 1
          },
          {
            "masteryId": 6231,
            "rank": 5
          },
          {
            "masteryId": 6241,
            "rank": 1
          },
          {
            "masteryId": 6251,
            "rank": 5
          },
          {
            "masteryId": 6262,
            "rank": 1
          }
        ],
        "items": [
          1029,
          1082,
          3047,
          3065,
          3076,
          3109,
          3193,
          3340,
          3800
        ],
        "skills": {
          "1": 1,
          "2": 3,
          "3": 2,
          "4": 1,
          "5": 1,
          "6": 4,
          "7": 1,
          "8": 2,
          "9": 1,
          "10": 2,
          "11": 4,
          "12": 2,
          "13": 2,
          "14": 3,
          "15": 3,
          "16": 4,
          "17": 3,
          "18": 3
        },
        "mk": 296,                   // creep score / minions (also jungle) killed
        "cg": 751,                   // current gold
        "tg": 13405,                  // (total) gold earned
        "xp": 18462,                  // experience points
        "x": 5634,                    // location
        "y": 3662,                    // location
        "h": 3496,                    // health
        "p": 765,                     // mana / energy
        "td": 183866,                 // Total Damage Dealt
        "pd": 32589,                  // Physical Damage Dealt
        "md": 151122,                 // Magic Damage Dealt
        "trd": 154,                   // True Damage Dealt
        "tdc": 16673,                 // Total Damage to Champions
        "pdc": 2113,                  // Physical Damage to Champions
        "mdc": 14405,                 // Magic Damage to Champions
        "trdc": 154,                  // True Damage Dealt to Champions
        "playerId": "45"
      }
  }
}

Live Client Data API

The Live Client Data API is available while playing/spectating games through the client. The format and available data points is well documented here. This is the first live API I see which contains very valuable event based information. However some interesting statistics are only available for a single player (activePlayer).

Proposed Solution

I'm not aware of the specifics around how both APIs are implemented but there definitely seems to be a lot of overlap. Combining the two systems might result in a lowered maintenance, higher consistency and giving the third-party developer community high quality, more extensive data. Both APIs currently have unique advantages over one another (more data points, event based information, ...). Unifying both, their feature sets could be combined. The same live data points could be given for all players in spectator mode only and even the additional data points that were included in the deprecated Livestats esports Websocket could potentially be reintroduced.

In my opinion, having such detailed live statistics at your disposal would open up a lot of opportunities, one being live dashboards like https://analyst.lol/ (full disclosure: I'm the creator of this one 🙂).

Thanks for considering!

tisbells commented 10 months ago

Closing out old issues - DevRel doesn't own the esports or client APIs. This is a cool idea but these are separate services and it is very unlikely they would be able to be combined onto a single platform.