AI Controller =========================================== .. code-block:: csharp public class AIController AI Controller of a specific AI Player (bot). Each AI player has its own ``AIController``, created by ``AISystem``. It orchestrates one executor per AI behaviour concern (see the matching fixed fields on ``AIData``) each tick, in a fixed order - ``Utility``, ``Construction``, ``Production``, ``Scouting``, ``Defense``, ``Squad``, ``Economy`` - so that ``Utility`` always runs first (other modules read this tick's freshly computed focus values), ``Scouting`` runs before ``Squad`` (a unit claimed for scouting duty, via its ``OnUnitReady``, is never also grouped into a squad), and ``Defense`` also runs before ``Squad`` (a unit it pulls in to respond to a threat this tick already reads as having an order to Squad's own idle-squad check). Derive your own class from it and override its virtual methods (``UpdateAction``, ``HandleActions``, ``BuildModules``, ``OnHarvesterSpawned``, ``OnAIAddedToPlayer``) to add or replace logic - see :ref:`create_ai` for a full walkthrough, including how to plug your subclass in via ``AISystem.CreateAIController()``. .. toctree:: :glob: *