Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement live games page (with pro players) #1148

Open
mdfwn opened this issue Sep 3, 2017 · 29 comments · May be fixed by #1517
Open

Implement live games page (with pro players) #1148

mdfwn opened this issue Sep 3, 2017 · 29 comments · May be fixed by #1517
Assignees
Milestone

Comments

@mdfwn
Copy link

mdfwn commented Sep 3, 2017

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
Copy link
Member

howardchung commented Sep 3, 2017

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
Copy link
Author

mdfwn commented Sep 3, 2017

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
Copy link
Member

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
Copy link
Author

mdfwn commented Sep 3, 2017

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

@howardchung
Copy link
Member

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

@mdfwn
Copy link
Author

mdfwn commented Sep 3, 2017

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
Copy link
Member

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
Copy link
Author

mdfwn commented Sep 3, 2017

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
Copy link
Member

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
Copy link
Author

mdfwn commented Sep 4, 2017

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
Copy link
Member

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
Copy link
Author

mdfwn commented Sep 4, 2017

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
Copy link
Member

howardchung commented Sep 5, 2017

There'd be three main steps:

  • Add a new service that polls these endpoints, when it finds a match with a pro player on the list, write the data on that match to a data store (like Redis). This would be a standalone JS service in https://github.com/odota/core/tree/master/svc. This should be a pretty straightforward port of the logic in your existing Python script.

  • Add an API endpoint so the UI can access this data. This reads the data you stored earlier. Presumably it would take a player's account ID, and return an array of the recent matches they've participated in. That goes here: https://github.com/odota/core/blob/master/routes/spec.js

  • Add a page to the UI that reads the data from your new endpoint and displays on it a web page. You'd add a new route to the React application here: https://github.com/odota/ui and the result would be a new page e.g. https://www.opendota.com/live

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 howardchung added this to the Backlog milestone Sep 23, 2017
@howardchung
Copy link
Member

howardchung commented Oct 9, 2017

Implemented the data endpoint in:
odota/core#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

@howardchung howardchung changed the title Display high mmr games and tracking pro players? (basically what dota2tvpro.com tries to do) Implement live games page (with pro players) Nov 23, 2017
@howardchung howardchung modified the milestones: Backlog, 2018-2 Feb 25, 2018
@howardchung howardchung modified the milestones: 2018-2, 2018-3 Mar 9, 2018
@howardchung howardchung modified the milestones: 2018-3, 2018-04 Mar 24, 2018
@howardchung howardchung self-assigned this Mar 29, 2018
@howardchung howardchung linked a pull request Apr 7, 2018 that will close this issue
@howardchung howardchung modified the milestones: 2018-04, 2018-05 Apr 29, 2018
@howardchung howardchung modified the milestones: 2018-05, 2018-06 Jun 5, 2018
@howardchung howardchung modified the milestones: 2018-06, Backlog Jul 25, 2018
@evillman
Copy link

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

@howardchung
Copy link
Member

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
Copy link

HouPoc commented Apr 9, 2019

@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
Copy link
Member

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
Copy link
Member

see #1517

@HouPoc
Copy link

HouPoc commented Apr 9, 2019

Cool!

@HouPoc
Copy link

HouPoc commented Apr 9, 2019

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
Copy link
Member

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

@HouPoc
Copy link

HouPoc commented Apr 9, 2019

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
Copy link

HouPoc commented Apr 9, 2019

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
Copy link

HouPoc commented Apr 9, 2019

It works like trackdota.com.

@howardchung
Copy link
Member

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
Copy link

HouPoc commented Apr 9, 2019

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
Copy link

HouPoc commented Apr 9, 2019

I did enjoy doing it..

@howardchung
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants