Computer Player Strategy Builder Guide | | |
| | |
Age of Empires II: The Conquerors Expansion uses an all-new Artificial Intelligence (AI) Expert System to act as the intelligence behind the computer players. This expert system uses a series of Rules that are tested to cause various actions to take place. In the following sections, you will learn how to make new rules for the AI to follow, how to check game facts to trigger those rules, and how to command the AI to take action based on your instructions. | | |
AI Files are text files that have their extension changed to '.per' (for example, 'Henry Tudor.per'). These files contain the script commands that are used to create a new customized computer player. Use a text editor (one that displays line numbers is very helpful) to create your AI scripts, and copy them into the directory where you installed Age of Empires II, in the AI folder. | | |
An empty text file with an .AI extension (for example, 'Marko.ai') should be created to make an entry appear in the list of computer players and in the scenario editor. The game will try to find a file with a matching .per extension that will be started when you pick that player. In your game's AI directory, you would then have 2 files: | | |
C:\Program Files\Microsoft Games\Age of Empires II\AI\MyAI.ai (This is an empty file that makes an entry in the game's list) | | |
C:\Program Files\Microsoft Games\Age of Empires II\AI\MyAI.per (This file contains your custom AI script of rules and facts) | | |
You must have both a .PER and an .AI file with the same name for your script to function! | | |
| | |
Rules are the basis for the Expert System. There is a list of things we know about the game world, the other players, and so on. These are called facts. We check the facts with rules until a set of conditions exists that we need the computer player to act upon. Actions are what we call those commands that cause things to happen in the game. Examples might be training a unit, | | |
researching a technology, or sending a chat message. | | |
| | |
Rules are defined in the script with the defrule instruction. If the conditions for the rule are met (True), the instructions in that rule are followed. If the conditions for the rule are not met (False), the rule is passed by. | | |
| | |
| | |
| | |
| | |
(some action takes place) | | |
| | |
Note that the parentheses around the rule are required – though the white-space formatting (spaces, tabs, etc.) is not important. | | |
Rules continue to be evaluated until they are disabled. This is done with the disable-selfcommand | | |
| | |
| | |
| | |
| | |
| | |
Going through the entire list of rules checking each one is what we call a rules pass. This system is very efficient, the rules may be checked as often as several times a second. | | |
| | |