AI Interface -> engine callback.
Each AI Interface will receive an instance of this struct at initialization.
The interfaceId passed as the first parameter to each function in this struct
has to be the same as the one received by the interface,
when it received the instance of this struct.
@see SAIInterfaceLibrary
@brief Artificial Intelligence Interface library interface
This AI event is sent when a unit finished processing a command.
@param 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
@param commandTopicId unique identifier of a command
(see COMMAND_* defines in AISCommands.h)
@see callback.handleCommand(…, int commandId, …)
Creates a group and returns the id it was given, returns -1 on failure
@brief Creates a straight line
Creates a straight line from pos1 to pos2.
@brief Creates a cubic Bezier spline figure
Creates a cubic Bezier spline figure from pos1 to pos4,
with control points pos2 and pos3.
Wait until another unit is dead, units will not wait on themselves.
Example:
A group of aircrafts waits for an enemy’s anti-air defenses to die,
before passing over their ruins to attack.
Removes a figure group, which means it will not be drawn anymore.
This function allows you to draw units onto the map.
This AI event is sent whenever a unit of an enemy 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.
See also the enemy-finished event.
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.
See also the enemy-destroyed event.
This AI event is sent when an enemy unit was destroyed; see also the
enemy-damaged event.
This AI event is sent when an enemy unit entered the LOS of this team.
This AI event is sent when an enemy unit entered the radar covered area of
this team.
This AI event is sent whenever an enemy unit is fully built, and contains the
finished unit. Usually, the unit has full health at this time.
See also the unit-created event.
This AI event is sent when an enemy unit left the LOS of this team.
This AI event is sent when an enemy unit left the radar covered area of this
team.
Erases a specified group
Wait for the arrival of all units included in the command.
Only makes sense for a group of units.
Use it after a movement command of some sort (move / fight).
Units will wait until all members of the GatherWait command have arrived
at their destinations before continuing.
Returns the approximate path cost between two points.
Creates a new unit with the selected name at pos,
and returns its unit ID in ret_newUnitId.
The AI team receives the specified amount of units of the specified resource.
This AI event initializes a Skirmish AI instance.
It is sent only once per AI instance and game, as the very first event.
The following functions allow the AI to use the built-in path-finder.
This AI event is sent when the AI should be loading its full state from a
file.
This AI event triggers whenever any message
is sent by a Lua widget or unsynced gadget.
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.
Pause or unpauses the game.
This is meant for debugging purposes.
Keep in mind that pause does not happen immediately.
It can take 1-2 frames in single- and up to 10 frames in multiplayer matches.
This AI event is sent when a user gives a command to one or multiple units
belonging to a team controlled by the AI.
For more info about the given commands, please use the
Unit.getCurrentCommands() method of the callback.
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
This AI event is sent when the AI should be saving its full state to a file.
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.
Give <amount> units of resource <resourceId> to team <receivingTeam>.
@brief Sends a chat/text message to other players.
This text will also end up in infolog.txt.
Give units specified by <unitIds> to team <receivingTeam>.
<ret_sentUnits> represents how many actually were transferred.
Make sure this always matches the size of <unitIds> you passed in.
If it does not, then some unitId’s were filtered out.
Set the percentage of health at which a unit will return to a save place.
This only works for a few units so far, mainly aircraft.
Sets the color used to draw all lines of figures in a figure group.
Set what a unit should do when it is idle.
This only works for a few units so far, mainly aircraft.
Assigns a map location to the last text message sent by the AI.
Allows one to give an income (dis-)advantage to the team
controlled by the Skirmish AI.
This value can also be set through the GameSetup script,
with the difference that it causes an instant desync when set here.
Tells weapons that support it to try to use a high trajectory
@brief Skirmish AI Callback function pointers.
Each Skirmish AI instance will receive an instance of this struct
in its init(skirmishAIId) function and with the SInitEvent.
@brief Skirmish Artificial Intelligence library interface
Wait for a specific ammount of units.
Usually used with factories, but does work on groups without a factory too.
Example:
Pick a factory and give it a rallypoint, then add a SquadWait command
with the number of units you want in your squads.
Units will wait at the initial rally point until enough of them
have arrived to make up a squad, then they will continue along their queue.
This AI event is sent when a unit changed from one team to an other through
capturing.
Both giving and receiving team will get this event.
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-finished event.
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.
This AI event is sent when a unit was destroyed; see also the unit-damaged
event.
This AI event is sent whenever a unit is fully built, and contains the
finished unit. Usually, the unit has full health at this time, and is ready
to accept commands.
See also the unit-created event.
This AI event is sent when a unit changed from one team to another,
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.
Both giving and receiving team will get this event.
This AI event is sent when a unit finished processing a command or just
finished building, and it has currently no commands in it’s queue.
This AI event is sent when a unit received a move command and is not able to
fullfill it. Reasons for this are:
This AI event is sent once per game frame, which is about 30 times per second
by default.
This AI event is sent when certain weapons are fired.
For performance reasons, it is not possible to send this event
for all weapons. Therefore, it is currently only sent for manuall-fire
weapons like for example the TA Commanders D-Gun or the Nuke.