com.springrts.ai.oo
Interface OOAI

All Known Implementing Classes:
AbstractOOAI

public interface OOAI


Method Summary
 int commandFinished(Unit unit, int commandId, int commandTopicId)
          This AI event is sent when a unit finished processing a command.
 int enemyDamaged(Unit enemy, Unit attacker, float damage, AIFloat3 dir, WeaponDef weaponDef, boolean paralyzer)
          This AI event is sent when an enemy unit was damaged.
 int enemyDestroyed(Unit enemy, Unit attacker)
          This AI event is sent when an enemy unit was destroyed; see also the enemy-damaged event.
 int enemyEnterLOS(Unit enemy)
          This AI event is sent when an enemy unit entered the LOS of this team.
 int enemyEnterRadar(Unit enemy)
          This AI event is sent when an enemy unit entered the radar covered area of this team.
 int enemyLeaveLOS(Unit enemy)
          This AI event is sent when an enemy unit left the LOS of this team.
 int enemyLeaveRadar(Unit enemy)
          This AI event is sent when an enemy unit left the radar covered area of this team.
 int init(int teamId, OOAICallback callback)
          This AI event initializes a Skirmish AI instance.
 int load(String file)
          Absolute file path, should be treated read-only
 int message(int player, String message)
          This AI event is a notification about a chat message sent by one of the participants of this game, which may be a player or an AI, including this AI.
 int playerCommand(List<Unit> units, AICommand command, int playerId)
          see AISCommands.h S*Command structs
 int release(int reason)
          This AI event tells a Skirmish AI instance, that it is no longer needed.
 int save(String file)
          Absolute file path, writeable
 int seismicPing(AIFloat3 pos, float strength)
          This AI event is sent when a unit movement is detected by means of a seismic event.
 int unitCaptured(Unit unit, int oldTeamId, int newTeamId)
          This AI event is sent when a unit changed from one team to an other through capturing.
 int unitCreated(Unit unit, Unit builder)
          This AI event is sent whenever a unit of this team is created, and contains the created unit.
 int unitDamaged(Unit unit, Unit attacker, float damage, AIFloat3 dir, WeaponDef weaponDef, boolean paralyzer)
          This AI event is sent when a unit was damaged.
 int unitDestroyed(Unit unit, Unit attacker)
          This AI event is sent when a unit was destroyed; see also the unit-damaged event.
 int unitFinished(Unit unit)
          This AI event is sent whenever a unit is fully built, and contains the finnished unit.
 int unitGiven(Unit unit, int oldTeamId, int newTeamId)
          This AI event is sent when a unit changed from one team to an other either because the old owner gave it to the new one, or because the new one took it from the old one; see the /take command.
 int unitIdle(Unit unit)
          This AI event is sent when a unit finnished processing a command or just finished building, and it has currently no commands in it's queue.
 int unitMoveFailed(Unit unit)
          This AI event is sent when a unit received a move command and is not able to fullfill it.
 int update(int frame)
          This AI event is sent once per game frame, which is about 30 times per second by default.
 int weaponFired(Unit unit, WeaponDef weaponDef)
          This AI event is sent when a weapon is fired.
 

Method Detail

init

int init(int teamId,
         OOAICallback callback)
This AI event initializes a Skirmish AI instance. It is sent only once per AI instance and game, as the very first event.


release

int release(int reason)
This AI event tells a Skirmish AI instance, that it is no longer needed. It can be used to free memory or do other cleanup work. It is sent only once per AI instance and game, as the very last event. Values description for reason: 0: unspecified 1: game ended 2: team died 3: AI killed 4: AI crashed 5: AI failed to init 6: connection lost 7: other reason


update

int update(int frame)
This AI event is sent once per game frame, which is about 30 times per second by default.


message

int message(int player,
            String message)
This AI event is a notification about a chat message sent by one of the participants of this game, which may be a player or an AI, including this AI.


unitCreated

int unitCreated(Unit unit,
                Unit builder)
This AI event is sent whenever a unit of this team is created, and contains the created unit. Usually, the unit has only 1 HP at this time, and consists only of a nano frame (-> will not accept commands yet); see also the unit-finnished event.


unitFinished

