Search
Recent Forum posts
Palmyran Guide links to wrong page ... (7 replies)
Posted 2 weeks ago by gustoprusto
RockNRoR : mod to improve AI and add ... (233 replies)
Posted 4 weeks ago by chab
Map options (New)
Posted 1 month ago by alemanparsons
Remove / copy map (New)
Posted 1 month ago by alemanparsons
Change missionary attributes (1 reply)
Posted 2 months ago by Fisk
David Saga II Three Roads to Hebron ... (19 replies)
Posted 2 months ago by EarlSmithIII
Designer Bio: PhatFish (1 reply)
Posted 2 months ago by Zarrr
Why am I getting a low disk space message ... (New)
Posted 2 months ago by St_Ives
Another Christmas gift (5 replies)
Posted 3 months ago by Fisk
Broken images on AoE Heaven (4 replies)
Posted 3 months ago by Grandy02
Latest Files
Poll
Advertisement
Random Screenshot
  • maxresdefault (1).jpg
  • History Tidbits
    Loading Quotes...
    HeavenGames
    AI Files

    Overview of AI files creation

    You may modify this file to create new computer player strategies. To do so, follow the instructions below and save the file as a text file with an .ai extension. 

    The map and resources can make or break the plan for a CP. Without sufficient resources early on, the .AI file won’t continue building. Instead of a bustling aggressive CP, you get a ghost town, especially if you’re killing off any villagers that come snooping around you. Look at the surrounding terrain where the CP is initially placed. The AI doesn’t do well in a highly congested area. Without decent access to resources throughout the game, the CP will stop processing the .AI file and gives up on it. Also keep an eye on the lions. Lions can stop a CP in its tracks. Make sure lions are placed where they will most likely be encountered by the CP in the middle to later stages of the game.

    The .AI file needs to have a good progression not only in units built, but also the structures that produce those units. The CP will skip building things if it doesn’t have the resources or a free building for it. When it can, it will go back and try to build what it skipped earlier. This can cause an .AI file to get out of synch with how you intended to build. If you don’t have a good relationship of resources available to the sequence of builds in the .AI file, it won’t matter what you do in the .PER file (although you can help this out a little in the .PER file). The builds get out of sequence, things bog down, the CP can give up trying. In short, the CP will be a loser.

    .ai files contain the units, buildings and research that will be performed by the computer player in the general order listed. The computer will will try to progress through the list and maintain what has been built. For example, when a unit or building in the list is destroyed, it will generally be replaced before a new unit or building further down on the list will be created.

    The sample list contains one of every item to be trained, built, or researched in Age of Empires. Storage Pits, Houses, and Granaries (although included in the list) can be handled completely by the computer player (if the appropriate strategic number is set for the computer player). In other words, these need not be placed in the list at all; the computer player will build them when they are needed. (Sample List is located in the Docs Directory of your Age of Empires CD).

    The sequence of items in this list is important. For example, the Market must be built before a Farm, etc. As long as the game rules are respected by maintaining the prerequisite order, items in the list can be resequenced. The technology tree foldout is a good reference source for the prerequisites.

    Items on the list that cannot be built or researched (for any reason) are eventually skipped (the skipping can be controlled by setting strategic numbers in the computer player’s .per file).

    If there are already units on the board that are also in the Strategy list, these units will be counted as already created and will not be rebuilt.

    Hints & Tips
    Here are some tips for creating your own .ai files. The sample file does not necessarily adhere to the principles that follow. Instead, this list is placed in an order that makes the items easy to find so that you may create your own list.

    1. Keep the quantity field down to 1 or 2. Higher quantities will cause the computer player to pause on that item until the quantity is fulfilled.
    2. Do not research or build an item from a building directly after constructing that building. Example: Don’t place Bowman after Archery Range. Doing so may cause the computer to pause on the Bowman until the Archery Range construction is complete. Instead, put another item between the Archery Range and the Bowman.
    3. Do not place two or more items in a row that come from the same building. Example: Priest, followed by Polytheism, Mysticism and Astrology. Instead, stagger items from multiple buildings to ensure that production at one building does not slow progress through the rest of the list. Good example:

      Priest
      Man
      Polytheism
      Man
      Mysticism
      Market1
      Astrology.

    4. Limit retrains (see below) of early-age infantry and archers.

      This ensures that when they are killed they will not be retrained. This frees slots (under the population cap) for them to be replaced by higher-level soldiers. The same concept applies to villagers and fishing boats.

    5. Limit the number of units trained to approximately 50. When the computer reaches its population cap of 50, its advance through the remainder of the list will slow down. If your list calls for 30 villagers and 30 military units, do the following:

      -Put 10 villagers, or early-age soldiers on limited retrain. 
      This will open slots for 10 superior replacements later.

      -Put the last 2-10 units you want to have trained in the very last line of the file.
      This way, if you exceed the population cap, you will do so on the last item and not interrupt the progress of the list.

    6. Start by modifying an .ai file that is already close in content to the file you want to create. If that list is missing certain items, copy them from the list below and paste them into your .ai file.
    7. In the Stone Age, the computer must be able to quickly locate forage bushes, trees, and/or water. Failure to do so will cause the computer not to place a Granary, Storage Pit, and/or a Dock. This may prevent your .ai file from reaching the Tool Age, since these buildings are necessary prerequisites for reaching the Tool Age.
    8. Test! After you have completed your .ai file, put it into a scenario, give the computer unlimited resources, and observe the build process on x2 speed. Insure that all items are correctly built. Delete items that have limited retrains and ensure that they are replaced with other units. This technique will greatly accelerate your .ai design and development process.

     

    Legend for the prefix to the ID number

    Each object in the game has a unique ID number. In the strategy file, that ID number is preceded by a qualifying prefix. The prefixes are listed below:

    B – Building – Will be rebuilt if destroyed.

    A – Building – Will be rebuilt up to to the number of times specified in the “Limited Retrains” column.

    R – Research – Item will be researched if possible. If not possible, it will be skipped according to the strategic numbers.

    C – Research – Item will be researched if possible. If not possible, the computer player will progress no further until this critical research is done. For example, if the computer player does not have enough food to advance to the Tool Age, it will wait to collect enough food and will not skip the Tool Age).

    U – Unit – Will always be replaced if killed.

    T – Unit – Will be trained up to the number of times specified in the “Limited Retrains” column. Example: 1 indicates that this unit will be created once. Once killed, this unit will not be created again.

     

    Breakdown of .AI – Building

    Sample .ai Strategy File Line
    ID Description Quantity Parent Limited Retrains
    B0 Academy 1 -1

    A or B can be used with the building lines.
    A = Building will be rebuilt up to the number of times specified in the Limited Retrains column.
    B = Building will be rebuilt if destroyed.

    Computer Descriptions – How the computer corresponds the program name for the Research to the actual Research name.
    Actual Research Names.
    These are the “Parent” numbers – matches the Research to the building it is being researched in. Don’t mess with these!
    12=Barracks, 0=Academy, 87=Archery Range, 45=Docks, 109=Town Center, 104=Temple, 49=Siege Workshop, and 101=Stable.

    B0 Academy 
    Academy -1
    B101 Stable1 B101 Stable1
    B103 Storage_Pit1 B104 Temple1 B109 Town_Center1
    B12 Barracks1 B276 Wonder B45 Dock_1
    B49 Siege_Workshop B50 Farm B70 House
    B70 House B70 House B72 Wall_Small
    B72 Wall_Small B72 Wall_Small B79 Watch_Tower
    B79 Watch_Tower B79 Watch_Tower B82 Government_Center
    B84 Market1 B87 Range1  

     

    Breakdown of .AI – Research

     

    Sample .ai Strategy File Line
    ID Description Quantity Parent Limited Retrains
    C102 Bronze_Age 1 109
    R or C can be used with these.
    R = Research Item will be researched if possible. If not possible, it will be skipped according to the strategic numbers.
    C = Research Item will be researched if possible. If not possible, the computer player will progress no further until this critical research is done. For example, if the computer player does not have enough food to advance to the Tool Age, it will wait to collect enough food and will not skip the Tool Age.
    Computer Descriptions – How the computer corresponds the program name for the Research to the actual Research name.
    Actual Research Names.
    These are the “Parent” numbers – matches the Research to the building it is being researched in. Don’t mess with these!
    12=Barracks, 0=Academy, 87=Archery Range, 45=Docks, 109=Town Center, 104=Temple, 49=Siege Workshop, and 101=Stable.
    C101 Tool_Age C102 Bronze_Age
    Bronze Age 109
    C103 Iron_Age
    R106 Ballistics R107 Wood_Working R108 Gold_Mining
    R109 Sstone_Mining R11 Stone_Wall R110 Craftmanship
    R111 Siege_Craft R112 Architecture R113 Aristocracy
    R114 Writing R117 Iron_Shield R12 Sentry_Tower
    R13 Medium_Wall R14 Fortifications R15 Guard_Tower
    R16 Watch_Tower R18 Afterlife R19 Monotheism
    R2 Catapult_Tower R20 Fanatiscm R21 Mysticism
    R22 Astrology R23 Jihad R24 Polytheism
    R25 Juggernaught R27 Helepolis R28 Wheel
    R30 Coinage R31 Plow R32 Artisanship
    R34 Nobility R35 Engineering R36 Massive_Catapult
    R37 Alchemy R38 Heavy_Horse_Archer R38 Fishing_Ship
    R40 Leather_Armor_-_Soldiers R41 Leather_Armor_-_Archers R42 Leather_Armor_Mounted
    R43 Scale_Armor_-_Soldiers R44 Scale_Armor_-_Archers R45 Scale_Armor_-_Cavalry
    R46 Tool_Working R47 Bronze_Shield R48 Chain_Mail_-_Soldiers
    R49 Chain_Mail_-_Archers R5 Medium_War_Ship R50 Chain_Mail_-_Cavalry
    R51 Metal_Working R52 Metalurgy R54 Heavy_Catapult
    R56 Improved_Bow R57 Composit_Bow R6 Merchant_Ship
    R63 Axe R64 Short_Sword R65 Broad_Sword
    R66 Long_Sword R7 Trireme R71 Heavy_Cavalry
    R73 Phalanx R77 Legion R78 Cataphracts
    R79 Centurion R8 Heavy_Transport R80 Irrigation
    R81 Domestication R9 Trireme_with_Catapult  
    Expansion Pack Rise of Rome ONLY!
    R126 Scythe_Chariot R125 Armored_Elephant R119 Medicine
    R120 Martyrdom* R121 Logistics R122 Tower_Shield
    *Put a double slash before this line to “negate” it, or completely remove it. Computer Players don’t use Martyrdom so you don’t want them to spend 600 Gold on this.

     

    Breakdown of .AI – Units

    Thanks to Dave “Bigdog” Pottinger for helping with this.

    Sample .ai Strategy File Line
    ID Description* Quantity* Parent Limited Retrains*
    T73 Soldier_Inf1 2 12 1

    U or T can be used with these.
    U – Unit will always be replaced if Killed. The limited retrain has no effect if you use the “U” designation for the unit.
    T – Unit will be trained up to the number of times specified in the “limited retrains” column. Example: 1 indicates that this unit will be rebuilt once. Once killed, this unit will not be created again, and this line will be ignored for the rest of the game.
    Computer Descriptions – How the computer corresponds the program name for the Research to the actual Research name.
    Actual Research Names.
    These are the “Parent” numbers – matches the Research to the building it is being researched in. Don’t mess with these!
    12=Barracks, 0=Academy, 87=Archery Range, 45=Docks, 109=Town Center, 104=Temple, 49=Siege Workshop, and 101=Stable.
    * The limited retrain may, at times, train one more unit than asked for (i.e. if you say 2, sometimes you may get 3).

    * There is no provision for the maintenance with the pop cap; if you put 50 villagers in the front of the list, you’re not going to get any soldiers on the map.

    * The unit “names” only change when there is a major upgrade. For example, an axeman isn’t on the page, but that’s because an axeman is really just a clubman after you’ve researched the axe.

    U73 Soldier-Inf1
    Clubman 12
    U75 Soldier-Inf3
    Short Swordsman 12
    U282 Soldier-Inf6
    Legion 12
    U93 Soldier-Phal1
    Hoplite 0
    U291 Soldier-Phal3
    Centurion 0
    U4 Soldier-Archer1
    Bowman 87
    U5 Soldier-Archer2
    Composite Bowman 87
    U41 Soldier-Chariot2
    Chariot Archer 87
    U25 Soldier-El_Archer
    Elephant Archer 87
    U39 Soldier-Cavalry3_Arc7
    Heavy Horse Archer 87
    U299 Soldier-Scout
    Scout 101
    U40 Soldier-Chariot1
    Chariot 101
    U37 Soldier-Cavalry1
    Cavalry 101
    U46 Soldier-Elephant
    War Elephant 101
    U35 Soldier-Catapult1
    Stone Thrower 49
    U11 Soldier-Ballista
    Ballista 49
    U13 Boat-Fishing1
    Fishing Boat 45
    U15 Boat-Trade1
    Trade Boat 45
    U17 Boat-Transport1
    Light Transport 45
    U19 Boat-War1
    Scout Ship 45
    U250 Boat-War4
    Catapult Trireme 45
    U277 Boat-War5
    Juggernaught 45
    U125 Priest
    Priest 104
    U83 Man
    Villager 109
    Expansion Pack Rise of Rome ONLY!
    U347 Slinger
    Slinger 12
    U338 Soldier-Camel
    Camel Rider 101
    U360 Fire-Galley
    Fire Galley 45

     

    Breakdown of .AI – Starting your tribe (The opening)

    Thanks to Michael “Archangel” McCart for helping with this.

    The sequence of items in this list is important. For example, the Market must be built before a Farm, etc. As long as the game rules are respected by maintaining the prerequisite order, items in the list can be resequenced. The technology tree foldout is a good reference source for the prerequisites.

    Items on the list that cannot be built or researched (for any reason) are eventually skipped (the skipping can be controlled by setting strategic numbers in the computer player’s .per file).

    If there are already units on the board that are also in the Strategy list, these units will be counted as already created and will not be rebuilt.

    We are breaking down each line of the Sample Strategy File (.ai) file located in the Docs folder of your Age of Empires CD. So print it out, if you want to follow along.

    Sample .AI Strategy File Line – Starting your tribe
    ID Description Qty Parent Limited Retrains
    B109 Town_Center1
    TownCenter
    1 -1
    Game
     
    Town Center – Has to start with one of these. The above line refers to ID# (unique to each unit/building/research part of the .ai file), Description is computer name of the .ai file – scenario editor name of this part of the .ai file, Qty to be built, Parent is where it is being built from/at. Limited retrains are explained on the individual unit/building/research pages.
    U83 Man
    Villager
    6 109
    Town Center
     
    Here the Computer refers to a villager as a man, which is being built in the Town Center. See how the Parent number of “Man” is the 109 ID# of the Town Center. Note that U has been used and this line call for 6 villagers to be built. If they are killed, the computer will always replace them during the game.
    B12 Barracks1
    Barracks
    1 -1
    Game
     
    Normally the first building you would build. This line pretty much explains itself. Why a Barracks and not a Storage Pit or a Granary? It is explained at the bottom of this page.
    T73 Soldier-Inf1
    Clubman
    2 12
    Barracks
    1
    The Clubman is called Soldier-Inf1 in the .ai file, its being built in parent “12” which is the Barracks. See how it matches up with the B12 example above. The clubman will be trained up to the number of times specified in the “Limited Retrains” column. Example: T has been used for this line so a limited retrains value must be specified, in this case 1. Qty is set at 2. So the computer will build 2 clubmen, and once killed will replace them one more time (for a total of 4 in all)

    Why put clubmen on limited retrains? Why not use U73 so they are always replaced? To have “space” towards the pop cap later. You want your computer player to build swordsmen and/or phalanx, and not build some clubmen/axemen in the Iron Age. Logic, no? :^)

    U83 Man
    Villager
    6 109
    Town Center
     
    Same as the above U83 example, we are just building more villager to take care of wood/stone/gold tasks.
    We just went through a simple start for a computer player. One Town Center, One Barracks, two Clubmen and twelve villagers. Not a bad start for any early tribe.

    Note also that there is no mention of Houses, Storage Pits and Granaries. Unless you write your .per files, the computer will take care of these and will build them as needed, hence why no mention of them in our little beginner .ai file.

    Advertisement
    © HeavenGames. All Rights Reserved. Please read our Disclaimer & Privacy Statement. © Microsoft Age of Empires.