Age of Empires II AI Editor Version 1.0.2
Copyright (c) 1999 Stoyan Ratchev.
All Rights Reserved.

Written by Stoyan Ratchev, sratchev@mail.techno-link.com
Posted to AoK Heaven, http://ageofkings.com
This program is freeware.
Please e-mail me for bug-reports, suggestions, and comments.

Age of Empires II a game by Microsoft & Ensemble Studios.
All trademarks are property of their respective owners.

Special thanks to Mark Terrano, mterrano@enesmblestudios.com,
for making all this possible.

AI Editor is a Windows application for creating and editing Age of
Empires II (AoE II), or Age of Kings (AoK) AI (artificial
intelligence) scripts. These files are called also "personality
files" and usually have the extension PER or AI.

With AoE II AI scripts you can create new computer player strategies
for AoE II. The format of these scripts is quite complicated. The AI
scripting has undergone a major evolution from Age of Empires I.
It is now possible to control the computer player in almost every
aspect of the gameplay. You can change the default set of AI scripts,
or even completely replace it with your own set of rules. You can
include such scripts in scenarios, and this generally makes scenarios
a greater challenge and more fun to play.

The game does not include any utility for editing such files - the
text editor is again supposed to be the one. And again it is not the
easiest job with the usual text editor. AI Editor is also based on a
text editor, but also it has the features that one would expect from a
"development environment" - customizable syntax highlighting and
built-in analysis means.

This software comes with ABSOLUTELY NO WARRANTY of any kind, so USE IT
AT YOUR OWN RISK.

FEATURES

- Full-blown text editor similar to WordPad, with multiple document
interface (MDI) and a rich set of editing commands, such as
clipboard commands, find/replace, etc.

- Built-in analyzer of AI scripts that lets you check your scripts
for syntax and semantic errors, and evaluate various parameters of
your strategy, such as loaded rules, files, and constants.

- Customizable syntax highlighting of AI script language elements.

- Adjusting of editor settings, such as read-only, word-wrap, and
tab size.

- Adjusting of syntax highlighting settings, such as font color and
effects for different syntax elements.

- Setting of analyzer options, such as game settings, loaded files,
defined constants, etc.

- Expand conditional loading blocks analysis mode, in which
#load-if-... blocks are expanded according to specified game settings.

- Pretty printing of strategies and individual files to a single file,
uniformly formatted and indented.

- Context sensitive help on interface elements and built-in symbols.

- "Computer Player Strategy Builder Guide" help file based on the
original ES AI editing documentation.

INSTALLATION

The original package is a ZIP archive called aokaiedit_10.zip, which
contains the following files:

---------------------------------------------------------------------
File		Description
---------------------------------------------------------------------
aiedit.exe 	AI Editor executable
aokai.dll	AI Editor dynamic link library
aiedit.hlp	AI Editor help file
aiedit.cnt	AI Editor help file contents
cpsb.hlp	Computer Player Strategy Builder Guide help file
cpsb.cnt	Computer Player Strategy Builder Guide help file constants
readme.txt	AI Editor README file
sample.per	A sample AI script
castle.per	Another sample AI script
---------------------------------------------------------------------

To install the AI Editor:

1. Unzip the archive in a folder of your own choice, for example
C:\Program Files\aiedit. 

2. Create a shortcut to the executable aiedit.exe in your Start menu
or on your desktop. In order to do this, click somewhere on your desktop,
point to New->Shortcut, and use the dialog that appears to specify the
path where you have placed the executable and the name of your shortcut.

GETTING HELP

There are 2 help files that come with AI Editor. The first one is the
help file for the AI Editor application. The second one is the
"Computer Player Strategy Builder Guide" manual converted to a help file
for easier browsing. You can open each one of these files, or you can
use them from inside the AI Editor to get help in a most intuitive way.
Here are some tips on how to get help:

- To see the AI Editor help contents: On the Help menu, click Help Topics.

- To see help on a menu command: Select the menu command and then click F1.

- To see help on a dialog box: Open the dialog box and then click F1, or
click Help if such a button is available in the dialog box.

