Arcana / node-dota2

A node-steam plugin for Dota 2.
MIT License
542 stars 191 forks source link

Grabbing match details while game is running #240

Closed jimmydorry closed 2 years ago

jimmydorry commented 8 years ago

If you are only after the basic stuff like heroID, matchID, who won... Then you just listen for the 'practiceLobbyUpdate' event which gives data in the form of: http://hastebin.com/enopuliric.json After the game ends, you use the webAPI to grab the full summary.

Otherwise, you are going to need to emulate the more advanced behaviour of joining the game. This library can't do that yet.

Another option is to parse the http://www.dota2.com/watch/ JSON... but someone in the game must be broadcasting.

The following two issues discuss the above. https://github.com/RJacksonm1/node-dota2/issues/223 https://github.com/RJacksonm1/node-dota2/issues/194

The feature request and discussion is for the above. This issue will stay open until we have a method for getting details of a match while it is running.

tomasmck commented 8 years ago

After the game ends, you use the webAPI to grab the full summary.

AFAIK this still isn't possible for practice / private matches?

Happy to be proven wrong!

jimmydorry commented 8 years ago

Not possible for private or practice matches, unfortunately.

andresrivero commented 8 years ago

I just wanted to comment here and be part of the party, since the above post was so "interesting".

P.S. I am working on a handler that can give information on private and practice matches.

Crazy-Duck commented 8 years ago

@andresrivero how are you going to go about it?

Apmats commented 8 years ago

Please do tell how you're trying to get that working, I'd love to get that sort of functionality.

Arm1stice commented 8 years ago

@Apmats Currently, there isn't even an API for that sort of thing

mnickkk commented 8 years ago

You're saying that it's impossible to grab the result of private (practice) lobby. Looking into related issue #223 found information that even when sitting as a coach we still aren't counted as a player in that game, thus we can't grab the match result. Esportal guys however are able to grab the match results, and their matches aren't ticketed in Dota 2 Client (thus no webapi stuff). I wonder if "sitting as a coach still doesn't give you access to see the replay" is still true, cause their bots are doing exactly this. Will be able to check that 2morrow and post results (or if you already know the answer - I'd love to hear it from you).

Apmats commented 8 years ago

@mnickkk if it's just the result you're interested in you can always keep your bot in the lobby and listen to the lobby updates and get the result from those.

mburst commented 8 years ago

Sorry if this is a n00b question but I'm curious how the protobuf methods are generated? It seems the realtime methods are missing request signatures since I can only find the response models. https://github.com/RJacksonm1/node-dota2/blob/master/proto/dota_gcmessages_common.proto#L1695 has a ton of data but no one seems to know how to generate a request to yield that data. Then there is https://github.com/RJacksonm1/node-dota2/blob/master/proto/dota_gcmessages_common.proto#L1872 which doesn't have a request method in the protobuf files but is accessible via https://api.steampowered.com/IDOTA2MatchStats_570/GetRealtimeStats/v1

Crazy-Duck commented 8 years ago

Protobuf is a messaging protocol that is used by valve for all communication between clients, GC, game servers, and internal comm between servers. The proto files contain ALL message types, also those that aren't triggered by the client. So those messages which are triggered by the client we can reproduce, the others we can't...

mburst commented 8 years ago

I'm curious where you're pulling the protobuf files from though. I can see hints of them in the client.dll but curious if you have an easier way of pulling them from the client.

Crazy-Duck commented 8 years ago

Check the repo, there's an update script. We pull them from a github.com repo from the guys who pull them from the game files and the steam client

Crazy-Duck commented 8 years ago

I've finally gotten a chance to look at some nethook traces of the client when you're checking out the watch tab. Conclusion: There's some messages to get top sourcetv games, top friend games etc... However, this evidently only returns the teams info, player names, lobby id's etc. The information about map position, kill-score, ... is not retrieved via protobuf messages. I presume the client connects to the steam server via different means, using the server id obtained via protobuf... :/

Crazy-Duck commented 7 years ago

We've made some progress on this in #362 Basically there's a "hidden" api on www.dota2.com with an endpoint to get the details you see in the watch tab. The endpoint takes the server_steam_id of the game and returns information about the players (kda, lh/denies, hero, position on the map, ...)