HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Computer AI for Footwars

02-18-2004, 05:43 AM#1
Telamon
To test my footwars map while I am writing it, I whipped up a couple of quick triggers that allow the computer to play. Basically, every 20 seconds, I grab all the units that the computer owns around it's barracks and tell them to attack-move to the middle of the map. This works great for footmen, but I'm having trouble with the heroes. They will go to the middle of the map and fight, but none of them will use any of their spells. Is there a setting or something I need to flip somewhere to make this work?

I did try turning on the melee AI, thinking that the use of hero spells was somehow hard coded into the game, but that messed up my trigger that tells all the units to go to the center of the map.
02-18-2004, 05:48 AM#2
RaeVanMorlock
I'm not well-versed in the making of WC3 AI, but you can certainly issue orders for the heroes that'd force them to use their abilities. Making it effective could be a bit of a challenge though.

If nobody can reason any better answers, like "oh turn this flag on and voi-la", then you may need to just think of how you'd play the game and code the heroes appropriately. It would be nice of there was flag or something to set for it though ^_^
02-18-2004, 09:07 AM#3
sgtteflon
They will automatically use their abilities according to hard coded constants, assuming they know what the abilities are (read: unmodified). However, the problem is they wont do so until theyve completed the order you force-fed them (attack move to the center of the map).

The only solution is to program in a very simple AI that tells the AI to send out waves of attackers every time it gets 10 footmen or whatever, and to use its hero. Its actually not hard to do at all.

As long as the used abilities are normal, the heros should use them. If theyr custom, youll need to add them to the AI script (export your ability data, import it into your AI script), and then tell the AI when its appropriate to use it.

At least, I think thats how it goes. To be honest, I havent done much AI work either, but that is how it works with custom upgrades.
02-18-2004, 11:04 PM#4
Telamon
I am telling the computer to select every unit in it's base and attack-move them to the center of the map. The heroes that the computer is using are unmodified. Are you saying that the attack-move order is never completed and that's why the heroes aren't using their abilities?

When is an attack-move order complete? When the unit arrives at the location, or when all the enemies at that location are dead?

"The only solution is to program in a very simple AI that tells the AI to send out waves of attackers every time it gets 10 footmen or whatever, and to use its hero. Its actually not hard to do at all."

Ok, I think I'm doing the first part of that. Please explain in more detail how I instruct the computer to "use it's hero".

I understand that the use of specific hero abilities in combat is probably handled in code deep within the war3 tactical AI (the part that handles unit micro). My assumption was that this AI would use hero abilities to hurt the enemy in response to "attack-move". Would it work better if I selected a random unit and told the hero to attack it?
02-18-2004, 11:23 PM#5
RaeVanMorlock
An "Attack" order is simply that... grab your weapon and beat this thing to a bloody pulp. It's not "tactically destroy this unit" or "unleash a barrage of special abilities to decimate this foe" -- it's simply attack. Same as if you were to select the unit, push the attack button (hotkey "A") and target some unit or location.

And attack-move order is the same as a move order, except that the unit will attack any enemy units along the way. As such, it finishes when the unit reaches the specified destination.


An alternate method they may work with the Melee AI stuff would be to order ALL computer-controlled units in the game to attack-move somewhere... say, every 10 seconds of the game. In this regard, you could order hero units to "Stop" whenever they're attacked so that the AI will hopefully have them use some abilities. Then when the next 10 second interval comes up, the hero will be ordered to attack-move towards the center so as not to be stuck at any point for more than 10 seconds.
02-19-2004, 01:10 AM#6
Telamon
That made a lot of sense to me. I think the quick fix that I'm looking for is a test every 40 seconds that tells all computer-controlled heroes in the center region to "stop". Then maybe they would start using their skills. Hmm...

It's something to think about at least. Thanks for the input!
02-19-2004, 04:34 AM#7
zotax
I dont think a every 30 secs attack move to the center thing will work at all, best to leave advanced unit controll with all its allies and do what Panto did, through the AI Editor so that their heroes will use abilities automatically, and attack when allies do so.
02-19-2004, 10:04 AM#8
AIAndy
This AI script might help:
http://www.wc3campaigns.com/forums/s...threadid=42046