Combat occurs in a preset sequence of stages, and each stage of combat takes place in a specific order. The general rule is that the more aggressive combatant fights first, and from the right side. In complex stacked battles, however, this order can shift dynamically during the fighting, so details are important.
Priority Intercept Attack is a special case of combat. More details can be found here.
Starships will fight other starships if any of the following is true:
A starship will NOT fight another starship if:
Ships fight other ships according to a particular sequence, with higher priority starships fighting each other first and lower priority (or less aggressive) fighting after. Each starship can start combat with each other starship, and every ship in turn will proceed through its target list as long as it's still alive and uncaptured. Captured ships may fight on behalf of their new owners, and they will fight both within this order and then an additional one, set anew when captured – but, notably, a limited number of times. (Captured ships get complicated.)
Priority is as follows:
Priority within each subgroup is ordered according to Ship ID number; the lower the number, the higher the priority. There are no ties or other factors that can influence this. (The sole exception is Priority Intercept Attack, which reverses Ship ID priority.)
This can take place in two separate ways: either the starship can attack the planet or the planet can attack the starship. Starships instigate combat if they have either the Kill! mission set or have their Primary Enemy set to the owner of the planet. Planets can attack starships by using the NUK or ATT Friendly Codes.
Ships will NOT attack planets if:
Planets will NOT attack ships if:
Priority is as follows:
Priority within each subgroup is ordered according to Ship ID number; the lower the number, the higher the priority.
As explained above, you can use numeric Friendly Codes to fine-tune the order in which you want your ships to fight. If you set a Friendly Code from 001 to 999, the ships will fight in the order of the numbers specified, lowest first. Of course, your enemy may be setting these as well to control his own order of battle (for example), and if you both happen to use 001, those two ships will not fight due to matching Friendly Codes. So you might want to switch it up a bit, and maybe use 054, then 321, then 685, et cetera. Ships with any letters in the Friendly Code are ineligible for control using this method, though they still are ordered by the rules concerning mission and Primary Enemy.
Friendly Codes using one or two digits are generally read as though zeros had been added to the end to make up a three-digit number. The Friendly Code 000 is read inconsistently. Results using these are occasionally erratic.
One article on Battle Order can be found at http://www.planetsmagazine.com/strategy/strategic-knowledge/whos-on-first-on-combat-order-and-battle-value/ and another related guide to carrier-versus-carrier combat is available at http://www.planetsmagazine.com/strategy/strategic-knowledge/advanced-combat-carriers-and-left-vs-right/.