ValvePython / dota2

🐸 Python package for interacting with Dota 2 Game Coordinator
http://dota2.readthedocs.io
198 stars 32 forks source link

Could you tell us about game coordinator SourceTVGames? #64

Open morevsavva opened 3 years ago

morevsavva commented 3 years ago

Hi! We would like to know more about the match that has just started. We know the steam id of the player. Our player is not a high MMR, so there is no game with his steam id in the top list. We conducted a lot of experiments and were not able to find out how games get into TopSourceTVGame. For example, we encountered strange behavior when we tried to use request_top_source_tv_games by hero_id, as a result we found a custom game(Custom Hero Chaos), but there were none in TopSourceTVGame. We decided to compromise and create another account from which we send requests and add it as a friend to the accounts whose games we want to receive. Thus, the game appeared on the "watch" tab. Despite the fact that the documentation says that there are 10 users on the page, there were 11 of them together with a friend. Looking into the console, we made sure that 2 responses came(one with a size of 112 bytes, the other about 2000 bytes), then we added another friend and the size of the first response became 250 bytes, after which we made sure that 2 different requests came for friends and the usual SourceTV list. But at the same time, one request_top_source_tv_games still receives 1 response. Can you suggest how to find out the ID of the players at the beginning of the pick stage? image

rossengeorgiev commented 3 years ago

I have not looked into Dota 2 for a long time. Top games is based on match avg MMR, highest at the top. I think it also mixes in ongoing friend matches.

If you want to know if a player started a match, best to do with rich presence, which will update once the game has started. Player needs to be in your friend list

daveknippers commented 2 years ago

you can find the logic to do so here:

https://github.com/daveknippers/AghanimsWager/blob/main/DotaBet_GC.py

i'm using EMsg.ClientPersonaState to get the rich presence data to know when someone in the bot's friend list is in a game. and to get the lobby id of that game.

a list of lobby ids is iterated over in lobby_loop every 15 seconds. i'm sending a message with EMsgClientToGCFindTopSourceTVGames with that lobby id and listening for EMsgGCToClientFindTopSourceTVGamesResponse

if you only need to know when a player is in a match and what they've picked, you only need to use the rich presence data out of ClientPersonaState.

rossengeorgiev commented 2 years ago

hehe, that's a cool project

daveknippers commented 2 years ago

thanks! it was fun to write.

while i was working on it, it wasn't exactly clear how to go about querying for live information for specific games, so i hope sharing this will help people like op trying to solve this problem.