|
|
Tower AI is not, as it may appear, and as many falsely claim, random, but is actually completely deterministic.
There are two layers of Tower AI: hero protection, and everything else.
Rule 1: The tower will attack any hero that attacks an enemy hero.*
*Spells don't count. This includes manually casting orbs (ie Vindicator's, Arachna's)!
"Attacking" means "starting your autoattack animation". Unlike with creeps, you can right click an enemy hero and not draw tower fire until your hero actually lifts his arm to attack. You can cancel your attack animation by moving, stopping, holding, etc. and still get shot by the tower.
Rule 2: The tower will attack nearby units, with priority given to units attacking it, and then to units closest to it.
Three things trigger a tower to check for new targets: Any unit attacks an ally hero in range; the current target dies or leaves the tower's range; a possible target enters the range of a tower which has no targets at the moment.
When the first trigger (attack on enemy hero) occurs, the tower checks what its current target is doing. If the current target is not actively attacking an enemy hero, it will switch to a new target.^ However, if the target has not stopped attacking a hero, the tower will continue to attack it.
The second trigger basically returns the tower to its neutral state. Then, if other heroes are still attacking heroes, the tower will pick a new, closest one. Otherwise, it will pick the closest unit that is attacking the tower and fire on it until it dies, leaves, or something attacks an ally hero; if nothing is attacking the tower at the moment, it will pick the closest unit and fire on it until it dies, leaves, or something attacks an ally hero.
If it runs out of targets, the tower waits for something to come in range, and fires on it.
^This means that if you and an ally are attacking an enemy hero under a tower and the tower is shooting at you, you can press Hold and wait until the tower fires on your ally. Then you can continue attacking, and the tower will continue to attack your ally unless your ally dies, leaves the range, is disabled, or presses Hold himself.
Now with video! Thanks to siknoz!
practical experiments (reproducible):
Take for example this situation: Demented Shaman and some Hellbourne creeps approach a tower. The tower targets the first creep that gets in range and kills it, then picks another melee creep and targets it. Meanwhile Demented Shaman is attacking the tower.
Now, some Legion creeps come. The Hellbourne creeps switch to attacking the Legion creeps, while Demented Shaman continues to attack the tower. Because this isn't a Rule 1 trigger, Demented Shaman will not be shot at if the melee creep that is targeted is still alive. In fact, Shaman can keep that creep alive longer through healing and Arcane Hide in order to get even more attacks in on the Tower. However, when the creep is about to die, Demented Shaman should stop attacking the tower and let it acquire a new target before he continues to attack the tower - otherwise, the tower will attack him, and he will be forced to back away if he doesn't want to be shot at.
In another situation, Keeper of the Forest and two Forsaken Archers are attacking a Legion Succubus next to a Legion tower. (Training mode okay >.>) Tree moves in first and gets shot at by the tower for attacking Succubus. Then, the two Forsaken Archers (let's call 'em FA and FB) move in and begin attacking Succubus. Now, the tower will continue to attack Tree until I press the Kill! button and he dies. Then, because FA is closer to the tower, the tower attacks FA. Now if FA presses hold and waits for FB to continue attacking Succ, the tower will attack FB. FA can then continue attacking Succ without getting shot at, even though she is closer to the tower, until FB gets Mesmerized by Succ. At that point FA will be the only one attacking Succ, and she will be fired upon.
Credit goes to Meowshi's guide to Heroes of Newerth Basics for the basic info, and to those who questioned me and got me to investigate further. As always, any feedback and independent information is appreciated.
I maintain an open call for any replays, videos, or other such evidence that contradicts anything in here.
I am aware of the issue of it switching targets between creeps and... guess what! siknoz to the rescue!
Last edited by light_rain; 03-04-2010 at 09:05 PM.
Nice![]()
S2 Games: Dedicated employees serving dedicated gamers. Continuous development. Never-ending improvement.
-----------------------------
Tech Support and Customer Support: https://www.heroesofnewerth.com/support/
Look for my highlighted text (important information) and grey text (interesting but not required information).
After the twentieth time I read a post saying the tower ai was all f'ed up and random, I made this guide. It actually took a bit of research, because A) the weird way it will occasionally switch targets on creeps, which is a creep ai thing and not a tower ai thing, and B) the fact that it doesn't switch off a nearby, non-aggressive target of something else attacks the tower is not obvious.
Why cant we do the trick we used to be able to do in Dota? That is, issuing an attack command on ANY allied unit (on any hp) will force the tower to stop attacking you, provided it has another target to acquire...
Last edited by Wize; 03-03-2010 at 07:27 PM.
S2 Games: Dedicated employees serving dedicated gamers. Continuous development. Never-ending improvement.
-----------------------------
Tech Support and Customer Support: https://www.heroesofnewerth.com/support/
Look for my highlighted text (important information) and grey text (interesting but not required information).
Someone asked about that in the first thread. Simple answer is they didn't code that in.
This question has not been solved yet:
Why do towers switch target from a melee creep (with health left) to a ranged creep when you advance the tower and draw creep aggro? This never happened in DotA and I've lost a lot of creep kills due to it...
Similar question has been asked by Vulpes in the longer thread:
No that's not what I meant, the AI is a bit buggy in DotA and even though I A+attack my allied creep MULTIPLE times, it fails to work (this is 50% of the times of the attempts in a certain timeframe). The other 50% of the time though it magically works (for some unknown reason).
I don't really like arguing semantics btw
S2 Games: Dedicated employees serving dedicated gamers. Continuous development. Never-ending improvement.
-----------------------------
Tech Support and Customer Support: https://www.heroesofnewerth.com/support/
Look for my highlighted text (important information) and grey text (interesting but not required information).
I've been able to reproduce but not explain it with a hero that's moving. When your hero stands still and doesn't move, I have not been able to reproduce it. I plan to test that a bit more (and also test this HP thing that was in DOTA) when I have time this weekend (this computer can't run HoN)
If you ran the practices in a slower time scale you can see why this is. And to answer the previous question about why does the tower switch target I will try to explain, if anyone sees a flaw, or knows specific coding that I don't have access to please rebut.
When a tower is targeting a unit, it runs through its lines of priority. To start, take heroes out of the equation.
A) Tower will attack the CLOSEST target, so if you take out a creep wave(legion) instantly, and a wave(hellbourne) is approaching the tower, the FIRST unit that comes within attack range of the tower will be "locked" and attacked. This will not change UNLESS changed by a hero(I will explain in a min). After that first target is dead, it will run through its priority again(at this time there is 4-5 creep within range), so the list broadens, now it will target the lowest HP creep possible. If all are the same, then the closest one will be targeted.
You allow the units to attack the tower first, all melee, all ranged attack the tower, you move up to draw aggro and you move back or circle around the tower. In this case, if you manage to aggro ALL creep in the area, they all only have a "lock" target (you) but none have actually attacked. Apparently there is a difference between the "lock" and the actual "attack". Of course while this is all happening the tower is attacking the melee creep(the first one that came up to the tower) but after they have shifted and "locked" on the hero, they start moving towards the hero, *IF* the ranged creep is the first to ATTACK the hero, then the ATTACK command takes precedence over the "LOCK" command. This is why the tower suddenly switches from the melee creep that isn't dead yet, to the ranged creep. Because the ranged creep is actually ATTACKING the hero, while the melee creep technically aren't. The tower's FIRST priority is to attack units that are ATTACKING the hero.
B) Now we will add heroes into the mix. Lets say you are defending the tower and try to pull the creep away from it. Here is where it gets tricky,
If an enemy hero comes to the tower and either 1) attacks the hero or 2) attacks the tower long enough to draw aggro then the creep will switch from you, back to the tower. However sometimes the ranged creep does not switch to the tower depending on the range of the creep in reference to the enemy hero and the tower. So if that happens, again the 1st scenario I outlined above will take place and the tower will switch to the ranged creep again(if its the only unit attacking you).
This works 100% of the time in practice mode. I will try to get another video that shows a clear example.
Last edited by siknoz; 03-04-2010 at 08:21 PM.
Ok, I finished the video, I even added in a bonus for ya ^_-
In the first segment it basically does what you said it does. Exactly the way I explained, since the ranged creep was technically the FIRST unit to attack me, the tower switched from the melee to the ranged.
In the second segment it shows that I can manipulate it and make it attack a different melee creep too. Notice the melee creep attacks me before any other units do, so the tower switches from its current target, to the attacking target.
http://www.youtube.com/watch?v=kHYplTAGVwI
Enjoy..hopefully this answered Cordial's question.
Also if you want to avoid having the tower switch targets, simply move up enough to allow the melee creep to attack you(actually swing at you), after that the tower target will be LOCKED and won't change.
Last edited by siknoz; 03-04-2010 at 08:23 PM.
It did answer my question, thank you.
Harder to get gold for the ranged creep but instead offer opportunities to manipulate the tower.
Awesome. Simply awesome. Someone give this man a puzzlebox.
Did you mean "any unit attacks an ally hero in range"? or "any unit in range attacks an ally hero"? Or are both true?
Situation A:
Legion Hero close to Hellbourne tower. Legion Hero is not current target of tower. Legion Hero right clicks a Hellbourne hero across the map. Would this trigger the tower AI (causing tower to attack Legion hero)?
Situation B:
Legion Hero at Legion well. Legion Hero right clicks a Hellbourne hero near Hellbourne tower. Would this trigger the tower AI (causing tower to attack a new Legion creep)?
If Situation B is the case, this could explain some of the wacky change of hearts that towers seem to exhibit... an unseen enemy is unknowingly messing with your tower's AI from across the map!
Most anomalies involve creep following ai and are nicely explained, or at least demonstrated, by siknoz.
I'm pretty sure it should be "any unit in tower range attacks an ally hero" but I might as well test it to be sure. Thanks!