- To see help on a built-in symbol: Select the symbol in the editor, or
simply place the caret over it, and then click CTRL+F1. The corresponding
topic in the Computer Player Strategy Builder Guide is displayed.

- To see Computer Player Strategy Builder Guide help file: On the Help menu,
click Building Strategies.

- To see information about the version number and copyright of AI Editor:
On the Help menu, click About.

If you still have questions, please email me. I will also appreciate
if you send me any AI scripts of your own created with AI Editor that 
represent successful strategies.

DOWNLOADING

AoK AI Editor is available for download on the following AoK sites:

http://ensemblestudios.com	- Official ES site
http://MrFixitOnline.com	- MrFixitOnline.com
http://ageofkings.com		- Age of Kings Heaven

I will send new versions of AoK AI Editor to these sites personally.
I will also try to notify all webmasters of other sites that I have
in my address book about new versions, so that they may download them
from the above sites and post them if they want. I intend to make
AI Editor as widely available as possible. I intend also to publish
additional information on the MrFixitOnline.com site.

REFERENCES

The interest in AoK AI editing is constantly growing, and there will be
more and more information available on how to do it well. For now, there
are only a few valuable sources, but their number is expected to grow
rapidly.

First of all, you should read the original ES documentation. It is the
"Computer Player Strategy Builder Guide" document that can be found on
your AoE2 CD-ROM. Note that a Windows Help version of this document
prepared by me (Stoyan Ratchev) is available in the AI Editor package.
Even when used stand-alone, it is much easier to browse than the
original .doc file. The filename is cpsb.hlp.

Currently, ES have not yet released any official AI samples. There is
however a set of scripts with a really comprehensive AI strategy released
by the ES programmer Doug Brucks. These AI scripts can be used as a
starting point to make your own world conquest scripts. It can be
downloaded from the ES site at:

http://www.ensemblestudios.com/pages/files/dougtestai.zip

Note: The AI Editor analyzer stumbles upon a single bug in these scripts.
Yes, the bug is in the scripts, not in the analyzer! In fact, easy finding
of such bugs is what AI Editor was developed for. The buggy file is
"Doug's Test Researches", line 831. The text:
	(building-type-count-total ri-guard-tower >= 4)
should be replaced with:
	(building-type-count-total guard-tower >= 4)

The new AoK testing and development site MrFixitOnline.com contains unique
information about various game aspects. I intend to publish there articles
about AI Editor and AI editing in general. Check this great site regularly
and stay in touch! The address is:

http://MrFixitOnline.com	- MrFixitOnline.com

Information on AI editing is likely to appear on other AoK sites as well.
If you don't want to miss it, visit frequently the following sites:

http://ensemblestudios.com	- Official ES site
http://ageofkings.com		- Age of Kings Heaven
http://aoe2.com				- AoE2.com

RELEASE HISTORY

Version 1.0.2

- Fixed problems with missing exports in mfc42.dll.

- Fixed the bug that caused the Computer Player Strategy Builder Guide help
file to fail to open sometimes from within AI Editor.

- Updated the timer range accepted by the analyzer to 1-255 instead of 1-10,
to enable analyzing of Doug's strategy scripts.

- Added "AI Editor window" help topic.

- Added FEATURES, DOWNLOADING and REFERENCES sections to the README file, and
updated some of the old sections.

Version 1.0.1

- Fixed msvcp60.dll dependencies.

- Added TROUBLESHOOTING, RELEASE HISTORY, KNOWN BUGS, and CREDITS sections to
the README file.
			
Version 1.0

- Initial AI Editor release

KNOWN BUGS

There are not many I know of still, but there should be bugs, of course.
If you find any, please email me!

TROUBLESHOOTING

Many people that have tried to run the first release of AI Editor (1.0)
reported that the file msvcp60.dll was missing, and requested me to send
this dll. Unfortunately, simply sending this dll file would not solve the
problem, because this file is dependent on newer versions of some system dlls
than those that come with Windows 98 by default.

In response to this problem, I released the next version of AI Editor
(1.0.1) shortly after. It was independent of the msvcp60.dll, but failed to
load on some machines with older versions of the system dlls. It reported
that "aokai.dll is linked to missing export mfc42.dll:6571".

