odota / web

React web interface for the OpenDota platform
https://www.opendota.com
MIT License
1.08k stars 392 forks source link

Implement live games page (with pro players) #1148

Open mdfwn opened 7 years ago

mdfwn commented 7 years ago

Hello, I'm the author of this thread: https://www.reddit.com/r/DotA2/comments/6xmvfq/i_built_my_own_version_of_dota2tvprocom_because/

tl;dr: dota2tvpro.com tracks high MMR games and games of dota 2 personalities, but the site is always down. I built my own logger using python (dota2api lib and Flask) but I don't know where to host it.

I just thought about collaborating with opendota. Do you think this could be a possible feature for opendota?

howardchung commented 7 years ago

My main concern is that circumventing Valve's "Expose Public Match Data" setting (which many pros disable) will lead to complaints and therefore Valve shutting down the APIs/access to replays.

Does your script just use the Steam web API? If so, it will not show players who have the setting disabled.

mdfwn commented 7 years ago

I thought about that concern as well, I guess it's another discussion whether Valve could or should do this.

But yes, my script is using the steam web API (https://api.steampowered.com/) and identifying pros who don't expose their match data currently works with a look-up table (pairs of pro names and account ids) that I extracted from a web-archive view of dota2tvpro.com (currently only ~60 names though).

Shutting down the API would be awful for the whole community, I personally don't think Valve would ever do this. However, I'm in no place to judge about this, so if you want to keep distance to this kind of feature that circumvents the "Expose Public Match Data" setting I can absolutely understand it and I will keep working on it independently of opendota.

howardchung commented 7 years ago

Doesn't the web API hide IDs of players who have the setting disabled by setting it to 2^32 - 1 (4.2 billion)?

mdfwn commented 7 years ago

No, it still provides account ids. You just can't use the player API to receive match history etc.

howardchung commented 7 years ago

Can you link an example match ID where this is the case?

mdfwn commented 7 years ago

I checked and you're partially right - GetMatchDetails does "hide" the real account id the way you explained it. GetTopLiveGame (the function that I use to retreive the games) however shows the real account id, example: https://api.steampowered.com/IDOTA2Match_570/GetTopLiveGame/v1/?key=API_KEY&partner=0 (please provide your own API Key here).

howardchung commented 7 years ago

Interesting. Well, since that's an official endpoint and it's not hiding the IDs I assume Valve is OK with it. I'd be open to accepting features utilizing that endpoint.

How complete is the coverage? Are there are some pros whose games don't get picked up by that endpoint?

mdfwn commented 7 years ago

I hope I understand your question correctly: yes, basically all players who are considered to be pros but are not part of my current look-up table are missing. As mentioned, I only included ~60 players so far which means that a lot of players - including the whole chinese scene and most of SEA - is still missing. However, I guess that's mostly a question of parsing different dota information sites for account ids of pro players, shouldn't be so hard to "complete" this.

howardchung commented 7 years ago

You can use this list that has about 1000 pro players and their IDs:

https://api.opendota.com/api/proPlayers

GetTopLiveGame doesn't appear to have the match ID as one of the fields. How are you planning to map the listed matches to the match ID?

mdfwn commented 7 years ago

Oh very convenient, thanks for this list!

GetTopLiveGame doesn't provide a match ID, but a steam_server_id. The steam_server_id is the parameter you can use for GetRealtimeStats (https://api.steampowered.com/IDOTA2MatchStats_570/GetRealtimeStats/v1) which provides you a match ID. Took me some time to find that out...

howardchung commented 7 years ago

Sounds good. Did you want to port your existing code to JavaScript and run it as a new service? You can store the resulting data in Redis since it doesn't need to be persisted forever (presumably you just need to list a pro player's recent matches, with links to the match summary page when it's done?)

mdfwn commented 7 years ago

I got contacted by someone who wants to help me with the project and the hosting. My short term goal is to get it up & running so everyone can use this kind of site again. It's currently written in Python and Flask/SQLAlchemy. My long term goal is working towards an integration into opendota - however, I have no clue yet how the opendota system is working and what time and effort it will take to port this (especially considering that I haven't written any Javascript in ~5 years).

howardchung commented 7 years ago

There'd be three main steps:

I don't think it would take that much time especially if you've got the logic worked out already. I can help with the porting as well

howardchung commented 6 years ago

Implemented the data endpoint in: https://github.com/odota/core/pull/1543

That's basically steps 1 and 2 listed above.

Once it's deployed anyone who's interested can start working on the UI

https://api.opendota.com/api/live

evillman commented 6 years ago

How do I add more pro players to this list? https://api.opendota.com/api/proPlayers

howardchung commented 6 years ago

The list is based on: http://www.dota2.com/webapi/IDOTA2Fantasy/GetProPlayerList/v001

You can mutate it by modifying: https://github.com/odota/core/blob/master/svc/proplayers.js

However if we want to add additional custom data we should find a better long term solution.

HouPoc commented 5 years ago

@howardchung are you still interested in the feature? I have a demo web app written in Angular + Node.js, and I'd like to share my codes with you. If possible, I want to integrate it to OpenDota.

howardchung commented 5 years ago

Sure! I did some work on this before but haven't shipped it. I wanted to have links open directly to that game in the Dota client, but it didn't work at the time.

howardchung commented 5 years ago

see https://github.com/odota/web/pull/1517

HouPoc commented 5 years ago

Cool!

HouPoc commented 5 years ago

I am not clear about this API steam://rungameid/570//watch_server ${game.server_steam_id}? What did you want to do with it?

howardchung commented 5 years ago

It doesn't work, but the idea is to have that link launch the Dota client and immediately start spectating that game.

HouPoc commented 5 years ago

How about we try this (https://api.steampowered.com/IDOTA2MatchStats_570/GetRealtimeStats/v1)? From this API, I got some data about the characters' position on minimap, networth, abilities, items, and etc. here is a sample: https://github.com/HouPoc/DOTA2_VisLive/blob/master/data.json

HouPoc commented 5 years ago

What I did was using minimap_icon to represent heroes and putting them on a div whose background is mini_map. Then, I updated those minimap_cion's positions in real-time to visualize the movements.

HouPoc commented 5 years ago

It works like trackdota.com.

howardchung commented 5 years ago

Yeah, that data currently isn't being sent down, but it could be (see the commented out code): https://github.com/odota/core/blob/master/svc/livegames.js

HouPoc commented 5 years ago

Yeah, that data currently isn't being sent down, but it could be (see the commented out code): https://github.com/odota/core/blob/master/svc/livegames.js Can we keep working on it?

HouPoc commented 5 years ago

I did enjoy doing it..

howardchung commented 5 years ago

Sure, feel free to make a PR there as well if you want to add the additional data