AI Guide

This guide is designed to be an introduction to the AI systems in the game Star Wars: Empire at War and its expansion. The game runs in the Alamo engine, and so the general outline of the AI written here may be helpful for other games using the same engine.

This guide may never be fully completed. However, it will hopefully aid modders wishing to make changes major or minor to the way the AI in the game works.

I recommend you have your favourite XML/Lua editor(s) ready to look through files as you read this guide.

Getting the AI to Actually Work
So you wrote all the fancy stuff already and you want to get it working? Easy. Put your modded perceptual equations and evaluator scripts into a MEG file. Make sure the internal MEG file directories are set up the same as if they were extracted, except with the root folder as Data. Put the MEG file name into MegaFiles.XML. Now your mod has edited AI! Hopefully Petroglyph makes it so the game reads modded perceptions soon.

Drieck created a guide back in 2008 that covers much of this groundwork, you may find it useful as well: http://www.petrolution.net/item-206?apage=191

Overview: AI Framework

The Player

Budgets

Goals

Plans

Perceptual Equations

Lua and XML: EvaluatePerception

Lua and XML: Evaluator Scripts

Lua and XML: Goal Management

FreeStores

TaskForce

Galactic Markup

GameConstants AI Settings

Using Heroes with Plans: HeroPlanAttach

Perceptual Tokens Reference