Results 1 to 9 of 9

Thread: How can my bot know if a path is reachable

  1. #1
    Basic Member
    Join Date
    May 2017
    Posts
    10

    How can my bot know if a path is reachable

    I've been having an issue where my bot sets a path to a tree that is out of reach. There are a cluster of trees on the far left of the map near the end of the river that are on high ground that cannot be reached, and when my bot targets those trees, it just moves to the wall and idles. I've prevented this by blocking off that small area as a potential tree target, but I would like to know if there's a more elegant/precise way of knowing if the bot is about to attempt to go somewhere it can't that I can plug into for other set paths.

    Also, sometimes the bot targets a point inside of a tower or building that cannot be reached, or targets a point within it's own circle and cannot move that short of a distance. I've hacked together some logic to prevent this, but it seems to still happen occasionally. How do you generally go about preventing this? Thanks!

  2. #2
    See if the following helps:
    bool IsLocationPassable( vLocation )

  3. #3
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,866
    It doesn't always work. I had a scenario where I managed to send my bot a location that is "under" the crown of a tree (so in theory reachable assuming my bot isn't as tall as Godzilla ), but within the bounding box of the tree and the queued command would just remain as it was, never ending since it couldn't reach the destination. Dunno about other scenarios, but this is the one where it didn't work.

    As for reachability, I posted this as a request some time ago. Hopefully if it can be implemented, it will take everything into account (bounding boxes, size, unbroken path, etc.)

    For buildings, I used the GetBoundingRadius() to manage to avoid this, but for trees it's not that easy. Especially since some are clunked together. We'll have to wait for Chris.

    Platinum, did your bots ever get stuck inside trees (i.e. a miscalculated blink) ? And if they did and they got out, how did you detect that they're trapped? I am curious since there is a similar scenario with Sprout, but that is (obviously) intentional. ATM we can't tell the forest trees apart from iron trees or sprout (although that would be nice for advanced bots)
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  4. #4
    Quote Originally Posted by The Nomad View Post
    Platinum, did your bots ever get stuck inside trees (i.e. a miscalculated blink) ? And if they did and they got out, how did you detect that they're trapped? I am curious since there is a similar scenario with Sprout, but that is (obviously) intentional. ATM we can't tell the forest trees apart from iron trees or sprout (although that would be nice for advanced bots)
    Over the span of hundreds of test, timber got stuck once, so I wrote a module that detects if bots get stuck, brings a tp and gets them out. I check if the location and mode of a bot hasn't changed more than a threshold for a while for detecting if they are stuck somewhere or not. Similarly you can track XP/gold gain of the bots to do the same. The cleanest solution would be to use the IsLocationPassable function, but I haven't tested it much.

  5. #5
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,866
    Thanks! Figured something similar. I assume you treat the trap vs stuck since you most likely change the bot's state to treat it as a teamfight.

    Quote Originally Posted by Platinum_dota2 View Post
    The cleanest solution would be to use the IsLocationPassable function, but I haven't tested it much.
    So far, on my shallow tests, it seems to only react to "a bot can be "placed" there (I assume, in contrast to, say, "cliff"-ing them). Also, tree locations, debris\decals (rocks, water decorations, boulders, statues etc.) return false, as you prolly imagined. The function is good for most use-cases, except the one I have, where bots get stuck or Filip's
    But as I said, I haven't tested what it can do in all scenarios. Just warning you that it might return true where you wouldn't expect it
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  6. #6
    Basic Member
    Join Date
    May 2017
    Posts
    10
    Thanks Platinum, this seems to be what I was looking for and it looks like it works just fine. I have yet to run into a situation similar to what The Nomad mentioned, but I'll keep an eye out for that. It would be nice if that function can take into account bounding boxes of objects to make it more reliable though. I'll keep testing the behavior and post anything abnormal that comes up!

  7. #7
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,866
    Quote Originally Posted by Filip View Post
    Thanks Platinum, this seems to be what I was looking for and it looks like it works just fine. I have yet to run into a situation similar to what The Nomad mentioned, but I'll keep an eye out for that. It would be nice if that function can take into account bounding boxes of objects to make it more reliable though. I'll keep testing the behavior and post anything abnormal that comes up!
    Well as Platinum said, it normally shouldn't happen. The only way I could reliably reproduce it was to use RandomVector() which resulted in a non-accessible location. This made it impossible for a unit to switch to the next queued action since it couldn't reach the destination. Also, I was in a forest with a lot of trees. You won't have this issue in lanes, except maybe if trying to juke.
    But yeah, normally you shouldn't have that problem
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  8. #8
    Basic Member
    Join Date
    May 2017
    Posts
    10
    Thanks everyone for the help! @Nomad, you're right it seems to be a very rare issue, so I can probably ignore it unless it becomes a problem, which I doubt it will since the only times I've had it happen was with that cluster of trees near the left end of the river, and that function has eliminated that.

  9. #9
    Basic Member
    Join Date
    Dec 2016
    Posts
    43
    Quote Originally Posted by Platinum_dota2 View Post
    Over the span of hundreds of test, timber got stuck once, so I wrote a module that detects if bots get stuck, brings a tp and gets them out. I check if the location and mode of a bot hasn't changed more than a threshold for a while for detecting if they are stuck somewhere or not. Similarly you can track XP/gold gain of the bots to do the same. The cleanest solution would be to use the IsLocationPassable function, but I haven't tested it much.
    I think use a function to check the hero location changing is a good way to solve it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •