Page 3 of 3 FirstFirst 1 2 3
Results 21 to 27 of 27

Thread: Dota2 - Web-based AI

  1. #21
    Basic Member
    Join Date
    Nov 2015
    Posts
    108
    Quote Originally Posted by Platinum_dota2 View Post
    AFAIK Furious puppy was the first one who implemented stacking (and jungling in general) and most workshop bots are using his code, or a modified version his code (I wrote jungling before him, but it was not as good as what he wrote, mine didn't have stacking, and I made my bots public after him).
    Yep, back in December I put out my repo thread Meepo Bot + Puck Bot + Jungling/Stacking with some basic jungling and stacking cause it went hand in hand with developing Meepo. I remember borrowing a community constants file and having to tweak it for days to get it to be what I needed and then getting stacking to work was more constants (pull time) that had issue for other heroes and creep types changing etc.

    Man it's about time we get enough built in functions to do this right Every time I see an update I'm closer to coming back.

  2. #22
    ^ literally yesterdays update overhauled GetNeutralSpawners() adding lots more info to them.

    Im hoping fingers crossed, the stacking/jungling should be do-able using no hardcoded constants. (the new camp speed and bounds suggest dont need hardcoded timings)
    Ill put a link in here when I've either got it working like that...or given up
    https://github.com/ThePianoDentist/t...dentistdotabot Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
    https://github.com/ThePianoDentist/dotabots-ml-tools Parsing data from bot games

  3. #23
    Basic Member
    Join Date
    Dec 2016
    Posts
    610
    Any of you LUA coders out there have recommendations for the following function I implemented?

    File: approach_and_execute_action_on_location.lua
    Code:
    local actionMove = require( GetScriptDirectory().."/actions/basic_actions/action_move_to_location" )
    
    local ApproachAndExecuteActionOnLocation = {}
    ApproachAndExecuteActionOnLocation.Name = "Approach And Execute Action On Location"
    
    -------------------------------------------------
    
    function ApproachAndExecuteActionOnLocation:Call( hUnit, vLoc, fPrecision, iType, execAction, execLoc )
        local unitsToLocation = fPrecision
        if unitsToLocation == nil then
            unitsToLocation = 16.0
        end
        
        local distToLoc = GetUnitToLocationDistance(hUnit, vLoc)
        if distToLoc > unitsToLocation then
            actionMove:Call(hUnit, vLoc, iType)
            return
        else
            execAction(hUnit, execLoc, iType)
            return
        end
    end
    
    -------------------------------------------------
    
    return ApproachAndExecuteActionOnLocation
    Where
    FILE: action_move_to_location.lua
    Code:
    local MoveToLocation = {}
    
    MoveToLocation.Name = "Move to Location"
    
    -------------------------------------------------
    
    function MoveToLocation:Call( hUnit, vLoc, iType )
        if hUnit:IsHero() then
            hUnit.mybot.moving_location = vLoc
        end
        
        DebugDrawCircle(vLoc, 25, 255, 255 ,255)
        DebugDrawLine(hUnit:GetLocation(), vLoc, 255, 255, 255)
        
        if iType == nil or iType == ABILITY_STANDARD then
            hUnit:Action_MoveToLocation(vLoc)
        elseif iType == ABILITY_PUSH then
            hUnit:ActionPush_MoveToLocation(vLoc)
        elseif iType == ABILITY_QUEUE then
            hUnit:ActionQueue_MoveToLocation(vLoc)
        end
    end
    
    -------------------------------------------------
    
    return MoveToLocation
    This is a "complex" action, but still mostly generic. Instead of having to copy/paste multiple variants of basically the same thing for things like "go here and place ward", "go here and get rune", "go here and buy item", "go here and attack unit", "go here and cast spell on this loc", etc. I wanted to create a flexible template function which will just take the action to perform when at location. However, I don't see a truly generic way to do this b/c certain actions take more than 1 argument. Ideas (other then perhaps passing the arguments through inherent bot class variables instead of as arguments)? Perhaps I would be better served creating several abstract "complex" actions like this titled: ApproachLocationAndExecuteActionOneArg, ApproachLocationAndExecuteActionTwoArgs, ApproachLocationAndExecuteActionThreeArgs, etc.

  4. #24
    Basic Member
    Join Date
    Dec 2016
    Posts
    610
    Checked in new code with lots of improvements (although bots still don't do anything - almost).

    1) Fixed packets being sent as one large transfer - there are now 4 types (authentication - which is sent at start to setup webserver connectivity, world - (for now this is courier information and any bot/human players that are not using my bot system) sent as fast as it is processed by the server and replied to, enemies (just hero information about enemies we see) sent as fast as we process it and reply, and player update information (this is my bot system bots - we send hero dump)

    2) I use the provided dkjson Lua class (provided by Valve in game/dkjson.lua) to encode and decode all my JSON data

    3) my bots now when sending update to the server get processed for ability selection (not yet implemented on server-side) and starting item selection (implemented)

    4) Server checks DotaBuff for the hero guide requested matching the Role requested (safelane, offlane, mid, support, etc.) (role stuff is hard-coded for now, not dynamically determined yet) and replies with a list of starting items that were bough by high MMR players matching the hero and role.

    5) my bots process the start item list reply and buys the item (still some bugs exist)

    Current Bugs: damn item names don't always match what's on DotaBuff.

    For example:
    DotaBuff Anti-Mage Guide

    my bot buys the stout shield, buys the tangos, fails to buy the Healing Flask b/c "item_healing_salve" does not exist. It is called "item_flask". So I need to fix this by either creating a mapping or finding some more metadata info in the dotabuff webcode to scrape matching names.

    Anyways... just an update.

  5. #25
    Basic Member axetion's Avatar
    Join Date
    Jan 2017
    Posts
    26
    Quote Originally Posted by nostrademous View Post

    my bot buys the stout shield, buys the tangos, fails to buy the Healing Flask b/c "item_healing_salve" does not exist. It is called "item_flask". So I need to fix this by either creating a mapping or finding some more metadata info in the dotabuff webcode to scrape matching names..
    Yeah, you can't just stick item_ on the front of the name to get the correct name. For instance, Town Portal Scrolls are CDOTA_Item_TeleportScroll for the C++ class name (what's in the replay) but just item_teleport for the network name which is what the bot API uses...

    If this info is coming from a replay though, the correct network name is stored in a string table. Here's how I get it:

    https://github.com/axetion/dota2_nn_..._build.go#L200

    If this is a problem in how Dotabuff is parsing their replays you could probably make an issue on GH and show them this.

  6. #26
    Basic Member
    Join Date
    Dec 2016
    Posts
    610
    Quote Originally Posted by axetion View Post
    Yeah, you can't just stick item_ on the front of the name to get the correct name. For instance, Town Portal Scrolls are CDOTA_Item_TeleportScroll for the C++ class name (what's in the replay) but just item_teleport for the network name which is what the bot API uses...

    If this info is coming from a replay though, the correct network name is stored in a string table. Here's how I get it:

    https://github.com/axetion/dota2_nn_..._build.go#L200

    If this is a problem in how Dotabuff is parsing their replays you could probably make an issue on GH and show them this.
    I realized the problem and that I can't just stick item_ (it was a first-draft to see glue code working). I fixed the issue through a simply json name mapping thanks to some easy Excel-fu.

  7. #27
    Quote Originally Posted by lenlrx View Post
    there are already dota2comm which is enough for Reinforcement Learning AI.
    i hope http can do better
    Hi Len, why don't you guys read from the console logs in "dota 2 beta\game\dota" for dota2FileComm to send messages from Lua to python? I wouldn't suggest dota2MemComm, since you may get into the VAC ban territory (Dota2 hackers are also using a similar method)!

Posting Permissions

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