|11-19-2006, 06:48 AM||#1|
Tutorial: The WC3 AI Editor
Firstly, if you are looking at this tutorial to create anything other then a simple campaign/melee AI to make a computer army control it's units like other standard computer armies, you should probably stop reading now. Search up a good single-hero AI tut such as this, made by Conan of TheHelper.net (Was Anub'Arak here)
The AI editor is a fairly simple tool, although it can be confusing to new mappers because of its layout. The game uses .ai files to command units, but ai editor files (before being converted to game-readable .ai files by the editor) are stored as .wai.
This tutorial is split up to do a surface covering of the important aspects of each of the different tabs in the editor:
I. General II. Heroes III. Building IV: Attacking V. Test Configuration VI. Finishing Up
I. General Tab
The 'General' Tab is, as its name implies, very general. Parts of the general tab, starting from the top left:
-Name: The name of the AI that the game uses. If the box below that says 'set player name' is checked, whatever army in-game that uses this AI will have the name you enter here be their player name.
-Race: This is obviously important; an orc AI can only make orc units. If you want to be free in that sense, you can pick 'custom'. This opens up other options so you can create custom races AI's. However, to use custom units in an AI, you need to open up the object editor where the custom units are, use the 'export all object data' under the 'file' menu, and import the data into the AI editor using the custom data area on the bottom of the general tab.
-The 'option' section which contains the 17 checkboxes:
-The custom data section: The uses of the import option are explained 8 lines above on this page. Export will export whatever custom data you've already imported. Clear will delete it from the AI.
-Conditions: This is nothing but a big scary white box that does absolutely nothing by itself. You can set up conditions in here for use in the 'building' and 'attacking' tabs. This is explained in tut sections III and IV. Note that you don't actually NEED to write your conditions here to use them in a different part of the editor; any option where you can use conditions has an option to either use a condition specified in this menu OR create a new one right there. However, when you have a condition that will go through multiple uses for a part of the AI's system, it's good to write it in here for use elsewhere.
II. Heroes Tab
This tab controls what heroes the AI will build by default and abilities it learns on those heroes.
Parts of the heroes tab:
-Heroes used: Interestingly enough, and sadly, it's impossible to make an AI with this editor that is capable of picking between more then 3 heroes, or capable of using more than 10 ability levels. If you want the AI to never get heroes, you can just set all 3 boxes to 'none'. If you only want the AI to get 1 hero type, just fill in the 1st box. If you want the AI to pick between 2 hero types, fill in 2 boxes. If you want an AI army that can pick between 3 hero types, fill in all three.
-Training order: Self explanitory. It just lists all the possible combinations of hero choosing order, and you set which ones you want to occur and how often. For example, if you only want 1 of the orders to ever happen, just set that order to 100%.
-Skill Selection: The tab brings down your lists per hero, and the box on the left below is for choosing what the ability skilling order you want that hero to get is. The boxes to the right are for if you want the hero to level abilities up differently depending on when then hero is picked.
III. Building Tab
This is a very important tab. It not only controls build order, but how many workers do what. Parts of it:
Base Building: This option is only useable if you set race to 'custom' in Tab 1. It's very simple, just set it to the AI's town-hall style building and it'll work fine.
Mine Building: This is only used for custom AI's and only for the Undead style of gold mining where you build the building over the mine. Don't ask why night elf gold mining doesnt use this too, I honestly have no idea. Again, if you're using that style of gold mining, set it to the building your race uses. Otherwise, if it harvests gold normal, leave this as 'none'.
-Build Priorities: This is the build order of your AI, and controls all construction and unit training. It's also the first part where you use conditions. There really isn't that much to say about this, but it is of vital importance. The things closer to the list top are to be built sooner than things near the bottom. Also, Conditions: When you set a condition to one of these, if the condition isnt true when the priority list reaches it, it ignores that object totally until the condition is true. Another thing to be noted is that the AI doesn't understand techtrees, and has some evil 'features' that will screw stuff up. If you have the system queued to make a thing, and it doesn't have the tech requirements for that thing, it will build whatever was last on the list, forever. So if you have a farm on the list right above a gryphon aviary, and the AI doesn't have the tech requirements for the aviary, it will build farms forever.
-Gold worker: Custom race only option. Set it to the worker unit of your race that you want to mine gold.
-Lumber Worker: Custom race only option again. Pretty much same as gold worker option.
-Harvest Priorities: Workers will not do resource gathering without this. A good idea is to have 5 set to gold at each mine your AI might have. This list also has conditions so the AI will ignore harvesting priorities if the condition isnt set. For example, rather then just setting 5 gold workers to work on mine #2, add a condition to check that your AI actualy has 2 gold mines (eg 'number of mines owned greater than or equal to 2'). This chart, as with the other in this AI editor tab, take some practice to coordinate things properly.
IV. Attacking Tab
This is the final tab that controls what the AI will be like in-game. It controls how the computer uses military units. I'm going to go over this tab a little differently then others because theres some things about it that are actualy important and some things that aren't, and I'm basically going to go over the standard way of setting it up, which most people use. There are many ways to set it up, but in general (like, 99% of the time. No joke), people do it like this:
-Attack groups: Make 2 attack groups. Call 1 minimum units and call the other 'main attack group' or something like that. Unit settings for the group currently selected can be found in the white box to the right. Minimum should contain the fewest units that you ever want your AI to leave base with. Basically, the units that the AI will initialy creep with and whatnot. This should contain the hero and at least several of the army's basic units. A good setup for a human AI might be:
first hero...quantity all...conditions none
footman...quantity 2...conditions nonw.
The other attack group should contain everything that you ever want the AI to attack with. Basically, list the first hero and every single attack unit that exists in your building priorities that you want to leave base. If you want that 1 mortar team your AI will make to stay and defend the base, dont list mortar teams in the main attack group. However, even if you leave a unit to defend base, if an enemy aggros the base that unit may run around in retaliation strikes.
-Attack waves: Using the standard method, just make 1 attack wave, and make the group it uses be the 'main attack group' thing. Thats all you need to do.
-Minimum Forces: Set it to your 'minimum' group
-Initial Delay: This is almost always 0. Yes that sounds very untutorial like, but thats what is almost always done with this value, and it always works properly like that in a basic sense.
-Repeats waves: We only have 2 attack groups, and 1 of them is the general 'attack' group, so this should be 1.
-Target priorities: This is very difficult to explain in a tutorial and regardless of skill with the AI editor will require testing of the AI to work it how you want in a map. The things at the top of the list, as long as the conditions you give it are met and the AI is ready to do that thing, will be top priority. Note that in a standard map the default arrangement works pretty well, in case you don't want to mess around with it and test it for a campaign map with several ai players and whatnot.
WARNING: DELETING THE CREEP CAMP PRIORITIES MAY RESULT IN AN AI ARMY SITTING THERE DOING NOTHING
V. Test Configuration
This tab is for testing the AI vs yourself or other AI. If you want it to fight with/against other AI scripts you made, you can select ai type custom in the ai column and import a .ai file.
VI. Finishing Up
There are 2 ways to save an AI for use:
1. Adding it to the map directly. To do this, when you're done with your ai, have the map you want to add it to open and go to the ai editors 'file' options and select 'add to map'. The ai is now attached to the mao directly and can be accessed from the map editor at any time by opening the ai editor and closing any other ai's.
2. Go to 'file' and select 'export script' to save it as a wc3-readable ai file (.ai). Now you have a .ai file which can be imported into a map or campaign and run using the trigger action AI-start campaign AI script.
Note: .ai files can be opened in notepad and directly edited in JASS. There is a tutorial available on how to create and/or edit AI files using JASS:
JASS AI tut by Moyack
Last edited by PitzerMike : 12-15-2006 at 05:30 PM.
|Sponsored Links - Login to hide this ad!|
|11-20-2006, 09:13 AM||#2|
Making An Simple Melee AI
Here are some additions to the tutorial and a demo map from Av3n:
The First Tab ~ General Stuff
Okay the boring General Stuff for each section.
Name: Raiders AI
Set Player Name: checked
Defend Users: unchecked
Random Paths: unchecked
Target Heroes: checked
Repair Structures: checked
Heroes Flee: checked
Units Flee: checked
Groups Flee: unchecked
Have No Mercy: checked
Ignore Injured: unchecked
Remove Injuries: checked
Take Items: checked
Buy Items: checked
Slow Harvesting: unchecked
Allow Home Changes: unchecked
Smart Artillery: checked
Start Expansion (Integer Contdition) : (Total Unmined Gold Owned) Equal to 5000
Here is an screenshot of what I've done:
The Second Tab ~ Heroes
The Two Heroes Im going to use are the Shadow hunter and Tauren Chieftan.
Put on any abilities you want any order, I don't care.
Here is an screenshot of what I've done (For the abilites and training order.)
The Third Tab ~ Building
The training order Im going to list the tier 1 stuff, the workers and thats all. (You can find everything else in the demo map.)
The exact listing for Tier 1 (Bold equals buildings, Italic equals upgrades.)
Great Hall x1
Altar of Storms x1
Orc Burrow x1
Hero - First (In my case it would be Shadow Hunter)
Orc Burrow x1
War Mill x1
Troll Headhunter x1
Orc Burrow x1
Steel Melee Weapons x1
Then so on...
5 on gold (main)
4 on lumber (main)
3 on gold (expansion 1)
1 on lumber (expansion 1)
Here is an screenshot of what I did (including some of tier 2 and tier 3 if you can see it).
The Fourth Tab ~ Attacking
Attack Groups and priorities, Im only going to the Creep Group and adding the attack waves and priorities.
Hero - First
Hero - Second
Troll Headhunter 2-3
Troll Berserker 2-3
Set all time stuff to zero then add Creep Group to the wave section.
1.Creep Camp (0-9)
2.Common Alliance Target
3.Enemy - Expansion
4.Purchase Goblin Zeppelin
5.Enemy - Major Assault
6.New Expansion Location
Here is an screenshot of what I've done.
Well this is the end of the tutorial, look inside the demo map and play against my Raiders AI(Hopefully you can beat it cause it is very easy), check the Raiders AI by exporting the Raiders AI from the map.
Happy melee AI designing!
Last edited by PitzerMike : 12-30-2006 at 02:27 PM.
|12-15-2006, 05:28 PM||#3|
Tools & Tutorials Moderator
Ok, I've now merged in Av3n's tutorial.__________________
Last edited by PitzerMike : 12-30-2006 at 02:28 PM.
|10-27-2007, 05:52 AM||#4|
Join Date: Mar 2007
i made an ai for my map, and it builds good all the buildings, but its weird when it comes to upgrades....__________________
4. Spear Barracks
5. Vodoo Lounge
6. Hunter Tent
7. Vodoo Lounge (if food >= 8)
8. Wolf Cave (...)
9. Spear Barracks (...)
10. Wolf Cave (...)
11. Vodoo Lounge (if food >= 12)
12. Barracks (...)
13. Berserker Barracks [is upgrade of barracks]
14. Greater Vodoo Lounge [is upgrade of vodoo lounge]
15. Survivor Tent [is upgrade of Hunter Tent]
16. Greater Vodoo Lounge (if food >= 8) [is upgrade of vodoo lounge]
17. Beast Cave (if food >= 8) [is upgrade of Wolf Cave]
.....and so on
Now the AI builds all the non-upgrade buildings really fast and good, but when it comes to upgrading it gets lazy, and doesn't upgrade??? It sometimes upgrades one or two buildings and thats it, altough it has enough food and gold to upgrade on.....
|12-06-2007, 12:13 AM||#8|
Join Date: Mar 2007
I'm sorry for replying so damn late, but I totally forgot about this post.
I made screen shots of the AI-Editor and highlighted spots, so you know where it recommenced.
The conditions are:
Prehistoric - Total Number of Village units bigger than 0
Medieval - Total Number of Castle .... 0
Industrial - Total Number of Capitol ... 0
Medieval and Default - Medieval and food >= 12
Medieval and High - Medieval and food >= 16
Prehistoric and Default - Prehistoric and food >= 8
Prehistoric and High - Prehistoric and food >= 12
Catapults - Medieval and Melee Difficulty level >= 2
CatapultsNot - Medieval and Melee Difficulty level < 2
For further understanding:
Food is given to players per trigger and increases with every Age by 4
Ages advance all 5/10/15/20/30 mins depending on settings
When a new age begins, all old buildings will be replaced by a trigger to match new age
Last edited by Hoernchen : 12-06-2007 at 12:15 AM.
|12-07-2007, 04:58 AM||#10|
Join Date: Mar 2007
i already tried running different AIs but somehow loading a new AI over the old one screws him up and makes him useless. also he doesnt even build properly for the 1st age, he only upgrades like 1 or 2 buildings when i tell him to upgrade 10__________________
|11-25-2009, 12:43 PM||#12|
Join Date: Nov 2009
I have a problem here. I've tried both ways of finishing up the AI but it seems like the custom made AI won't take over. I've tried triggering it at map initialization after or before the default startAI action then create a - Start Melee AI - choose the .ai file that is imported. If the custom AI take over, it will change its name. But it doesn't seem to work (only worked on test AI). Any idea?
Nevermind, problem solved after found an unprotected map.
Last edited by leric : 11-25-2009 at 03:03 PM.
|Thread Tools||Search this Thread|