Nostrademous / Dota2-WebAI

MIT License
33 stars 6 forks source link

[LUA CODE] Complex Actions TODOs #3

Open Nostrademous opened 7 years ago

Nostrademous commented 7 years ago

They are enumerated here: https://github.com/Nostrademous/Dota2-WebAI/blob/master/actions/complex_actions/TODO_complex_actions.md

ThePianoDentist commented 7 years ago

I had pulling and double-pulling in my bot. Ill try and implement them here.

Might be better to code stacking first as will be some code overlap (you attack creeps then run away)

ThePianoDentist commented 7 years ago

For some of these complex_actions. Will we want to have the backend server doing the stitching of the simple_actions?

i.e for stacking/pulling:

I think implementation could be a lot simpler if it's left to the backend. Im not going to do anything on this issue, until have more of the world state in the backend server and can try and give as much work to that as possible

EDIT; I can see that have actually come quite far with sending world-state to the backend. has Neutral creep info, and allied lane creep. so Ill try and get myWorlD.decision() to tell bot to do what I described above

Nostrademous commented 7 years ago

I don't think we will want to "stitch" simple_actions on backend server. I anticipated the backend server just giving directives to front-end about what to do at the high-level and the front-end being able to interpret that through complex action definitions and maneuvers.

ThePianoDentist commented 7 years ago

kk, Im not sure I agree, but it's hard to predict best way without trying. So as the project is still at an earlyish stage...

Im going to prototype both implementations on 2 separate branches

so can compare having actual code

Nostrademous commented 7 years ago

Great. I am not opposed to it, I just worry about speed. Backend only communicates every 0.25 sec to front end. Test will tell.

The hard part is seeing it work as currently the bots don't do anything yet.

ThePianoDentist commented 7 years ago

I completely overlooked that. Great point.

I've written the stacking lua function, I just need to test calling it. work so far https://github.com/ThePianoDentist/Dota2-WebAI/commit/199a8ea9d31a35f2d5868978934d4ef79450b3c5

Took the jungle parts from constants.lua in your full-override. made a jungle.lua inside /constants. Think this assumed a melee bot though, so going to have to dynamically work out timings for ranged bots.

So far my implementation assumes Stack() will not just be called once, it will have to be called by each successive think until the stack is 'done'. because when you first call stack, you do not have all the information necessary to queue all the needed actions. The main issue is that if you cannot see the neutrals you are about to try and stack (maybe its night or there's trees from your angle), then you cannot get a handle on them. so for ranged heroes who want to aggro by attacking...you cannot queue this action.

ThePianoDentist commented 7 years ago

tested and fixed my stacking.

can be tested by overriding X.HeroThink with

    local Stacking = require( GetScriptDirectory().."/actions/complex_actions/action_stacking" )
require( GetScriptDirectory().."/constants/jungle" )
local camp_location = RAD_OFF_ANCIENT
local camp_timing = RAD_OFF_ANCIENT_STACKTIME
local camp_wait_at = RAD_OFF_ANCIENT_PRESTACK
local camp_pull_to = RAD_OFF_ANCIENT_STACK
if s == nil or s ~= 1 then
    s = Stacking:Call(camp_location, camp_timing, camp_wait_at, camp_pull_to)
    print(s)
end

still to do:

Nostrademous commented 7 years ago

Implemented a generic complex action. 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. We still will have to create specific implementations of all the above, but it will just call the "approach_and_execute_action_on_location" implementations with the final argument being "Action_UseAbilityOnLocation( hWard, vLoc) for warding for example.

ThePianoDentist commented 7 years ago

just an update.

I had asked for a small addition to API in a june update thread, which would make implementation of pulling/stacking a lot more reliable. (basically if you approach the camp from the 'wrong direction' you are fogged by trees and everything is awkward. currently no way to tell from api where camp 'opening' side is)

hasnt been added so im going to repost in api request thread.

I also had some offlaner/hero-zoning stuff in my bot. I can try porting it to here if you want

Nostrademous commented 7 years ago

Sure, just use basic actions to do those (if any missing let me know)