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

CMsgBotWorldState, Protobufs, and You

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    @ChrisC - just realized one other thing as I was writing a function to summarize a CMsgBotWorldState replay dump.

    There is no "FINAL" protobuf sent to indicate the result of the game (who the winner is, etc). I can try to infer the winner based on the last frame's data for the Ancient's health on both teams, but this might be hard in very tight base-race situations where a winner is decided within a single frame. In the replay I'm testing on the last frame I get is that the Dire Team's Ancient has 34 health while Radiant Team's Ancient is at 4250 health, so yeah, I can deduce Radiant won. However, I don't actually have a frame for when their ancient dropped to 0.

    It would be really nice to have a single frame submitted with POST_GAME game state information.


    • #17

      It seems there are situations where the protobuf dumps can run into some lag issues leaving to weird CMsgBotWorldState aggregation. I recorded both the Radiant and Dire packets for a game and found that I had two "more" frame dumps for Dire than for Radiant (which shouldn't be possible). Investigating further what the actual difference was and I found the following files:
      -rw-r--r--  35014 Nov  7 09:46 replays/2017_11_07_0843_Dire/000870.bin
      -rw-r--r--  14600 Nov  7 09:46 replays/2017_11_07_0843_Dire/000871.bin
      -rw-r--r--      0 Nov  7 09:46 replays/2017_11_07_0843_Dire/000872.bin
      -rw-r--r--  20602 Nov  7 09:46 replays/2017_11_07_0843_Dire/000873.bin
      -rw-r--r--  35012 Nov  7 09:46 replays/2017_11_07_0843_Dire/000874.bin
      As you can see 871.bin looks small, 872 is 0 and 873 also looks small. My personal belief is that 871, 872 and 873 should be concatenated together into one protobuf dump, but doing so still did not result in a "valid" protobuf (perhaps it's an endian issue when concatenating). Not sure why the server reported it the way it did.
      Last edited by nostrademous; 11-10-2017, 06:52 AM.


      • #18
        Another 7.07 note:

        		// FOR COURIERS
        		optional bool		flying_courier = 140;
        Is no longer needed since we can use dota time to infer this.


        • #19
          @ChrisC - another thing now that I'm starting to process the protobuf contents in more detail.

          I notice at times a "unit" in the CMsgBotWorldState.units repeated message that does not have a "unit_type" or "name" set (well "name" is essentially set to empty string, but unit_type is all together missing). What are these? I see a number of them when processing a full replay and they are not always exactly the same (for example - the values of "vision_range_*time" vary between them).

          Example of such "unit" (note: I was Radiant (team_id: 2), so I would have full visibility to all my units).
          Game State: 5 -- Step 1196
          handle: 1754
          name: ""
          team_id: 2
          level: 1
          location {
            x: -6039.880859375
            y: 3262.531982421875
            z: 482.2955322265625
          is_alive: true
          player_id: -1
          bounding_radius: 24
          facing: 0
          ground_height: 384
          vision_range_daytime: 300
          vision_range_nighttime: 300
          health: 150
          health_max: 150
          health_regen: 0.0
          mana: 0
          mana_max: 0
          mana_regen: 0.0
          base_movement_speed: 300
          current_movement_speed: 300
          anim_activity: -1
          anim_cycle: 0.0
          base_damage: 1
          base_damage_variance: 0
          bonus_damage: 0
          attack_damage: 1
          attack_range: 600
          attack_speed: 1.0
          attack_anim_point: 0.75
          attack_acquisition_range: 800
          attack_projectile_speed: 900
          bounty_xp: 0
          bounty_gold_min: 0
          bounty_gold_max: 0
          is_channeling: false
          is_attack_immune: false
          is_blind: false
          is_block_disabled: false
          is_disarmed: false
          is_evade_disabled: false
          is_hexed: false
          is_invisible: false
          is_invulnerable: true
          is_magic_immune: false
          is_muted: false
          is_nightmared: false
          is_rooted: false
          is_silenced: false
          is_specially_deniable: false
          is_stunned: false
          is_unable_to_miss: false
          has_scepter: false
          armor: 0.0
          magic_resist: 0.0


          • #20
            @ChrisC - another bug with protobufs, it seems that many hero units (possibly all) have their abilities (many Ultimates for sure) return ability_id of 6251 (which is "generic_hidden") in the repeated Abilities value of heroes, rather than the actual ability_id of the ability they possess.

            For example, Zeus returns:
            [5110, 5111, 5112, 6325, 6251]
            Which is correct, except for the 5th one which should be his Ultimate


            • #21
              I believe the last one would be Nimbus, not Wrath. Which is why it's "hidden".
              Explanations on the normal, high and very high brackets in replays: here, here & here
              Why maphacks won't work in D2: here


              • #22
                Incorrect, they are presented in slot order apparently. Good thought though. Check the npc_abilities.txt provided by Valve to map ability ID numbers to ability names.


                • #23
                  Incorrect indeed. 6325 is Nimbus. But you can see my logic
                  However now that I think back, the last few patches added Ability Draft fixes (including extra slots for exotic spells). Each hero got 2 extra slots for 4-ability heroes. This may be an impact from that patch and the first hidden is Nimbus and the second hidden is... well hidden since zeus doesn't have a 6th ability. And then we have the ultimate that is missing.

                  TLDR: the extra hidden ability slots from the AD fix seem to impact the protobuff.
                  Explanations on the normal, high and very high brackets in replays: here, here & here
                  Why maphacks won't work in D2: here


                  • #24
                    @ChrisC - another issue with the protobuf, how do I know what "talents" the player has leveled? I assumed that once they are leveled they would appear in the "abilities" list for the unit (if hero type) but that does not seem to be the case.


                    • #25
                      @ChrisC - and yet another thing... items seem not to be provided at all. I see abilities and modifiers.

                      		repeated Ability	abilities = 90;
                      		repeated Ability	items = 91;
                      		repeated Modifier	modifiers = 92;


                      • #26
                        Hi, complete newbie to dota scripting here. @nostrademous Did you manage to solve the freeze problem after the first proto message is received from the server? Also when I run a custom game through Dota 2 Workshop Tools, I can connect to the server but it doesn't even send the first packet. Any tips on how to solve these issues? Thanks


                        • #27
                          I did solve the freeze problem long ago (forget how now b/c it was so long ago, but problem was on my side).

                          Regarding Workshop Tools, the API is slightly different so chances are you are using the in-game Bot API to connect (which seems to still be a valid function call, but one that does nothing) and instead should be using the Workshop API.


                          • #28
                            Thanks for the quick response! Well I'm having the freeze problem too, so maybe it's not just on your side... for custom game I'm using
                            dota_launch_custom_game my_custom_game dota
                            in VConsole to launch the game. I can see with netstat that the TCP server is running on 12121, and the python script connects to it, but doesn't receive any bytes.


                            • #29
                              I don't think the protobufs are implemented/work for custom games.


                              • #30
                                Ok, thanks! I was able to solve the freeze thing by just polling for 1 byte at a time, not sure if it's the ideal solution though