- Joined
- Feb 15, 2006
- Messages
- 851
AI EDITOR
An easy start to the AI.
An easy start to the AI.
By moyack
Under construction
Recommendations: This tutorial is best viewed in Firefox with 1280x1024 monitor resolution
Index.
Introduction.
Due to demand in AI information, I've decided to start a tutorial about the AI editor. I'll do my best to make it as easy as possible, anyways if you have any question, I'll answer it here.
This text will have reference information from this tutorial: The WC3 AI Editor by uberfoop and Av3n which is more related with AI editor functionality.
Let's start.
Starting the AI editor.
To start the AI editor, you should open WE and press [BROKE=F8]F8[/BROKE] or this button
When you open the AI editor you will have this interface:
This interface shows the General tab, we will use it to set the general configuration and global conditions. Because we want to start quickly with our AI, we are going to set the basic features.
First we need to define what kind of AI we are going to do. If we are going to make an AI using a standard race, we should choose in the race combobox the respective race, or custom if we are planning to make one based on a custom race in a map. If we select a normal race, we won't be able to use units from other races, only the standard, campaign or custom ones for the selected race. Custom race in the other hand allow us to select any unit defined in the object editor.
See General Tab reference
Starting a new AI.
Because an example is a good start in the learning process, we are going to emulate a famous human strategy: Mass sorceress. This strategy consist in reach quickly tier 2 to train the sorceress, and then reach tier 3 to get the master training and make this strategy unbeatable. What we will need? well, besides the sorceress, some units from the barracks, mainly footman for tier 1 that can be replaced by knights in tier 3, mortar team as siege support, some special units like priest, and a good support hero for the casters, in this case it will be the Archmage with its summon water elemental + brilliance aura skills. I've seen this strategy sometimes done with a Blood Mage as a second hero (because it can offer its damaging and disabling abilities as an advantage), so I'll add in this strategy too.
With a defined strategy to make, I'll select Human race in general tab, and set the AI name as: Sheep lovers (Figure 2). With this configuration done, we can go straight to the Building tab. |
Figure 2. Our first starting... |
What can we see?? Basically there is an interface conformed by two list box, the left one is to define the building priorities and the right one is to define the harvest priorities (Figure 3).
Figure 4. Adding a new unit in the building editor | Why is it called building priorities? what's that? The AI will build the units following the list order, but if any previous unit or building is killed, the AI will give priority to replace the fallen unit according to the list order. Now that we now how the priorities work, let's start adding some units to this list. As you can see, the list is prefilled with the main hall and 5 peasants, those units are the first units set in a melee game, and with them we are going to build our town. First of all, we need to build a barrack, a farm and an Altar of Kings buildings. To do that, we select the last unit in the list, right click with the mouse, and we will have a menu with the options (Figure 4). We select Add priority..., and a dialog box will appear: the unit type dialog box (Figure 5). |
Figure 5. Unit type dialog box. |
Here we have different options:
- Town: Here we select in which town we are going to train or build the unit required. The options are: Any (suggested), Main (The town at the player start location), Expansion # (Refers to a mine WITH the town hall), Mine # (Refers to the mine expansion location, not necessarily it should have the town hall).
- Build: Here we select the unit which we are going to train. Options are: Hero first, second and third (This will be explained later), Expansion Town, Specific unit and Specific upgrade.
Picture 6. Our first buildings | For our example, we are going to order to the AI to build a barrack, then a farm, and then the Altar of Kings, then we must say to the AI to build more peasants, so they can harvest wood. To do that, we select in Town: Any, Build: Specific Unit, and then we select the barrack building. and press OK. We do the same for the other buildings and units (Figure 6). As you can see, we must do that for every unit / upgrade we want to build. The question is... is there a faster way to do that?? Of course yes For the peons, I just select the last peon, and then make CTRL+C (or do right click and select copy in the pop up menu), and then paste it by pressing CTRL+V. Repeat this step until you get 10 peons. |
Now let me see if you do the things in the right way. If you add peasants until get 10 units trained, you will see something like picture 7, but if you paste 10 times the peasant (or even better, 18 peasants... YEAHHH), you will have something like the picture 8:
Picture 7 - Added peasants until get 10 of them trained |
Figure 8 - Added peasants in excess |
As you can see in the picture 8, the last peon is shown in red, why?? because the interface is indicating that the the food produced is not enough to keep the units trained, if you add a food provider building prior to this unit, it will be marked in black again.
Because we won't need that amount of peasants at this level, we will remove them until get 10 peasants (like picture 7). Later we will add more peasants when we manage expansions.
Ok, I think it's time to add some attacking units to this AI, so let's add 3 footmen and the First hero. First add a farm so we can have enough food for the next units, then we must add the first hero, do right click over the last unit in the list and select "add priority...", in the unit type dialog box we select in the Build combobox: "Hero - First", then we make click in [BUTTON]OK[/BUTTON]. After that, we add the footmen units, I suggest 3 of them. After doing this, the priorities list should look like the picture on the right (Picture 9). Our first test. With this small progress, we can do a test to this AI. To do that, you can press CTRL+F9 or this button
|
Figure 9 - AI with the first warrior units. |
Hero Settings.
As we know, the heroes in WC3 are a very important component for the game, for its skills and attributes which makes them unique, affecting the game flow for good or for bad. The hero effect in the game depends on the following factors:
- Heroes selection and order (which hero is trained in which tier)
- Skills selection in all the heroes
Now that we understand how important are the heroes for the AI, we are going to check it out the Hero interface. Select the "Heroes" tab in the AI editor and you will see this (Figure 10):
Let's enumerate the interface functions:
- We have a section called "Heroes used" to select which heroes will be trained for the AI.
- A "Training Order" section where we indicate the chances that the AI will train heroes in a specific order, showing us the different combinations.
- And finally a the "Skill selection" section, where we define in which order the heroes skills are learned. As you can see, the skills per hero can be different depending of the tier which the hero is trained.
Now... how can we configure this interface according to the AI example?? as you remember, we need to train 2 heroes only. We can set this by assigning in the "Heroes Used" section the third hero as None. When you do that, automatically the interface disable some parts of the interface (very convenient :emote_wink: ). After doing that, select in the first choose box the Archmage and in the second one the Blood mage. Then set to 100% the chances that the AI trains fist the archmage and then the blood mage. You will notice that the second option (first bloodmage and second archmage) is set to 0% automatically. The interface should look like this (Figure 11):
And the last thing to do is to set the skill learning order for each hero. To do that, we select in the "For Hero" choose box the hero which we want to modify the skills order, and we arrange them by selecting each one and modifying its order with the [button]Move Up[/button] and [button]Move Down[/button] buttons. For our AI example, we are going to modify the Archmage's skill order to this one (Figure 12):
|
For this case I consider the Blood mage abilities are ok, but if you want to change them too, go ahead
Now that we know how to set up the heroes for our AI, we are going to deal with other important AI Editor feature: Conditionals.
Conditionals.
One of the most important features in the AI Editor is the Conditionals. They can be used to help the AI to take a right decision according to the situation at some point, making more "smart".
Where can you apply the conditionals? they can be used in:
|
Figure 13. Conditional menu |
Figure 14. Conditional Dialog Box |
Figure 15. Configure Condition dialog box | By default, this dialog box is set to none. In order to create a new conditional, we must do click in the list box, and select "custom", this will enable the button [button]Configure Condition[/button]. Now you can press it and a new dialog box appears (Figure 15). In this one you will feel familiar, because it's similar to the trigger editor dialogs, the only difference is the kind of data that you can select in it. The comparisons are classified in:
The last two kind of Comparison enable And and Or operations between other comparisons, so you will be able to do complex evaluations. A complete list of comparisons can be found in the AI Editor tutorial by Av3n |
I think it's time to do a conditional for our AI example. As you can remember, the AI only will train the first hero if it has built 10 peasants and a farm, as you can see, putting the AI to wait until this is a waste of time, it will be better if as soon as the Altar of Kings is built, we put the hero to train. In order to achieve this behavior, we must change the hero priority before the sixth peasant. If we left the things as is, the other 5 peasants won't be trained until the hero begins its training at the Altar of Kings. So we are going to configure the AI so it will train the first hero as soon as the Altar of Kings building is completed, if not, it will train the other units and buildings.
First we have to put the Hero First priority after the Altar of Kings building, then we select it, and then we do right click over this priority selecting "Modify Condition..." Figure 16.1 |
After the AI condition is selected, we change in the Condition list box to Custom. We'll see that the button [button]Configure Condition[/button] is enabled. Figure 16.2 |
Press it and the "Configure Condition" dialog box pop ups. Having that, we select an "Integer Comparison" and we'll see a text in hyperlink showing a dogmatic true 0 = 0. Let's click on the first 0 Figure 16.3 |
With the Integer comparison dialog box opened, we browse through the integers functions and select the item with the label "Unit - Total Units of Type - Completed Only". Then we press the [button]Ok[/button] button. Figure 16.4 |
Now that we have selected our function, we must define the unit type to be counted. In this case we want to check the amount of Altars of Kings. We make click in the link text, and this will open this window. Figure 16.5 |
Now that we have selected that unit type, we will see this dialog box "filled". After this press the [button]Ok[/button] button. With this we have defined the first element of comparison. Figure 16.6 |
Now let's define the comparison operator. Select in the "Configure condition" dialog box the Equal to link. This will open this dialog (Figure 16.7). After selecting the appropriate comparison operator (In this case Greater than), press the [button]Ok[/button] button. Figure 16.7 |
Because we need to do a comparison to a value greater than 0, we don't have to modify the comparison value. But if you need to change that value, just make click in the integer and change the variable in the value that you need. When you have the conditional set, just press the [button]OK[/button] button. Figure 16.8 - Almost finishing the conditional |
Congratulations!!! you have done your first conditional!!! Now it's time to save it, so please press the [button]OK[/button] button in the AI condition dialog box. Figure 16.9 - Conditional finished... saving time!! |
Attachments
-
AI Editor Icon.jpg918 bytes · Views: 2,126
-
Basic Conf1.jpg5.6 KB · Views: 272
-
Conditional Dialog2.jpg14.3 KB · Views: 229
-
Conditional Dialog.jpg7.6 KB · Views: 205
-
Conditional Ex1.jpg13.6 KB · Views: 192
-
Conditional Ex2.jpg8.1 KB · Views: 233
-
Conditional Ex3.jpg21 KB · Views: 267
-
Conditional Ex4.jpg33.3 KB · Views: 238
-
Conditional Ex5.jpg49.5 KB · Views: 284
-
Conditional Ex8.jpg16.5 KB · Views: 203
-
Conditional Ex9.jpg11.2 KB · Views: 195
-
Conditional menu.jpg8.9 KB · Views: 194
-
Hero Interface small.jpg40.9 KB · Views: 214
-
Hero Interface.jpg80 KB · Views: 315
-
Hero settings 1.jpg80.3 KB · Views: 249
-
Hero settings 1s.jpg39.7 KB · Views: 213
-
Hero skill order1.jpg15.8 KB · Views: 267
-
Interface1s.jpg26.6 KB · Views: 200
-
Interface2s.jpg29.4 KB · Views: 198
-
Interface3.jpg16 KB · Views: 217
-
Interface4-1.jpg19.9 KB · Views: 228
-
Interface4-2.jpg32.1 KB · Views: 274
-
Interface5.jpg26.3 KB · Views: 233
-
Menu1.jpg18.5 KB · Views: 304
-
Test_Button.jpg920 bytes · Views: 888
-
Unit selection1.jpg33.2 KB · Views: 291
Last edited: