AI - The Editor

Discussion in 'Tutorial Repository' started by Ghan, Mar 25, 2007.

  1. aChiLLeS

    aChiLLeS Guest

    Ratings:
    +0 / 0 / -0
    Ok the idea with adding it to some building seems good enough ;p

    But anyway... I've made an AI that would controlo Fel Orcs... It was just a test I didn't even edit the map, just put some trees and mines... several buildings for start and:
    Indeed he didn't "overbuilt" the buildings which were placed on the map previously. Actually after several attempts... I made it to create AI that followed the build-up I ordered in building tab... But there's a problem with units... Well.. it does train them... but only SOME... While in the end it should have about 6 fel grunts (don't know if the names are correct, I have a Polish version of the game), 4 fel riders, 4 fel warlocks, some head hunters, catapults etc... But it was all very chaotic :/ - I made the cpu be "an enemy with shared vision" so that I would see what AI does - anyway once it lost some of its units he trained only grunts... from time to time adding a rider or sth, but it was not the way it should be... I mean... such an AI would be very easy to defeat... I simply didn't attack it too much because I wanted to see the way it builds-up and trains units, but in the end it is not good enough.

    I don't actually get it with the building tab... What order should it have to work properly? When should I add upgrades? If I add 3 upgrades from the War Mill, one after another in the building tab, and after that... I give it the order to train, let's say 4 grunts... Will the CPU wait until the upgrades are done, until he starts training units? Because to some extend it seemed he did :/
    And one more thing... I don't know why the CPU tried to build a second expansion : o I only gave him one command to create exp... but some time after that I noticed a fel peon building a third great hall -,-

    It's so damn complicated : p

    Could you maybe write down an example order... not entire one, but just some of it, let's say from the beginning to the moment of upgrading the great hall to stronghold - mine looked a bit like that:

    Great Hall - 1
    Peon - 1
    Peon - 2
    Peon - 3
    Peon - 4
    Peon - 5
    Barracks - 1
    Peon - 6
    Altar of Storms - 1
    Peon - 7
    Fel Burrow - 1
    War Mill - 1
    Fel Grunt - 1
    Fel Grunt - 2
    A grom hellscream-model Blade Master - 1 (I didn't gave the command "Hero - first" but simply chose a unit from "orc: custom units: blade master")
    Meale weapon upg. - 1
    Peon - 8
    Fel Grunt - 3
    Fel Burrow - 2
    Fel Grunt - 4
    Armor upgrade - 1
    Stronghold - 1
    (ofcourse later there were exps, fortress and all... untill the 90/90 limit and full upgrades)

    note that most of the objects are edited, so that they produce Fel Orc Units instead of normal ones. (available are: fel peon, fel grunt, fel rider, fel warlock [instead of shaman, using shaman's upgrades], troll headhunter, troll witch doctor, fel kodo beast, catapult)

    I was probably not DIRECTLY like that... but something similar ; p If you have time, could you write a similar scheme, which would make the CPU build-up and produce units in a way that it would create a bit more threat to the human player? ; p
     
  2. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,489 / 0 / -0
    Hm...

    Well, make very sure that all techtree requirements are met before ordering to train some unit that needs it. Or build a structure...

    The AI will continue with the script as far as it goes, and restart "the beginning" as soon as needed.


    Did you have a look at the two example scripts that come with the game?
    Ever seen one of the maps in my sig? :p
     
  3. aChiLLeS

    aChiLLeS Guest

    Ratings:
    +0 / 0 / -0
    Yes, i've looked at the exampler scripts... but my didn't seem to be much different ;p

    I didn't see your maps ;p Did any of it had an AI script made by you? And if yes... will I be able to open it in my editor if I have a Polish version of frozen throne... and yours is probably english? ;p
     
  4. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,489 / 0 / -0
    > Did any of it had an AI script made by you?

    Both, yes.

    "Revenge" is "train and own" only. No structures.
    "Tales" builds an entire base.

    Not "protected".
    Works in any TFT version. Though the latest patch is assumed (1.21)


    > mine didn't seem to be much different

    I thought so too when I made my Undead melee AI...

    Then I noticed that some conditions were somewhat... different from what I used.
    Those for expanding for example...
     
  5. aChiLLeS

    aChiLLeS Guest

    Ratings:
    +0 / 0 / -0
    Indeed conditions... that may be a problem, I didn't use any of them ;p

    Weird thing I noticed... is that in the GruntMaster for example, FIRST there are the 3rd level upgrades for melee weapon and defence and LATER there is Fortress : o which is a condition for them to be done... although each of the upgrades has a condition "if number of fortress owned is more than 0" (or maybe it was "is at least 1"). Why's that? Wouldn't it be better to upgrade a fortress 1st and introduce upgrades after that? How does it work, are these upgrades temporarily skipped and they start working as soon as fortress is ready? Or they begin to work once the building tab has restarted and came to this point again?

    One other thing I though of is - would it be OK if, placing a semi-developed base to the AI player from the very beginning, I would start the building tab from training the number of peons which he would ALREADY HAVE (let's say 10) and putting all the buildings which he already has (let's say Barracks, War Mill, several Burrows, 2 Watch Towers, VooDoo Hall, Altar of Storms, upg. to Stronghold, Beastiary, The Hut which makes Shamans[don't remember the English name for it ;p]), right after that the several custom units which are also there (let's say 3 grunts, 2 headhunters, hero, rider or sth.)... AND than I would go on to the further development of the base in a let's say NORMAL order. Wouldn't it make things work a little faster?

    I'll also download your maps to see how you did it (yeah, I have 1.21 PL) :) I didn't have time to do it yesterday.

    Sorry for all these questions, you must have better things to do than explaining all this ; D
     
  6. Somatic

    Somatic You can change this now in User CP.

    Ratings:
    +84 / 0 / -1
    Question Acehart. Hope this is not hijacking or off topic. If i have a Sandbox War Style map, how shld i set up an ai using the ai editor to make it functional? like where it knows what to build and what to upgrade. I made a simple ai for AOS style maps before but i felt that those are easier with Case and nested if/elses. But for Sandbox War (Where its just building) How about shld i play with the AI Editor? If you feel that this is OFftopic maybe drop me a PM If you are free enough to clear up my doubts? Thanks alot
     
  7. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,489 / 0 / -0
    > Wouldn't it be better to upgrade a fortress 1st and introduce upgrades after that?

    AI scripts run from top to bottom, over and over again, in an endless cycle.

    If some action can not be done, building isn't there yet, unit not available, ..., it will pass on to the next.
    The first action that can be done, will be done.

    If you have 10 workers at the beginning, and they all die like flies for some reason, the AI will be insanely busy with training workers, and it will forget everything else until later.
    Now, if you want some upgrade to be researched as soon as possible, put it as early as possible.
    Remember: the first action that can be done, will be done.

    Unfortunately, there are some not clearly defined blocking conditions.
    As in, it can happen that one particular action can not be done, and the script blocks there.
    This usually means the AI will mindlessly repeat the last action that worked, over and over.

    And, no, there's no real reason behind it.
    Well, there probably is one, but I've never seen it.

    Once it blocks... well :p

    To prevent that, use conditions.
    If this units needs a particular research, put that research as condition.

    Imagine the entire script running at once, all actions at once.
    If it still works, use it.
    Otherwise, add more conditions.

    From my experience, it's better to have one too many, than one not enough.


    For buildings it already has... well, that action will simply be skipped.
    It will not waste any valuable time or so... :p

    It's more like a shopping list.
    Somehow, somewhere, somewhen, once you passed through the entire shop, all of the list will be checked.
    Not necessarily in the list order.
    Just make sure the shop has all the items.



    I have no idea what a sandbox style map might be...
     
  8. Somatic

    Somatic You can change this now in User CP.

    Ratings:
    +84 / 0 / -1
    Sorry =/ its basically a map where units spawn from Barracks are automatically directed to a fixed enemy point, both forces will have units kept spawning from barracks to start heading for that destination, and attcking all enemies on its path. the first to take down the impt structure will be the force which win. ITs like the last mission of the Orc Side campaign with the WC3 TFT.
     
  9. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,489 / 0 / -0
    Originally, the AI Editor was added so people could (try to) make melee scripts.
    You tell it to build some structures, train a bunch of units, do some research.
    And, according to some "wave" settings and attack priorities, it will send its unit to certain doom. Or, optionally, to complete ownage.

    That's about it.

    Some examples:

    "Hatchery Havoc" for example uses an AI script.
    No building, no training.
    The script just says "take all units and kill stuff".
    All training is done with triggers, and heavy abuse of (controlled) "math - random".

    "Revenge of the Skeletons" has no building either.
    But, a list of units to train, together with some conditions.
    And some re-sorted attack priorities so it makes sense for the map.
    The AI plays marvelously well (personal opinion).

    "Tales of the North" builds an entire base, complete with everything.
    Structures, units, research, attacks...

    In short, you can use the editor to build and train and research,
    or to build and train,
    or to build only,
    or to train only.
    They all work.


    Building an otherwise automatic base?
    Yes, that should work.

    For starters, play the map normally, and write down what you build, in what order.
    Try to copy that into the AI Editor.
    Run your script for some comp at map init.

    Actually, I'd suggest to add an extra player as observer.
    And have all comps on scripts.
    Give yourself shared vision, optionally shared unit control, and just sit back and watch.

    If it doesn't do something it should be doing now, try to find out why :p


    Good luck.



    On a related note: it's impossible to use the AI Editor to make a Tower Defense AI...
     
  10. aChiLLeS

    aChiLLeS Guest

    Ratings:
    +0 / 0 / -0
    Ok today I'll try to modify my AI with adding the conditions and I'll see how it works ;p thanks a lot.
     
  11. aChiLLeS

    aChiLLeS Guest

    Ratings:
    +0 / 0 / -0
    There's one thing I don't quite understand...

    It's in the Attack settings - > As you set the attack waves... there is an option "repeat wave" - where you may chose from 0 to the number of waves you've put there, for instance, if there are 2 attack waves, in the option "repeat waves" you may chose either 0, 1 or 2. What the hell does that do? The computer repeats the attacks anyway.

    Any help here? :p
     
  12. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,489 / 0 / -0
    Early on for example, you may want to sent a wave with Grunts only.
    And then never again.

    So, you would put a wave with Grunts,
    some more waves with whatever,
    and tell it to repeat from the second wave on.

    Result:
    It sends a wave of Grunts,
    some more waves with whatever,

    and repeats those "more waves with whatever".
    The Grunt wave will only happen once.
     
  13. aChiLLeS

    aChiLLeS Guest

    Ratings:
    +0 / 0 / -0
    Oh... Well I thought it might be it ;) ...and it's good that this is how it works, very useful. ^^

    Simply put, it means "from which wave on, will the attacks be repeated"?

    So having waves
    5 grunts, hero
    5 grunts, 3 trolls, hero
    All units

    placing "3" in "repeat waves" will mean that after first 2 attacks, only the "All units" will keep repeating right?

    Anyway, thanks [again] for your help.
     
  14. Oninuva

    Oninuva You can change this now in User CP.

    Ratings:
    +224 / 0 / -0
    Uber bump. Great tutorial for many maps who have no AI. :)
     
  15. DD44

    DD44 Guest

    Ratings:
    +0 / 0 / -0
    All right, I need a bit of help here.

    I'm not entirely a novice with the WE - I've made loads of skirmish maps and two melee armies from scratch, but I decided to take those armies and make a melee AI for them (and may I say this tutorial has been quite helpful).

    Unfortunately, I have a problem: It don't do nothin'.

    Now this map is a map of Europe that supports 12, and I want my two custom skirmish armies to be able to run alongside the basic 4. I basically have myself controlling one of my armies, and the computer breakdown being player 2: army 2, 3: army 1, 4: army 2, 5: human, 6: orc, 7: undead, 8: night elf, 9: human, 10: orc, 11: undead, 12: night elf.

    I have the setup perfect, but the AI I set up doesn't do anything bu gather. They assign the workers they start out with to go get gold and/or lumber and leave it at that forever.

    I did import the custom AI and set them to the applicable players via the triggers at startup by editing the "Melee Initialization" trigger. I tried setting conditions for "(worker) less than 11" to train more workers in the AI editor (Similar conditions for certain buildings). But nothing is working.

    One thing that may do some of it: in the "Building" tab where it says Base Building/Gold Worker/etc, all the selections are greyed out and set to the basic peon/peasant. I can't change them. But they're already using said gatherers and building, they just aren't doing anything MORE.

    :banghead:

    Help appreciated.

    EDIT: Just on the off-chance that the problem was due to my starting the AI as "Human/Orc", I changed it to "Custom" which did allow me to access the grey sections on the Building tab. I remade the AI. Still nothin'. All they do is gather gold.

    Might it possibly be due to my having the "Run melee scripts (for computer players)" action in my triggers overwriting my AI? I hope not, as I do want the standard AIs to run as well for the basic armies. Just a thought.

    Wait, never mind. I think I got it. I think that the changes I was making to my AI were saving under a different file tied to a test version of a map I was running... I think I may have it now...:thup:

    Well now, this is interesting...

    Now the basic armies don't work. I got a near-perfect AI for my armies, but now the basic ones don't run.

    Do I have to make a custom AI for every side? That would suck...

    Also, my custom AI doesn't want to upgrade their town halls. Help?

    Sorry if I'm an annoyance.
     
  16. bessomi

    bessomi New Member

    Ratings:
    +9 / 0 / -0
    How do i set the spell priority for custom heroes, or does the ai learn them automatically?
     
  17. DD44

    DD44 Guest

    Ratings:
    +0 / 0 / -0
    It's in the Heroes tab. A drop-down menu selects the hero, then there's a priority list at the bottom.

    Also, it seems that the mahjority of my problems were being caused by mines being slightly too far away to initilize the AI's gathering as well as the trigger order. I'm going to tighten up the map and try again.
     
  18. radienx000

    radienx000 New Member

    Ratings:
    +5 / 0 / -0
    Ohio!
    I was wondering if you could make the computer build once and attack waves in an order, so they do not rebuild the units on the previous wave. Just like the waves the Undead Scourge used on the final map of warcraft 3 the battle of mount hyjal, where they attack in waves and i don't see them remaking the same units as from the previous wave.

    Thanks.
     
  19. UndeadDragon

    UndeadDragon Super Moderator Staff Member

    Ratings:
    +450 / 0 / -0
    That's done through triggers and not AI.
     
  20. The Helper

    The Helper Administrator Staff Member

    Ratings:
    +1,213 / 2 / -1
    5 Star Bump

    5 Star Bump!
     

Share This Page