Nostrademous / Dota2-FullOverwrite

Work in progress for a full-overwrite Dota 2 bot framework
GNU General Public License v3.0
97 stars 41 forks source link

Basic Roaming #36

Closed Keithenneu closed 7 years ago

Keithenneu commented 7 years ago

I'd like to build some basic roaming, to allow Bloodseeker to get more active during the laning phase. What I want to do:

Are there any functions yet, to get data about lanes?:

This should yield good results and not be to hard to implement for now. Later on, this should be integrated with some overall tactic considerations and fighting logic.

Nostrademous commented 7 years ago

Some of this is in already, although brittle. I need to create a wiki explaining the framework so it's easier for others to contribute. It will be here: https://github.com/Nostrademous/Dota2-FullOverwrite/wiki

Keithenneu commented 7 years ago

Once I've chosen a target, how do I attack it? Including ult usage, and getting allies to help.

Nostrademous commented 7 years ago

do...

if self:HasAction(ACTION_FIGHT) == false then print(utils.GetHeroName(bot), " - Fighting ", utils.GetHeroName(target)) self:AddAction(ACTION_FIGHT) self:setHeroVar("Target", target) end

Nostrademous commented 7 years ago

I assume that's what you are asking..

Keithenneu commented 7 years ago

Currently im adding ACTION_ATTACK, and set heroVar Target to my chosen target. The target is cleared by something just split seconds later though. Edit: I'm trying to use Target to store my target while running towards it. It gets set to nil immediately, rendering it kinda useless. I'll try using GankTarget for now.

Nostrademous commented 7 years ago

If you set ACTION_FIGHT and set setHeroVar("Target", target) like you say you are... then the X:DoFight() in decision_tree.lua will be invoked

it's possible you are picking a target stand near their tower (within 750 units) so the bot kick into the GetEstimatedDamageToTarget() and thinks it can do 0 dmg probably since it is not "close" to the target which then hits the else self:RemoveAction(ACTION_FIGHT) self:setHeroVar("Target", nil) return false end

Nostrademous commented 7 years ago

I would not call ACTION_FIGHT until you are near target... push ACTION_ROAM onto action stack and use X:DoRoam() instead to roam to the target and then invoke "ACTION_FIGHT" once you are there

Keithenneu commented 7 years ago

That's what im doing actually. Just Target being cleared breaks it.

Nostrademous commented 7 years ago

Is the target of roam standing under tower?

Keithenneu commented 7 years ago

Nope. I'll try to find the exact function which invokes setHeroVar("Target", nil). That'll tell us more.

Nostrademous commented 7 years ago
        if myDmgToTarget > target:GetHealth() and towerDmgToMe < (bot:GetHealth() + 100) then
            --print(utils.GetHeroName(bot), " - we are tower diving for the kill")
            if target:IsAttackImmune() or (bot:GetLastAttackTime() + bot:GetSecondsPerAttack()) > GameTime() then
                bot:Action_MoveToUnit(target)
            else
                bot:Action_AttackUnit(target, false)
            end
            return true
        else
            self:RemoveAction(ACTION_FIGHT)
            self:setHeroVar("Target", nil)
            return false
        end
Nostrademous commented 7 years ago

it probably doesn't think you can do enough damage to kill the target so it says don't fight and nil the "Target"

Nostrademous commented 7 years ago

b/c it doesn't consider the damage from any Allies next to you... just your solo damage

Keithenneu commented 7 years ago

I'm still in ACTION_ROAMING though

Nostrademous commented 7 years ago

is the code checked in, in your fork?

Keithenneu commented 7 years ago

Now it is.

Nostrademous commented 7 years ago

lines 491 or 498 in decision_tree.lua probably doing it since "ShouldIFight()" is evaluated before ShouldIRoam

Keithenneu commented 7 years ago

It's line 466. The utils function resets the target, if none is found.

Nostrademous commented 7 years ago

okay, that clear is probably unnecessary in utils.FindTarget()

Nostrademous commented 7 years ago

but fixing that I think you will then have it still cleared by 491 or MOST LIKELY 498 in decision_tree

Keithenneu commented 7 years ago

So I just use GankTarget, and Target as soon as I'm close to it and switch do Action_Fight

Nostrademous commented 7 years ago

right... best way to do that

however, you might find that you still don't attack until we add code for ally support since the code will probably estimate that you are not doing enough damage over the time (solo - since it doesn't consider allies for now) to get a kill and then stop fighting to fallback to last-hitting/laning

Nostrademous commented 7 years ago

another way to fix it is for me to finish implementing "harassment" code as part of Laning so when you "roam" into a lane the code will know you are not a "Core" that requires last hits and instead focus you on harassment and creep deny

Keithenneu commented 7 years ago

Thats true for full time roamers, but as a Jungler, I just want to kill someone and go back to farming. I'm not sure how to divide these classes of junglers. Maybe it's acutally ganking what I'm doing. Just like midlaners would. There are however junglers, who are something in between, like Chen (or Enigma, if times are hard.)

Keithenneu commented 7 years ago

It just feels hard to put all this into a state machine.

Nostrademous commented 7 years ago

don't get bogged down on that issue b/c:

Keithenneu commented 7 years ago

It's kinda working now :) He's still a little suicidal, but that's just fine tuning.

Nostrademous commented 7 years ago

Done.