int unitFinished(Unit unit)
This AI event is sent whenever a unit is fully built, and contains the finnished unit. Usually, the unit has full health at this time, and is ready to accept commands; see also the unit-created event.


unitIdle

int unitIdle(Unit unit)
This AI event is sent when a unit finnished processing a command or just finished building, and it has currently no commands in it's queue.


unitMoveFailed

int unitMoveFailed(Unit unit)
This AI event is sent when a unit received a move command and is not able to fullfill it. Reasons for this are: - The unit is not able to move - The path to the target location is blocked - The unit can not move on the terain of the target location (for example, the target is on land, and the unit is a ship)


unitDamaged

int unitDamaged(Unit unit,
                Unit attacker,
                float damage,
                AIFloat3 dir,
                WeaponDef weaponDef,
                boolean paralyzer)
This AI event is sent when a unit was damaged. It contains the attacked unit, the attacking unit, the ammount of damage and the direction from where the damage was inflickted. In case of a laser weapon, the direction will point directly from the attacker to the attacked unit, while with artillery it will rather be from somewhere up in the sky to the attacked unit. See also the unit-destroyed event. attacker may be 0, which means no attacker was directly involved. If paralyzer is true, then damage is paralyzation damage, otherwise it is real damage.


unitDestroyed

int unitDestroyed(Unit unit,
                  Unit attacker)
This AI event is sent when a unit was destroyed; see also the unit-damaged event. attacker may be 0, which means no attacker was directly involveld.


unitGiven

int unitGiven(Unit unit,
              int oldTeamId,
              int newTeamId)
This AI event is sent when a unit changed from one team to an other either because the old owner gave it to the new one, or because the new one took it from the old one; see the /take command.


unitCaptured

int unitCaptured(Unit unit,
                 int oldTeamId,
                 int newTeamId)
This AI event is sent when a unit changed from one team to an other through capturing.


enemyEnterLOS

int enemyEnterLOS(Unit enemy)
This AI event is sent when an enemy unit entered the LOS of this team.


enemyLeaveLOS

int enemyLeaveLOS(Unit enemy)
This AI event is sent when an enemy unit left the LOS of this team.


enemyEnterRadar

int enemyEnterRadar(Unit enemy)
This AI event is sent when an enemy unit entered the radar covered area of this team.


enemyLeaveRadar

int enemyLeaveRadar(Unit enemy)
This AI event is sent when an enemy unit left the radar covered area of this team.


enemyDamaged

int enemyDamaged(Unit enemy,
                 Unit attacker,
                 float damage,
                 AIFloat3 dir,
                 WeaponDef weaponDef,
                 boolean paralyzer)
This AI event is sent when an enemy unit was damaged. It contains the attacked unit, the attacking unit, the ammount of damage and the direction from where the damage was inflickted. In case of a laser weapon, the direction will point directly from the attacker to the attacked unit, while with artillery it will rather be from somewhere up in the sky to the attacked unit. attacker may be 0, which means no attacker was directly involved. See also the enemy-destroyed event.


enemyDestroyed

int enemyDestroyed(Unit enemy,
                   Unit attacker)
This AI event is sent when an enemy unit was destroyed; see also the enemy-damaged event. attacker may be 0, which means no attacker was directly involveld.


weaponFired

int weaponFired(Unit unit,
                WeaponDef weaponDef)
This AI event is sent when a weapon is fired.


playerCommand

int playerCommand(List<Unit> units,
                  AICommand command,
                  int playerId)
see AISCommands.h S*Command structs


commandFinished

int commandFinished(Unit unit,
                    int commandId,
                    int commandTopicId)
This AI event is sent when a unit finished processing a command.

Parameters:
commandId - used on asynchronous commands only (is -1 for regular commands). this allows the AI to identify a possible result event, which would come with the same id
commandTopicId - unique identifier of a command (see COMMAND_* defines in AISCommands.h)
See Also:
callback.handleCommand(..., int commandId, ...)

seismicPing

int seismicPing(AIFloat3 pos,
                float strength)
This AI event is sent when a unit movement is detected by means of a seismic event. A seismic event means erruption/movement/shakings of the ground. This can be detected by only by special units usually, eg by the seismic detector building in Balanced Annihilation.


load

int load(String file)
Absolute file path, should be treated read-only


save

int save(String file)
Absolute file path, writeable