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

  • Originally posted by tomato View Post
    I like your version more. It would also consume much less resources than my GD version. Where did you find the little tower images? I prefer them over my lame color ones!
    The amount of resources saved would be minimal since you still have to draw the tower images on the map with GD. I made a script pretty much identical to yours about two weeks ago, and I have since updated it with tower images like IceHaku did. I extracted the tower images from the game files, so they match the ones you see in-game on the minimap. I'll put them in a zip file for you in 30 minutes

    EDIT: Attached the tower images. I overlayed the appropriate colors and resized the 90 degree tower images (you will understand when you see them) for you. Makes it easy to do some test scripting right away

    If you make it work, please feel free to share the code. I am having some problems overlaying the tower images myself, GD doesn't always want to do what I want it to.

    EDIT 2: If you want to resize the rest of the images to the appropriate size yourself, here is how: The original minimap image is 1024 x 1024 pixels, the icons are sized after that. Simply calculate the percentage relative to the size of the minimap image you are using. For instance, on your site, the image is 455 x 455. The percentage difference between 1024 and 455 is around 44%. Simply downscale the icons 44% in that case.
    Attached Files
    Last edited by Lazze; 08-07-2012, 06:45 AM.

    Comment


    • What's up with matches like 17124659?

      http://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/V001/?match_id=17124659&key=<KEY> comes back with a 401 error, or
      Code:
      {
      
      }
      Despite this, the match history - http://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?date_max=1337708749&start_at_match_id=17124660&ke y=<KEY> displays (among other things)
      Code:
      {
      	"result": {
      		"status": 1,
      		"num_results": 25,
      		"total_results": 500,
      		"results_remaining": 470,
      		"matches": [
      			{
      				"match_id": 17124659,
      				"start_time": 1337708748,
      				"lobby_type": 4,
      				"players": [
      					{
      						"account_id": 43730573,
      						"player_slot": 0,
      						"hero_id": 6,
      						"player_name": "Lynx。Payback"
      					},
      					{
      						"account_id": 55757886,
      						"player_slot": 1,
      						"hero_id": 25,
      						"player_name": "golf11405"
      					},
      					{
      						"account_id": 102331962,
      						"player_slot": 2,
      						"hero_id": 9,
      						"player_name": "Bird.E.V"
      					},
      					{
      						"account_id": 98830876,
      						"player_slot": 3,
      						"hero_id": 59,
      						"player_name": "RõsarI…mance~"
      					},
      					{
      						"account_id": 6736646,
      						"player_slot": 4,
      						"hero_id": 49,
      						"player_name": "Jon"
      					},
      					{
      						"player_slot": 128,
      						"hero_id": 29
      					},
      					{
      						"player_slot": 129,
      						"hero_id": 21
      					},
      					{
      						"player_slot": 130,
      						"hero_id": 5
      					},
      					{
      						"player_slot": 131,
      						"hero_id": 15
      					},
      					{
      						"player_slot": 132,
      						"hero_id": 19
      					}
      				]
      			}
      		]
      		
      	}
      }
      What's going on?

      Comment


      • Zoid, we hunger for information!

        Comment


        • Originally posted by Lazze View Post
          EDIT: Attached the tower images. I overlayed the appropriate colors and resized the 90 degree tower images (you will understand when you see them) for you. Makes it easy to do some test scripting right away

          If you make it work, please feel free to share the code. I am having some problems overlaying the tower images myself, GD doesn't always want to do what I want it to.
          Thanks for posting those images. Much nicer than hard-coded blobs of color. Anyway, I gave it a spin and tried the whole thing in HTML5 Canvas, since I want to avoid bandwidth/cpu stress by using GD every single time. The result is actually very nice!

          What I am doing in PHP now is generating the javascript. This is just test-code, but it works as is. It just needs to be cleaned up to be used in actual production.

          PHP Code:
          <?php
          // pad the dec to 11bit binary
          $radiant_towers sprintf('%011b'$_GET["radiant"] ); 
          $dire_towers  sprintf('%011b'$_GET["dire"] );
          ?>

          <html>
            <head>
              <title>dota 2</title>
              <script type="application/x-javascript">

              function draw() {
                var ctx = document.getElementById('canvas').getContext('2d');
                // images
                var map = new Image(); // map
                var dire_tower = new Image(); // dire tower 90 deg
                var radiant_tower = new Image(); // radiant tower 90 deg
                var dire_tower_45 = new Image(); // dire tower 45 deg
                var radiant_tower_45 = new Image(); // radiant tower 45

                map.onload = function(){
                  ctx.drawImage(map,0,0); //map
                }
                radiant_tower.onload = function(){ // radiant 90 deg towers
                    <?php if($radiant_towers[8]) { echo "ctx.drawImage(radiant_tower, 112, 390); // t3 bot\n"; } ?>
                    <?php if($radiant_towers[9]) { echo "ctx.drawImage(radiant_tower, 207, 388); // t2 bot\n"; } ?>
                    <?php if($radiant_towers[10]) { echo "ctx.drawImage(radiant_tower, 357, 390); // t1 bot\n"; } ?>
                    <?php if($radiant_towers[2]) { echo "ctx.drawImage(radiant_tower, 36, 311); // t3 top\n"; } ?>
                    <?php if($radiant_towers[3]) { echo "ctx.drawImage(radiant_tower, 50, 242); // t2 top\n"; } ?>
                    <?php if($radiant_towers[4]) { echo "ctx.drawImage(radiant_tower, 50, 170); // t1 top\n"; } ?>
                }
                radiant_tower_45.onload = function(){ // radiant 45 deg towers
                    <?php if($radiant_towers[5]) { echo "ctx.drawImage(radiant_tower_45, 89, 333); // t3 mid\n"; } ?>
                    <?php if($radiant_towers[6]) { echo "ctx.drawImage(radiant_tower_45, 126, 292); // t2 mid\n"; } ?>
                    <?php if($radiant_towers[7]) { echo "ctx.drawImage(radiant_tower_45, 177, 256); // t1 mid\n"; } ?>
                    <?php if($radiant_towers[0]) { echo "ctx.drawImage(radiant_tower_45, 58, 353); // ancient\n"; } ?>
                    <?php if($radiant_towers[1]) { echo "ctx.drawImage(radiant_tower_45, 70, 363); // ancient\n"; } ?>
                }

                // dire
                dire_tower.onload = function(){ // dire 90 deg towers
                    <?php if($dire_towers[8]) { echo "ctx.drawImage(dire_tower, 394, 272); // t1 bot\n"; } ?>
                    <?php if($dire_towers[9]) { echo "ctx.drawImage(dire_tower, 396, 215); // t2 bot\n"; } ?>
                    <?php if($dire_towers[10]) { echo "ctx.drawImage(dire_tower, 396, 137); // t3 bot\n"; } ?>
                    <?php if($dire_towers[2]) { echo "ctx.drawImage(dire_tower, 318, 60); // t3 top\n"; } ?>
                    <?php if($dire_towers[3]) { echo "ctx.drawImage(dire_tower, 221, 53); // t2 top\n"; } ?>
                    <?php if($dire_towers[4]) { echo "ctx.drawImage(dire_tower, 88, 53); // t1 top\n"; } ?>
                }
                dire_tower_45.onload = function(){ // dire 45 deg towers
                    <?php if($dire_towers[5]) { echo "ctx.drawImage(dire_tower_45, 335, 114); // t3 mid\n"; } ?>
                    <?php if($dire_towers[6]) { echo "ctx.drawImage(dire_tower_45, 287, 161); // t2 mid\n"; } ?>
                    <?php if($dire_towers[7]) { echo "ctx.drawImage(dire_tower_45, 244, 211); // t1 mid\n"; } ?>
                    <?php if($dire_towers[0]) { echo "ctx.drawImage(dire_tower_45, 359, 80); // ancient\n"; } ?>
                    <?php if($dire_towers[1]) { echo "ctx.drawImage(dire_tower_45, 368, 92); // ancient\n"; } ?>
                }

                map.src = 'img/dota_map.png';
                dire_tower.src = 'img/minimap_tower90_dire.png';
                radiant_tower.src = 'img/minimap_tower90_radiant.png';
                dire_tower_45.src= 'img/minimap_tower_dire.png';
                radiant_tower_45.src= 'img/minimap_tower_radiant.png';

              }
              </script>
              <style type="text/css">
                body { margin: 20px; font-family: arial,verdana,helvetica; background: #fff;}
                canvas { float: left; margin-right: 20px; margin-bottom: 20px; }

              </style>
            </head>
            <body onload="draw();">
              <div>
                <canvas id="canvas" width="455" height="455"></canvas>
              </div>
            </body>
          </html>
          Check the output here, it is already much faster than any GDlib method: http://oldmanclub.org/dev/dota/map/i...2047&dire=2047

          If you don't see any towers, just refresh and try again. There currently is a bug in Chrome, where the map is drawn on-top of the towers, due to the poor HTML5 on my code. In an actual production environment, we should probably just set the map as a background to the canvas in CSS. This will avoid all issues.

          Anyway, I think the HTML5 approach is the best implementation we can get for fast and accurate tower status that is also very nice to look at, thanks to your icons.
          Last edited by tomato; 08-07-2012, 12:09 PM.

          Comment


          • Originally posted by tomato View Post
            I like your version more. It would also consume much less resources than my GD version. Where did you find the little tower images? I prefer them over my lame color ones!
            I did the images just cutting than from a in game print.

            Comment


            • Originally posted by tomato View Post
              Thanks for posting those images. Much nicer than hard-coded blobs of color. Anyway, I gave it a spin and tried the whole thing in HTML5 Canvas, since I want to avoid bandwidth/cpu stress by using GD every single time. The result is actually very nice!

              What I am doing in PHP now is generating the javascript. This is just test-code, but it works as is. It just needs to be cleaned up to be used in actual production.

              PHP Code:
              <?php
              // pad the dec to 11bit binary
              $radiant_towers sprintf('%011b'$_GET["radiant"] ); 
              $dire_towers  sprintf('%011b'$_GET["dire"] );
              ?>

              <html>
                <head>
                  <title>dota 2</title>
                  <script type="application/x-javascript">

                  function draw() {
                    var ctx = document.getElementById('canvas').getContext('2d');
                    // images
                    var map = new Image(); // map
                    var dire_tower = new Image(); // dire tower 90 deg
                    var radiant_tower = new Image(); // radiant tower 90 deg
                    var dire_tower_45 = new Image(); // dire tower 45 deg
                    var radiant_tower_45 = new Image(); // radiant tower 45

                    map.onload = function(){
                      ctx.drawImage(map,0,0); //map
                    }
                    radiant_tower.onload = function(){ // radiant 90 deg towers
                        <?php if($radiant_towers[8]) { echo "ctx.drawImage(radiant_tower, 112, 390); // t3 bot\n"; } ?>
                        <?php if($radiant_towers[9]) { echo "ctx.drawImage(radiant_tower, 207, 388); // t2 bot\n"; } ?>
                        <?php if($radiant_towers[10]) { echo "ctx.drawImage(radiant_tower, 357, 390); // t1 bot\n"; } ?>
                        <?php if($radiant_towers[2]) { echo "ctx.drawImage(radiant_tower, 36, 311); // t3 top\n"; } ?>
                        <?php if($radiant_towers[3]) { echo "ctx.drawImage(radiant_tower, 50, 242); // t2 top\n"; } ?>
                        <?php if($radiant_towers[4]) { echo "ctx.drawImage(radiant_tower, 50, 170); // t1 top\n"; } ?>
                    }
                    radiant_tower_45.onload = function(){ // radiant 45 deg towers
                        <?php if($radiant_towers[5]) { echo "ctx.drawImage(radiant_tower_45, 89, 333); // t3 mid\n"; } ?>
                        <?php if($radiant_towers[6]) { echo "ctx.drawImage(radiant_tower_45, 126, 292); // t2 mid\n"; } ?>
                        <?php if($radiant_towers[7]) { echo "ctx.drawImage(radiant_tower_45, 177, 256); // t1 mid\n"; } ?>
                        <?php if($radiant_towers[0]) { echo "ctx.drawImage(radiant_tower_45, 58, 353); // ancient\n"; } ?>
                        <?php if($radiant_towers[1]) { echo "ctx.drawImage(radiant_tower_45, 70, 363); // ancient\n"; } ?>
                    }

                    // dire
                    dire_tower.onload = function(){ // dire 90 deg towers
                        <?php if($dire_towers[8]) { echo "ctx.drawImage(dire_tower, 394, 272); // t1 bot\n"; } ?>
                        <?php if($dire_towers[9]) { echo "ctx.drawImage(dire_tower, 396, 215); // t2 bot\n"; } ?>
                        <?php if($dire_towers[10]) { echo "ctx.drawImage(dire_tower, 396, 137); // t3 bot\n"; } ?>
                        <?php if($dire_towers[2]) { echo "ctx.drawImage(dire_tower, 318, 60); // t3 top\n"; } ?>
                        <?php if($dire_towers[3]) { echo "ctx.drawImage(dire_tower, 221, 53); // t2 top\n"; } ?>
                        <?php if($dire_towers[4]) { echo "ctx.drawImage(dire_tower, 88, 53); // t1 top\n"; } ?>
                    }
                    dire_tower_45.onload = function(){ // dire 45 deg towers
                        <?php if($dire_towers[5]) { echo "ctx.drawImage(dire_tower_45, 335, 114); // t3 mid\n"; } ?>
                        <?php if($dire_towers[6]) { echo "ctx.drawImage(dire_tower_45, 287, 161); // t2 mid\n"; } ?>
                        <?php if($dire_towers[7]) { echo "ctx.drawImage(dire_tower_45, 244, 211); // t1 mid\n"; } ?>
                        <?php if($dire_towers[0]) { echo "ctx.drawImage(dire_tower_45, 359, 80); // ancient\n"; } ?>
                        <?php if($dire_towers[1]) { echo "ctx.drawImage(dire_tower_45, 368, 92); // ancient\n"; } ?>
                    }

                    map.src = 'img/dota_map.png';
                    dire_tower.src = 'img/minimap_tower90_dire.png';
                    radiant_tower.src = 'img/minimap_tower90_radiant.png';
                    dire_tower_45.src= 'img/minimap_tower_dire.png';
                    radiant_tower_45.src= 'img/minimap_tower_radiant.png';

                  }
                  </script>
                  <style type="text/css">
                    body { margin: 20px; font-family: arial,verdana,helvetica; background: #fff;}
                    canvas { float: left; margin-right: 20px; margin-bottom: 20px; }

                  </style>
                </head>
                <body onload="draw();">
                  <div>
                    <canvas id="canvas" width="455" height="455"></canvas>
                  </div>
                </body>
              </html>
              Check the output here, it is already much faster than any GDlib method: http://oldmanclub.org/dev/dota/map/i...2047&dire=2047

              If you don't see any towers, just refresh and try again. There currently is a bug in Chrome, where the map is drawn on-top of the towers, due to the poor HTML5 on my code. In an actual production environment, we should probably just set the map as a background to the canvas in CSS. This will avoid all issues.

              Anyway, I think the HTML5 approach is the best implementation we can get for fast and accurate tower status that is also very nice to look at, thanks to your icons.
              This indeed seems like the best solution so far. All processing is done client side, and it is fast! Setting the map itself as the background in the canvas div works perfectly, no more bugs

              Comment


              • I want to present my version of the statistics of dota2 games http://d2gator.info/game/31362743
                feature of my version - performance, and no delay for viewing already played games.
                until the project is spent only 4 days, do not judge strictly.
                Last edited by dessoya; 08-08-2012, 07:18 AM.

                Comment


                • Some matches have missing player names and account ids.

                  Example: account 12400034 with the match IDs: 27276433, 27246234, and 27240090 are also borked.
                  Code:
                  		<match>
                  			<match_id>27240090</match_id>
                  			<start_time>1342796574</start_time>
                  			<lobby_type>4</lobby_type>
                  			<players>
                  				<player>
                  					<account_id>85684529</account_id>
                  					<player_slot>0</player_slot>
                  					<hero_id>67</hero_id>
                  					<player_name>PentaHousen</player_name>
                  				</player>
                  				<player>
                  					<account_id>35063471</account_id>
                  					<player_slot>1</player_slot>
                  					<hero_id>46</hero_id>
                  					<player_name>It&apos;s Dinosaur Time!</player_name>
                  				</player>
                  				<player>
                  					<account_id>86997456</account_id>
                  					<player_slot>2</player_slot>
                  					<hero_id>68</hero_id>
                  					<player_name>tazziQ</player_name>
                  				</player>
                  				<player>
                  					<account_id>11660365</account_id>
                  					<player_slot>3</player_slot>
                  					<hero_id>69</hero_id>
                  					<player_name>Ssshhhhh!</player_name>
                  				</player>
                  				<player>
                  					<account_id>12400034</account_id>
                  					<player_slot>4</player_slot>
                  					<hero_id>38</hero_id>
                  					<player_name>Dr. Cock</player_name>
                  				</player>
                  				<player>
                  					<player_slot>128</player_slot>
                  					<hero_id>3</hero_id>
                  				</player>
                  				<player>
                  					<player_slot>129</player_slot>
                  					<hero_id>19</hero_id>
                  				</player>
                  				<player>
                  					<player_slot>130</player_slot>
                  					<hero_id>29</hero_id>
                  				</player>
                  				<player>
                  					<player_slot>131</player_slot>
                  					<hero_id>15</hero_id>
                  				</player>
                  				<player>
                  					<player_slot>132</player_slot>
                  					<hero_id>21</hero_id>
                  				</player>
                  			</players>
                  		</match>
                  account_id and player_name for the last 5 players are missing.
                  Last edited by cubi; 08-08-2012, 07:01 PM.

                  Comment


                  • they playing vs computers ?

                    Comment


                    • I didn't consider that possibility. I will check, thx.

                      edit: you are right dessoya, thanks!
                      Last edited by cubi; 08-09-2012, 06:46 AM.

                      Comment


                      • Originally posted by tomato View Post
                        Anyway, I think the HTML5 approach is the best implementation we can get for fast and accurate tower status that is also very nice to look at, thanks to your icons.
                        Originally posted by Lazze View Post
                        This indeed seems like the best solution so far. All processing is done client side, and it is fast! Setting the map itself as the background in the canvas div works perfectly, no more bugs
                        IMO you want to avoid relying completely on javascript to display something.
                        If i were you, i'd whip up some form of css positioning that you can fall back on in the case that the client can't handle the JS for some reason - you can always remove the css, etc with your JS.
                        Last edited by MuppetMaster42; 08-09-2012, 07:29 AM.
                        The API Bible: Things You Should Know Before Starting API Development

                        Comment


                        • <lobby_type>4</lobby_type>

                          Comment


                          • Originally posted by MuppetMaster42 View Post
                            IMO you want to avoid relying completely on javascript to display something.
                            If i were you, i'd whip up some form of css positioning that you can fall back on in the case that the client can't handle the JS for some reason - you can always remove the css, etc with your JS.
                            I disagree. JS is no problem at all, virtually any browser can handle it. HTML5 we might agree on, but then again, most browsers support it. I have tested Chrome, Firefox, Opera and the latest IE; They all seem to do just fine.

                            CSS positioning is not good for this kind of thing, it would be way too much of a hassle, and there would be more compatibility issues as browsers handle CSS differently.

                            Even my phone displays the current HTML5/JS solution perfectly:

                            Comment


                            • this was maybe answered already but sorry, there's 26 pages in this thread. can someone explain me how to retrieve steamID by given account_id or vice versa. thanks

                              p.s. why don't you just use steamID 64 instead of giving every player new numbers?

                              Comment


                              • New patch?

                                KEEP IN SHADOWS

                                Comment

                                Working...
                                X