How to find/use the different tools



This is a step by step tutorial to build an AI.exe file with a sample script. I did this with Windows XP, it should work on Windows Vista though.






General tools organization


Put the different tools where you find it convenient, personnally I use a tool folder in Starcraft directory, put each tool in each own sub-folder.
Your tool repository will look like that after installing all the tools.


Note: If you move the Tools folder after installing the tools, you will have to manually edit the configuration files.




List of the tools to use:

Now you have everything you will need to do your own AI.

Note: If needed there is also a tool list here http://www.broodwarai.com/forums/index.php?showtopic=105




Test of the compiler tools:

This section show step by step how to use the different tools installed before. We will create an AI.exe file with a modified computer AI.
Depending on what compiler tool you installed, go to the corresponding section.



ScAIEdit:

 
First, open the ScAIEdit folder, create a new folder. Name it MyAI for instance.
Copy aiscript.bin, bwscript.bin, stat_txt.tbl from the "default" folder to the "MyAI" folder.


First utilisation only: Before launching ScAIEdit.exe for the first time, check if there is a scaiedit.conf file in the scaiedit folder. If so, delete it because it contains wrong data. This file will be generated automatically when launching ScAIEdit.

Note on ScAIEdit: The help file of ScAIEdit is really useful particularly for command syntax/help. Don't follow the ScAIEdit documentation for creating a Self Extracting CWAD, we will do it with another way.


Launch ScAIEdit by double-clicking on ScAIEdit.exe.

Go in File > Open HDD Navigator, now you should see this:


Go in the MyAI folder and double-click on the aiscript.bin. If there is an error saying it cannot find a unidef.ini file it is because there is a wrong scaiedit.conf file. The solution is to exit ScAIEdit delete the file and launch ScAIEdit again.

Scroll the aiscript window and double-click on the script to modify, we will choose the script for Protoss AI in BroodWar custom maps called "Protoss Expansion Custom Level"


Then we have the script window with all commands for the default Blizzard Protoss AI. When making your own script, you will edit this file. For now, we will just test a sample script from Michel Klabbers' tutorial. Select and copy all the lines of the sample script, then go in the script window, and replace the Blizzard Protoss AI commands by these new commands.
When it's done check for errors by clicking on the button here.



If the small box is giving 0 error messages, it's good you can save it by clicking on the save button.



Now go to the aiscript window and click on the compiling button



A small message box will open when the compilation is done:



Click on Ok.

Note: if you don't get this box when compiling it means there is a problem somewhere, not necessary in the scripts, it might be a configuration problem.

Go to Creating and testing the AI.exe



PyAI:

First, open the PyAIwithGUI folder, create a new folder. Name it MyAI for instance.
Copy aiscript.bin, bwscript.bin from the "Libs/default" folder to the "MyAI" folder.


Launch PyAI by double clicking on PyAI.pyw.
Go in File > Open, choose the aiscript.bin first, open it. Then another window called open bwscript.bin will open, open the bwscript.bin.



Now in PyAI window you should have the list of different scripts.
Open the Protoss AI Brood War Expansion scipt for custom maps by double clicking on it.



Copy the Protoss script sample and paste it the AI Script Editor instead of the default script - you can use "ctrl+A" to select all the text and easily copy/pasting it.

Now save the AI Script by clicking on the save button in AI Script Editor. If this window doesn't close there are errors, click on the Test Code button to check, correct them and click on the save button in AI Script Editor. If there are errors in the script, PyAI won't import it and display the errors description and line numbers. If there are only warnings, script will be imported - checking the warnings could be useful though.

After importing scripts it's time to compile, click on the save button in PyAI main window.



Go to Creating and testing the AI.exe



Creating and testing the AI.exe:


Note: This section is common for PyAI and ScAIEdit, the screenshots were taken using ScAIEdit folders.

Return in the Tools folder and launch WinMPQ.exe

Go in File > Open
Choose the folder where you put the BlankAi_Vista.exe and open it.

You can either add your compiled aiscript.bin file with Mpq > Add, or by dragging it from MyAI folder and droping it in BlankAi_Vista.exe like in the picture below:


A window will pop up, enter "scripts\" without the double quotes.



Now it's done, try the AI by double clicking on BlankAI_Vista.exe. You can copy and rename it too.

A good way to test AI's is to use replays because you can watch them at speed x16. You can download a replay pack for the different match-ups here:
http://www.broodwarai.com/files/Contests/BWAIWar3/BWAIWarIII_no$_replay.zip
Put them in the "Starcraft/MAPS/replays" folder. When watching a replay look at the differences with the default Protoss AI such as 2 forges, no shield battery, if you see that, it's all right.

Now, let's move on the most intersting part, the scripting of the future godlike AI.



Next