1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  4. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  5. The Secrets of Warcraft 3 have revealed interesting works. The RESULTS for Abelhawk's Mini-Mapping Contest #15 have come out!
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Night Rider gained several songs for his journey. The poll for the 12th Music Contest has started. Check it out!
    Dismiss Notice
  9. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

AI Editor

Discussion in 'General Mapping Tutorials' started by VeljkoM, Apr 1, 2010.

  1. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    AI Editor


    Introduction:

    AI Editor is simple way to create AI for existing or custom race other then use of JASS. AI editor is used for making "Melee Maps or Campaigns", for other type of maps (AoS, TD...) you should use triggers. This tutorial will teach you the basics and hopefully you will be able to make our very own AIs. It is recommended you have at least basic knowledge with triggers.


    General Tab

    Clip.png
    This is where we begin. First thing you will probably do is set AI name and AI race. If you are making AI for custom race, allays remember to set race to be custom.

    -Options-
    This is quite simple. You will check certain options for AI that will effect it in game. It is already explained in AI Editor but just in case:
    Options
    *Set Player Name - This option enables use AI name as the AI players name.
    *Melee - To use Melee AI for standard games. Melee AI tend to attack and defend more closely to with allied player.
    *Defend Users - AI will try to defend attacked user-controlled players.
    *Random Paths - AI will tend to use paths more randomly.
    *Attack Heroes - AI will place higher priority on attacking enemy heroes.
    *Repair Structures - Workers will automatically repair structures.
    *Heroes Flee - Heroes will leave the battle if they are seriously damaged or incapable of attacking.
    *Units Flee - Units will leave the battle if they are seriously damaged or incapable of attacking.
    *Group Flee - AI will try to avoid battles where he is at disadvantage and will run from the battles where he is loosing.
    *Have No Mercy - AI will attack when his enemy is at disadvantage or if it is injured. The target corresponds to Enemy-Major Assault (more about this down)
    *Ignore Injured - When preparing attack force AI will not use units with health bellow of 50%
    *Remove Injured - AI will send injured units back to base or Fountain of Healing.
    *Pick Up Items - Heroes will pick up items they find.
    *Buy Items - Will buy useful items from any shop they encounter.
    *Slow Harvesting - AI will gather only 1 gold and wood. instead of workers capability. This gives AI serious disadvantage.
    *Allow Home Changes - AI will be able to chose new locations as Main Base where he will gather attack force and send injured units.
    *Smart Artillery - Artillery units will tend to come in front of the attack force and will siege the enemy base if possible.


    -Conditions-
    But what is more important is window for conditions, they are almost same as the regular editor triggers. Condition you make here will be used latter for unit creation and attacks. Here you'll be able for example to make simple condition like "If number of footmen equal to 5" which you will then use in latter tabs. Conditions are extremely important for your AI.

    -Custom Data-
    Another important thing here is Custom Data import. Because AI editor is not connected to the map in World Editor you'll first have to extract data of your race from object editor. Go to object editor-file-extract all custom data..." and then simply import them. Its important if you are making a custom race.

    Hero Tab

    Clip_2.png

    In a Hero Tab you will be telling AI what to do with Heroes.

    -Heroes Used-
    Here you'll set which heroes will be used. You can use any of the already existing heroes and custom heroes but you can chose only 3.

    -Training Order-
    Here you will set in which order heroes will be used. You can make 6 variation of order which AI will use depending of chance % you set.

    -Skill Selection-
    Here you will make order by which abilities will be learned for each hero. For each hero there are 3 lists depending when he was made ("as first Hero, as second Hero and as third Hero). You can make all 3 list same which means no mater when hero was made he will use same list.

    NOTE:
    -If you are using custom hero remember to add them in Advanced-Gameplay Content).
    -Be sure AI can make Heroes.
    -Go to link below to see which spells are usable by AI.


    Building Tab

    Clip_3.png

    This probably most important tab. Here you'll say to AI each unit that he is going to train and and arrange his economy priorities.

    -Building priority-

    On this window you'll arrange the "what to do list" for AI. You can also specify in which base to build it. Also you'll here specify Town Hall that is going to be used for race (If it is custom remember to go to Advanced-Gameplay Content) and which mine building will use (like Undead or Night Elves do). AI will build from top to bottom so it is most important to make sure:

    1)That units won't go over the food limit. If you go over the current food supply the order will be changed to red color. If this happens simply add food producing building above the red order.

    2)That AI is capable of making the unit. You must make sure that the building that produces the unit is made, if upgraded is first needed it must be researched. All requirements must come "before" the unit or it will confuse AI and cause lag. Also be make sure that unit can be made in the building.

    When making the list it is wise to use conditions in General Tab or if it is for only one unit you can modify custom condition by right clicking on unit and choosing "custom" condition. It is best to use conditions as much as possible because it will avoid bugs and units with conditions will be "skipped" so you can for example when AI reaches Third Tier order him to stop making footmen and switch to knights. The Conditions are important thing if you want to give your AI more intelligent behavior. Without conditions you are basically giving AI a predictable list which can be exploited.

    -Harvest Priorities-

    Here you say to AI how many workers will be used on gold or wood. You'll also be have to specified which worker will be used. You can have up to two workers, one for Gold and one for Lumber.

    NOTE:
    -Be sure AI can make units.

    Attack Tab


    Clip_4.png

    Here you'll make attacks that AI will use. In Attack Group window you'll speechify which units will be used in attack. On the right side just add desired units and number of them that will be used for attack.

    In Attack Waves you'll make list of which attack groups will be used and how often.

    And last in Target Priorities you'll say which targets (Main Base, creep Camps...) will AI attack and when. Once again here is advices to use conditions from General Tab because you don't want AI to attack with 1 hero and 2 units medium creep camp. You can order for example AI to wait until he reaches 50 food before he attacks. Just don't forget that bad conditions may result for AI to never attack.

    Test Configuration


    Here you'll be testing your race against opponents but this only works for melee races.

    In Action
    When building a base, you have to make sure the AI has enough room to place it's buildings. In the WE, this is a radius of about 4 squares (the large golden ones). It'll freeze if it can't place them all.


    --------------------------------------------------------------------------
    Tutoraials also to see:
    https://www.hiveworkshop.com/posts/1890195/
    by Boris_Spider.


    Hope this explains the basics and if you have any advice or complaint please tell me. Here is a example of AI View attachment AI(Sea L).w3x . To play with AI set computer player-random-60%.
     
    Last edited: Apr 11, 2011
  2. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Can someone at least comment?
     
  3. Mechanical Man

    Mechanical Man

    Joined:
    Jan 18, 2005
    Messages:
    5,373
    Resources:
    39
    Models:
    30
    Icons:
    3
    Packs:
    1
    Maps:
    4
    Tutorials:
    1
    Resources:
    39
    Meh, you could write a lot more. We lack good AI tutorials.
     
  4. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    We lack AI tutorials in general. I made one to inspire more.
     
  5. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    It is a nice tutorial. We lack AI tutorials, and this is a nice one to give broad information about the AI editor's features.

    Nice job overall, ~Approved.

    I put this into mapping since it doesn't deal with the actual script of AI as much.
     
  6. luixmania

    luixmania

    Joined:
    Mar 3, 2010
    Messages:
    35
    Resources:
    0
    Resources:
    0
    well im needing an AI to make a summoner summon a building on a location

    :fp:can you tell me how to do that :cool:?
     
  7. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    You can only tell AI to make building at specific base like Main, Expansion First, Exp. Second...
    You would have to use I guess triggers to order him specifically where.

    And thanks on "approval" and choosing category. I'll try in future to make this better.
     
  8. belteki

    belteki

    Joined:
    May 28, 2010
    Messages:
    5
    Resources:
    0
    Resources:
    0
    i read it
     
  9. DiegoSan

    DiegoSan

    Joined:
    May 28, 2010
    Messages:
    22
    Resources:
    0
    Resources:
    0
    Hey, can i make AI for unstandart units...Because i made custom race, but i dont see units in AI editor...How i need make AI for Computer player?
     
  10. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    You must first create in editor custom units and then extract that data from the map. Place the newly created file where you want and then open AI Editor go to "General Tab" and you'll see below "Custom Data:" and beneath it you'll see 3 buttons with one of them being "import". Click it then choose the data file you extracted earlier from the map.
     
  11. Dylanyo123

    Dylanyo123

    Joined:
    Jan 22, 2009
    Messages:
    96
    Resources:
    0
    Resources:
    0
    very nice tutorial, i am still thinking about making a map, but i dont think i can with all the competition lol
     
  12. Valkyrie

    Valkyrie

    Joined:
    Jun 9, 2010
    Messages:
    18
    Resources:
    0
    Resources:
    0
    I don't care what people say this is useful :)
     
  13. solomon409

    solomon409

    Joined:
    Apr 22, 2010
    Messages:
    406
    Resources:
    0
    Resources:
    0
    okay, i followed your tutorial, but when i test map, it says that : function BuildExpansion takes integer hallID, integer mineID returns nothing

    what doe this mean?
     
  14. Allen Walker 22

    Allen Walker 22

    Joined:
    Sep 23, 2010
    Messages:
    43
    Resources:
    0
    Resources:
    0
    It helps me!
     
  15. Animalpower

    Animalpower

    Joined:
    Jun 1, 2010
    Messages:
    600
    Resources:
    3
    Maps:
    3
    Resources:
    3
    Is this needed to make a AoS?
     
  16. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Uh no this is for campaigns or altered melee maps. In AoS case why not just make trigger that spawns units and sends them to move-attack?
     
  17. Boris_Spider

    Boris_Spider

    Joined:
    Dec 12, 2009
    Messages:
    728
    Resources:
    6
    Icons:
    3
    Maps:
    2
    Tutorials:
    1
    Resources:
    6
    The AI editor is only useful if for melee or altered-melee type AI. If you need AoS or Arena type AI you're better off triggering it, otherwise it won't behave as expected.

    Some tips for the AI Editor:
    ~Building: When building a base, you have to make sure the AI has enough room to place it's buildings. In the WE, this is a radius of about 4 squares (the large golden ones). It'll freeze if it can't place them all.

    ~Priorities: (build order) determine what the AI should get first. YOU MUST HAVE CONDITIONS SPECIFYING WHETHER OR NOT IT IS CAPABLE OF BUILDING THE UNITS. If you don't the game will probably lag as the AI repeatedly attempts to make something when it doesn't possess the tech-tree requirements for it. The game automatically checks to make sure it has the required resources to build. You can increase it if you want via Conditions.

    Note: The AI will train units over the expected food limit (red units) as long as you ensure that it has the necessary food before it builds the units.

    ~Avoid changing hero abilities after importing OE data into the AI. It may not appear and force you to remake the entire thing or spend 3-5 hours reimporting the OE data until the hero skills stick. If you don't re-import the OE data the AI will try to learn abilities it doesn't have and result in an unlearning hero for one or more abilities. Regular (non-learnable)abilities are not affected by this.

    ~Attacking: Make sure melee AI have a ground path to use to reach opponents. It doesn't really understand how to use Zepplins/Sky Barges if it has them; more often then not you'll stumble acrossa lone unit/hero or maybe a small group of units. If you don't provide a ground path to traverse for ground units, the game will lag as the AI repeatedly issues attack-move commands to a location it can't reach.

    Those are the main things that come to mind right now. There are restrictions on what spells the AI will automatically cast. Using channel as the base spell WILL NOT allow the AI to cast it without you triggering it's casting. VeljkoM linked to the tutorial I put up.

    //\\oo//\\
     
    Last edited: Apr 12, 2011
  18. map designer

    map designer

    Joined:
    May 2, 2011
    Messages:
    896
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I have a problem with my AI,It keeps building orc borrow,masses of orc borrows I mean,even more then those in the ''building'' ,and for that the AI has no lumber,and all his troops are stuck in the base.and he still keep clicking on building .
    I tried reimporting the AI but no use,although It doesn't do like that when I test the AI(except if its insane).
    Any idea how to solve this?
     
  19. VeljkoM

    VeljkoM

    Joined:
    Jul 27, 2008
    Messages:
    2,553
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Not sure but I think its because you either have some bad condition or in the list there is some impossible action.
     
  20. map designer

    map designer

    Joined:
    May 2, 2011
    Messages:
    896
    Resources:
    1
    Maps:
    1
    Resources:
    1
    the AI builds all his troops well up to 100 but in the same time he keep (or try if has no lumber)to build orc borrows
    note that I made this AI by editing the AI ''grunt master''and I imported object data many times
    thanks for the fast reply