com.springrts.ai.oo
Class AbstractOOAI

java.lang.Object
  extended by com.springrts.ai.oo.AbstractOOAI
All Implemented Interfaces:
OOAI

public abstract class AbstractOOAI
extends Object
implements OOAI


Constructor Summary
AbstractOOAI()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOOAI

public AbstractOOAI()
Method Detail

init

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

Specified by:
init in interface OOAI

release

public int release(int reason)
Description copied from interface: OOAI
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

Specified by:
release in interface OOAI

update

public int update(int frame)
Description copied from interface: OOAI
This AI event is sent once per game frame, which is about 30 times per second by default.

Specified by:
update in interface OOAI

message

public int message(int player,
                   String message)
Description copied from interface: OOAI
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.

Specified by:
message in interface OOAI

unitCreated

public int unitCreated(Unit unit,
                       Unit builder)
Description copied from interface: OOAI
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.

Specified by:
unitCreated in interface OOAI

unitFinished

public int unitFinished(Unit unit)
Description copied from interface: OOAI
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.

Specified by:
unitFinished in interface OOAI

unitIdle

public int unitIdle(Unit unit)
Description copied from interface: OOAI
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.

Specified by:
unitIdle in interface OOAI

unitMoveFailed

public int unitMoveFailed(Unit unit)
Description copied from interface: OOAI
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)

Specified by:
unitMoveFailed in interface OOAI

unitDamaged

public int unitDamaged(Unit unit,
                       Unit attacker,
                       float damage,
                       AIFloat3 dir,
                       WeaponDef weaponDef,
                       boolean paralyzer)
Description copied from interface: OOAI
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.

Specified by:
unitDamaged in interface OOAI

unitDestroyed

public int unitDestroyed(Unit unit,
                         Unit attacker)
Description copied from interface: OOAI
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.

Specified by:
unitDestroyed in interface OOAI

unitGiven

public int unitGiven(Unit unit,
                     int oldTeamId,
                     int newTeamId)
Description copied from interface: OOAI
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.

Specified by:
unitGiven in interface OOAI

unitCaptured

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

Specified by:
unitCaptured in interface OOAI

enemyEnterLOS

public int enemyEnterLOS(Unit enemy)
Description copied from interface: OOAI
This AI event is sent when an enemy unit entered the LOS of this team.

Specified by:
enemyEnterLOS in interface OOAI

enemyLeaveLOS

public int enemyLeaveLOS(Unit enemy)
Description copied from interface: OOAI
This AI event is sent when an enemy unit left the LOS of this team.

Specified by:
enemyLeaveLOS in interface OOAI

enemyEnterRadar

public int enemyEnterRadar(Unit enemy)
Description copied from interface: OOAI
This AI event is sent when an enemy unit entered the radar covered area of this team.

Specified by:
enemyEnterRadar in interface OOAI

enemyLeaveRadar

public int enemyLeaveRadar(Unit enemy)
Description copied from interface: OOAI
This AI event is sent when an enemy unit left the radar covered area of this team.

Specified by:
enemyLeaveRadar in interface OOAI

enemyDamaged

public int enemyDamaged(Unit enemy,
                        Unit attacker,
                        float damage,
                        AIFloat3 dir,
                        WeaponDef weaponDef,
                        boolean paralyzer)
Description copied from interface: OOAI
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.

Specified by:
enemyDamaged in interface OOAI

enemyDestroyed

public int enemyDestroyed(Unit enemy,
                          Unit attacker)
Description copied from interface: OOAI
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.

Specified by:
enemyDestroyed in interface OOAI

weaponFired

public int weaponFired(Unit unit,
                       WeaponDef weaponDef)
Description copied from interface: OOAI
This AI event is sent when a weapon is fired.

Specified by:
weaponFired in interface OOAI

playerCommand

public int playerCommand(List<Unit> units,
                         AICommand command,
                         int playerId)
Description copied from interface: OOAI
see AISCommands.h S*Command structs

Specified by:
playerCommand in interface OOAI

commandFinished

public int commandFinished(Unit unit,
                           int commandId,
                           int commandTopicId)
Description copied from interface: OOAI
This AI event is sent when a unit finished processing a command.

Specified by:
commandFinished in interface OOAI
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

public int seismicPing(AIFloat3 pos,
                       float strength)
Description copied from interface: OOAI
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.

Specified by:
seismicPing in interface OOAI

load

public int load(String file)
Description copied from interface: OOAI
Absolute file path, should be treated read-only

Specified by:
load in interface OOAI

save

public int save(String file)
Description copied from interface: OOAI
Absolute file path, writeable

Specified by:
save in interface OOAI