s2protocol icon indicating copy to clipboard operation
s2protocol copied to clipboard

Client API endpoint /game - more player information

Open amartin916 opened this issue 8 years ago • 4 comments

In the SC2 Client API the end point for /game currently returns

{ "isReplay":false, "displayTime":100.0, "players":[ { "id":1, "name":"AccountName", "type":"user", "race":"Zerg", "result":"Defeat" }, { "id":2, "name":"Player 2", "type":"computer", "race":"random", "result":"Victory" } ] }

What would be useful is to add in some more information into the players object.

Needed Additions: Character id, Realm Id

Possible Additions: Server MMR (before and after game ends values ?)

amartin916 avatar Jul 17 '17 16:07 amartin916

Character ID and Realm ID already exists and together they're form in something called "toon". You can extract player's toon this way:

for player in protocol.decode_replay_details(archive.read_file('replay.details'))["m_playerList"]:
        toon = "{}-S2-{}-{}".format(player["m_toon"]["m_region"], player["m_toon"]["m_realm"], player["m_toon"]["m_id"])

Which forms a toon looking this way: 2-S2-1-6540480

MMR already exists and you can extract it this way:

for player in protocol.decode_replay_initdata(archive.read_file('replay.initData')["m_syncLobbyState"]["m_userInitialData"]:
        MMR = player["m_scaledRating"]

But I do agree that it would be cool if MMR change after the game will be added as well.

ghost avatar Jul 18 '17 08:07 ghost

Sorry guess I was not 100% clear. I know the replay files has all this info what i'm talking about is the localhost REST API that is built into the SC2 client. https://us.battle.net/forums/en/sc2/topic/20748195420

@jrepp is just awesome and was kind of hoping he could sneak a fix in for it :)

amartin916 avatar Jul 18 '17 12:07 amartin916

Ok, now I completely understood the question. I believe this won't be implemented, because I believe it could be considered as cheat.

Because imagine the player knows your toon and mmr before match starts, with the statistics gathered from rankedftw or from battle.net api? I believe it will be easier to implement the strategy against you, if you know what builds you performing.

But again - maybe I still don't understand the question.

ghost avatar Jul 18 '17 16:07 ghost

Btw both of the sites you listed have zero stats about build orders for a player. You are assuming that players play each other a lot on the ladder which is not true until GM. Players that play each other already know what builds they like. When I run up against I name I recognize its because they cheesed me or did something super unique.

Blizzard has already created the Client API, returning the players id and realm does not gain anyone a competitive edge nor does exposing the MMR.

MMR is the most useful, players id and realm open up more tools like rivalry tracker, stats against a given player, ext.

amartin916 avatar Jul 18 '17 16:07 amartin916