Attack is important for protecting your currently conquered planets from incoming enemy fleets and for being that incoming enemy fleet to take over new planets.
A ship's ability to attack and defend will improved by upgrading the attack and defense skills.
The Attack Process
When your ship executes the ATTACK() function during a tic, as long as it is within range of the other ship, the attack process takes place instantly.
The Damage of an attack is cacluated by:
damage = (my_ships.attack * (defense_efficiency/enemy.defense+defense_efficiency))
[Where defensive_efficiency is a static system variable]
All damage done is stored in a ships future_health which is commited to current_health at the end of a tic.
If a ship is left with 0 health for 60 tics, it is destroyed!
The ATTACK(Ship ID, Enemy Ship ID) Function
The ATTACK( ) function can be called on its own or used in-line with any more complex query. Consider the following examples:
Ship #101 attacking #202
All Ships named "Home Defender" attacking in range Enemy Ship #202
Using Ship State to Attack Continuesly
While the ATTACK function must be called every tic, if you plan for this same action to occur each tic you can use the ship's state to define that action. A ships stateful action must still meet all normal requirements including that a ship can only perform on action per tic and it must be within range of the other ship.
Ship #101 attacking Ship #202 Continuesly
All Ships named "Home Defender" continuesly attacking Ship #202