In this version of AI Editor (1.0.2), I believe that the above problem
is fixed. I have verified that AI Editor runs ok on a machine with a
"clean" installation of Windows 98. But have not tested it with Windows 95,
and with Windows NT with a service pack older than 5. If you use Windows 95
or Windows NT with an old SP, you may still have problems with missing
exports. It may run ok as well - I simply don't know.

If AI Editor fails to load because of missing exports, first of all make
sure that you are using version 1.0.2 or newer. To see the version number
of AI Editor, right-click aiedit.exe, choose "Properties" from the system
menu, and then click "Product Version". If you have an older version,
download a newer one from AoK Heaven or from the ES page. If you have
version 1.0.2 or newer, please drop me a mail about your case. Don't forget
to include in your mail the exact text error message, and the version of
Windows that you are using.

The information below is for advanced Windows users. If you are such a user,
it may help you solve missing exports problems and possibly other bugs
caused by not having the newest versions of the system dlls used by
AI Editor. 

In this release, AI Editor depends on the following system dlls:

---------------------------------------------------------------------
DLL				Version tested with
---------------------------------------------------------------------
mfc42.dll		6.0.8267.0
msvcrt.dll		6.0.8397.0
msvcirt.dll		6.0.8168.0
advapi32.dll	4.80.0.1675
gdi32.dll		4.10.0.1998
kernel32.dll	4.10.0.1998
user32.dll		4.10.0.1998
---------------------------------------------------------------------

If you have these dlls with these versions, or newer (or slightly older maybe),
then the AI Editor executable should run without problems. All these dlls can be
found in your Windows system directory. For Windows 95/98, this is usually
C:\Windows\System. For Windows NT, this is usually C:\WINNT\System32. To see the
version of a dll, right-click it, choose "Properties" from the system menu, and
then click "Product Version".

You should have these dlls if you have installed some of the Visual Studio 6.0
products, such as Visual Basic 6.0 or Visual C++ 6.0. In this case, it is
recommended that you also install Visual Studio SP3, which can be found at
http://msdn.microsoft.com/vstudio/sp/default.asp
This will install the newest available versions of these dlls and will
(hopefully) resolve any incompatibility problems.

If you haven't installed any Visual Studio 6.0 products, then you may have older
versions of these dlls than those required to run AI Editor. I have tested this
on some systems with Windows 98 and Windows NT. It appears that AI Editor runs
ok on Windows 98 and Windows NT + SP5, and (maybe) fails on older versions of
Windows 95 and on Windows NT with SP older than 5. In case of failure, AI Editor
complains of missing exports in mfc42.dll. If you have this problem, do the
following:

- Windows 98 users: download and install Windows 98 Customer Service Pack from
the Windows update site. To do this, go to http://www.windowsupdate.microsoft.com,
go to "Product Updates", find Windows 98 Customer Service Pack and follow
the instructions.

- Windows NT: download and install the latest NT service pack 6. To do this,
go to http://ftpsearch.ntnu.no, search for SP6I386.EXE, and then choose
the nearest ftp server to download the SP (34.0 MB). Once downloaded, simply
run it and follow the instructions.

I believe upgrading your system in this way will let you run AI Editor
without problems. Apart from this, having the newest update or SP installed
is of course always recommended.


CREDITS

I would like to thank the following people for supporting and encouraging my work:

Special thanks go to Mark Terrano (mterrano@enesmblestudios.com) for making all
this possible. Without his support, AoK AI Editor simply would not exist at all.

Michael McCart (webmaster@enesmblestudios.com) for web-mastering the AoE Heaven
site at the time when the first version of AoE AI Editor was released and
providing me with excellent support and feedback. He is still doing this for
AoK AI Editor, as a webmaster of the ES site.

All people who have emailed me with questions, bug-reports, words of 
encouragement and complaints. These are too many to be included here - for the 2 
years that have passed from the release of my first AoE tools, I have received 
some hundreds of emails. If they were not so many, I would have probably never 
written AoK AI Editor.

Last but not least Microsoft & Ensemble Studios for creating the greatest RTS 
game of all times, Age of Empires, and its most fantastic sequel, Age of Kings!

Enjoy!


