Warzone has one of the best AI system in RTS games, Warzone is always being referenced by various AI sites as advanced AI learning resource.
The strategy AI system
The strategy AI uses Warzone Scripting Language powered by bison and flex grammar interpretor to do high-level event-driven scripting.With the action and order commands exposed to this system, you can literally control every single game object with proper scripting. The scriptlang.htm that comes with the source data has the detailed information about the scripting syntax and usage.
The individual AI system
The individual AI system can be split into 3 major parts: Action,Order and Secondary State.
Action
Action usually updates per-frame,an object in Warzone can only have 1 action at a time,the Action as its name suggests,it's what a unit is doing in current game frame. The action struct in warzone source can hold location of action(such as a move-to action),the pointer to object to perform action on(such as a hostile target to attack or a friendly target to repair/build).The information acquired from action struct will be stored in the [doxygen:DROID] struct.
Order
Order lasts a few frames,and it makes an object to do an action constantly during this period.Order also affects the secondary state of a droid.
Secondary States
Secondary States is a uint32_t flag to store the secondary state of a droid or factory, including the Attack Range Preference, Tolerable Damage Percentage and ReturnToLocation and so on. (A droid gets most of its Secondary State from its 'parent' factory).
The commander and firesupport AI
The commander and firesupport AI is fairly simple and straightforward, basically all units linked to a the commander/sensor unit will follow the commander/sensor, and combat-units will use commander/sensor unit's ActionTarget, rather than acquiring their own targets. Non-combat ones like repair unit will still acquire their own targets, since commander/sensor unit's target is usually hostile and invalid for them.
There are traces of plans to add advanced 'brain AI' to command turret in source, unfortunately it seems Pumpkin didn't have the time to finish it.
Category:Development? Category:Coding? Category:Code documentation?
