Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

Dota 2 Match History WebAPI

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    Originally posted by papa_pointnet View Post
    I'm pretty sure he is writing them by hand, just look at his APM, this guy is FLASH! Damned Tharuler!
    Joke apart, if he was really parsing replays, why would he limit his display to the same thing as the game?
    I'm almost certain that he figured out how the Dota2 client retrieves the data from the Valve servers directly, via UDP. I started down this path myself briefly but stopped, because why reinvent the wheel?

    Originally posted by Tharuler View Post
    In fact, I call up Zoid every morning and he gives me all the hero stats and top 50 list, and I punch them into my little table.
    lol, this made my day!

    Comment


    • #77
      Originally posted by walkingcarpet View Post
      Is there one for in game items? (not cosmetics)

      I tried changing /GetHeroes/ to /GetItems/ but it failed.
      Nope.

      (We could definitely use one though).
      // Economy
      "NotTheStringsYoureLookingFor"

      Comment


      • #78
        Originally posted by Tharuler View Post
        If you're convinced you need to loop over every match everytime, then who am I to stop you?
        I'm looking for better solutions, thats why i'm posting here, but thanks for your time.

        Originally posted by Rychard View Post
        For my database, I am storing the cached values of a player's wins and losses. I anticipate that as the number of records in my database grows, this process could take an increasingly longer time. To overcome this issue, I don't intend to keep the win/loss records constantly up-to-date. I plan to set up a scheduled task that will recalculate a player's record on some regular basis.

        This is about as simplistic as I can make it, but with only a tiny bit of imagination you will come to find that there are countless workflow optimizations that can be made to this idea that should allow you to keep these values updated in almost real-time without having to iterate over your entire dataset each time.
        Oh, i just realized a better method to do this hehe =) Just save the last match_id and do the loop starting by this number =)
        Last edited by hor; 07-19-2012, 01:37 PM.

        Comment


        • #79
          Originally posted by hor View Post
          Oh, i just realized a better method to do this hehe =) Just save the last match_id and do the loop starting by this number =)
          I would suggest storing a player's wins and losses as integers in your database. That way, each time you are processing all the latest matches from the API, as you iterate over each new match, just update the wins and losses fields in your database for each player that participated. You'd already be iterating over the new matches anyway since you're preparing them for insertion into the database, so it makes a fair bit of sense to get everything done at once.

          I've got a question that someone else might be able to answer for me though:

          The <player_slot> element in the response seems to only contain one of the following values: 0, 1, 2, 3, 4, 128, 129, 130, 131, 132.
          I assume each group of contiguous numbers maps to all the players on one team (0,1,2,3,4) and the other group (128,129,130,131,132) maps to all the players on the opposite team.

          The question is, which group goes to which team?

          Which set of values goes to Radiant, and which to Dire?

          Comment


          • #80
            Did someone ask this? I think

            Lobby Type
            0: Regular matchmaking
            4: Coop bot match

            And I think that 0-4 is radiant, 128+ is dire (just from looking through a bunch of game results). I will try getting some of the tower information once the patch is live (I don't want to download the test dota client <_<).

            Also.

            I don't believe you need an actual host to do any of this. I signed up using my domain, but have been doing all my testing using a local php installation that has nothing to do with my web hosting. I would personally just try something random for the domain and then just access it in your scripts normally...
            Last edited by Metroids; 07-19-2012, 02:30 PM.

            Comment


            • #81
              Originally posted by Metroids View Post
              Lobby Type
              0: Regular matchmaking
              4: Coop bot match
              I was hoping that there would be substantially more matches of one type than the other, but a quick query on my database (498 matches in total, I believe) doesn't seem to help.

              Code:
              LobbyType	MatchCount
              ---------	----------
              0		284
              4		214
              That said, it would make some sense for regular matchmaking to be '0', and cooperative bot matches to be '4', if only because regular matchmaking was implemented first, bots coming much later.

              Originally posted by Metroids View Post
              And I think that 0-4 is radiant, 128+ is dire (just from looking through a bunch of game results).
              The data does seem to correlate rather strongly with this statement.

              Here's a portion of data (25 matches) I have so that others may speculate as well:
              Code:
              MatchID		Winner		Radiant		Dire
              --------	--------	--------	--------
              461014		Dire		8/12/8		11/8/15
              461083		Radiant		38/15/48	15/38/24
              461173		Dire		46/56/60	54/49/70
              461423		Radiant		42/8/55		7/43/12
              461504		Radiant		64/23/94	21/68/53
              461663		Radiant		24/10/37	9/26/11
              461772		Radiant		23/18/35	14/24/8
              461871		Dire		12/22/12	20/15/34
              462030		Radiant		41/26/79	20/43/40
              462197		Radiant		47/26/62	26/49/44
              462316		Dire		15/35/7 	35/15/20
              462586		Radiant		8/0/8   	0/8/0
              462702		Radiant		76/20/74	18/77/34
              462971		Dire		28/62/45	62/31/105
              463059		Radiant		33/23/31	21/33/18
              463165		Radiant		53/25/57	24/56/65
              463403		Radiant		5/7/2   	7/5/0
              463981		Dire		27/79/42	76/29/121
              464581		Radiant		52/25/62	24/53/33
              466345		Radiant		20/13/13	9/21/15
              466510		Radiant		39/14/54	13/39/23
              467167		Radiant		19/22/19	21/20/11
              467241		Dire		24/44/25	41/24/38
              467457		Dire		13/18/4 	18/13/11
              467763		Dire		22/29/11	29/23/22
              I'm curious to find out about the tower/building bit fields, so if you find anything out, please report back with your findings!
              Last edited by Rychard; 07-19-2012, 05:31 PM.

              Comment


              • #82
                The Match History WebAPI is now live on the main Dota 2 version. Just change from 205790 to 570 in the URLs.

                Comment


                • #83
                  Originally posted by Arclacke View Post
                  Theres a way to call the API without a web application? I want to play around with scripts in Python, but don't have a website/domain for it.
                  Originally posted by Ragnesis View Post
                  Is the web api key avaible for people who do not own webpage but wants to use the functionality for whatever purpose(info gatehring, edu, etc)?
                  Zoid, can you please answer these questions?

                  Comment


                  • #84
                    Originally posted by Arclacke View Post
                    Zoid, can you please answer these questions?
                    It's very simple. A WebAPI is just a connection to a webserver that you pass data to and it responds. You do not need a webserver or webpage.

                    When you go to http://steamcommunity.com/dev/apikey the "domain" field is just a note. It's not actually used for anything and is just a helpful field so you can tell us what your website is. You can just put your name in for now. Once you get a key, its what uniquely identifies you when accessing our WebAPI calls.

                    You can go there in your web browser directly. For example,
                    Code:
                    https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=<key>
                    You can paste that into your web browser, replacing <key> with the key you got from the Steam page to get the history for the most recent 25 matches played.

                    In Python you just want to make a web call. You can use urllib, http://docs.python.org/library/urllib.html to call the WebAPI using the URL and then take the result and stuff into a JSON decoder http://docs.python.org/library/json.html and turn the results into Python objects you can parse.

                    Comment


                    • #85
                      Can I get a key? I'll like to create a Java library for anyone who are using this language to build web app... The domain is not mine, belongs to the company where I'm working...

                      Comment


                      • #86
                        Originally posted by Lynx6 View Post
                        Can I get a key? I'll like to create a Java library for anyone who are using this language to build web app... The domain is not mine, belongs to the company where I'm working...
                        http://steamcommunity.com/dev/apikey

                        Yes.
                        // Economy
                        "NotTheStringsYoureLookingFor"

                        Comment


                        • #87
                          What I've managed to figure out so far:

                          player_slot is an 8-bit int, highest bit is radiant (0) or dire (1). Lowest 3 (or 7) are the slot on that team (0-4)

                          What are the following fields?:

                          leaver_status - Is this just a boolean of whether or not they abandoned?
                          tower_status_radiant, tower_status_dire, barracks_status_radiant, barracks_status_dire - bitmask I assume? What do these represent?
                          lobby_type - an enum?
                          leagueid - another enum?

                          Comment


                          • #88
                            Here's an interesting piece of information I calculated up moments ago:

                            - On the main page of http://stats.dota2.be/ it states that it has 27,120,718 matches in the database.
                            - Zoid stated on page 1 not to query the API more often than once per second, else risk exceeding your limit.
                            - Using the GetMatchHistory API call, you can get rudimentary information for 25 matches on every request.

                            Knowing the above, let's take it a step further:

                            - You can retrieve the basic information for no more than 25 matches per second.
                            - There are 86,400 seconds in the span of one day.

                            Now, barring any other factors such as the time it takes the server to respond (assume the server will always fulfill exactly one of your requests every second), let's determine how long it would theoretically take to get only the basic information about every possible match.

                            27,120,718 matches / 25 matches per second = 1,084,828.72 seconds will be needed to retrieve this information.

                            Well, how long is that?

                            1,084,828.72 seconds = 18,080.5 minutes
                            18,080.5 minutes = 301.342 hours
                            301.342 hours = 12.556 days

                            So there you have it. It will take roughly 12.6 entire days using the API in order to obtain just this data.

                            And if you wanted to get full match details of every match? Well, just know that each match requires a request to GetMatchDetails by itself. Remind me again how many matches there were? 27 million, you say? This is going to take a while.

                            27,120,718 matches * 1 API request per second = 27,120,718 seconds

                            I'll spare you the rest, but that equates out to roughly 314 entire days.

                            So I do hope that nobody attempts a full database synchronization. That would just be silly.

                            Comment


                            • #89
                              Originally posted by Netshroud View Post
                              player_slot is an 8-bit int, highest bit is radiant (0) or dire (1). Lowest 3 (or 7) are the slot on that team (0-4)
                              I never thought to look at it that way, but I suppose that makes sense.

                              Although I believe you intended to say 8-bit uint (a signed 8-bit integer can't have values over 127, as that space is used for the representation of negative numbers).

                              Originally posted by Netshroud View Post
                              What are the following fields?:

                              leaver_status - Is this just a boolean of whether or not they abandoned?
                              tower_status_radiant, tower_status_dire, barracks_status_radiant, barracks_status_dire - bitmask I assume? What do these represent?
                              lobby_type - an enum?
                              leagueid - another enum?
                              <leaver_status>: I've seen the following values in this field: 0, 1, 2, 3, 4, and NULL (when the player is a BOT). The abandonment timer gives you 5 minutes to get back in before it assumes that you've abandoned the game. Perhaps this field is how many minutes that you were disconnected? A value of zero may mean that you were present for the entire game (the data seems to match this theory), and a value of 5 (which I assume to be the upper bound) would signify you as having abandoned that game. I assume it stops at 5 as there would be no benefit of knowing anything past that.

                              I've got 30,210 MatchPlayer records in my database (my MatchPlayer table contains essentially the same thing as the <player> element.)

                              Here's a rundown of the occurrences of the various values for <leaver_status>

                              Code:
                              LeaverStatus	Occurrences
                              ------------	-----------
                              NULL		495
                              0		27844
                              1		953
                              2		561
                              3		43
                              4		314
                              As far as the other fields go, someone said something about cross-checking by watching replays of certain matches with various values for each of the team towers/buildings, but that could easily take a few hours of research. It'd be much more convenient if Zoid knew.

                              Comment


                              • #90
                                Finally! I've been waiting for an official API for a long time - I can now put my programming knowledge to some good use.

                                Just a quick question: why is the total number of results limited to 500? I wanted to pull the entire history of my MM games, but I noticed that the last match I was able to retrieve is actually not my very first game I had on Dota 2.

                                Comment

                                Working...
                                X