Enemy A.I.

On Sunrider the enemy actions are lead by mainly two pints. The first is the damage potential of their attacks. The second is the "hate" or "threat" each unit has. Hate is a hidden variable and every normal unit starts with 100 hate, with the exception of some special units (targets you have to protect may start with more hate to make them priority targets for the enemy). After that, the units gains as much Hate as damage they deal to the enemy, with a special bonus based on the enemies maximum HP when they are the unit to destroy them. Overkill also counts as hate (the enemy sees it as ganging up on their barely alive allies). Thus, if you fire a kinetic shot with the Sunrider and leave a Battleship with very few HP, but finish it with an Assault from the Black Jack, the Black Jack will receive a lot more hate than the Sunrider. Your units will also lose Hate as they receive damage. Though this is in general a bad way to balance hate, in some cases it may help you spread some damage.

Another thing to take into account is that the enemy isn't able to take your EV in their calculations. They take the EV of all your units as 0. This can be very helpful to set baits (the Phoenix for example, serves very well for that task having +50 EV) and make the enemy waste their shots.

Enemy Actions
On the enemies actions directly:

Support ships go first, then all the 'lead' ships and finally the rest of the enemies. The 'lead' ships are dynamically picked out of all enemy units and consist of all those that have (flak+armor+shielding) above the fleet average - i.e. the big cruiser etc. They go first to make sure a mook doesn't move into cover after which the big guy moves leaving the mook vulnerable.

Once a unit's own AI starts it loops through each of its weapon and per weapon it loops through all player ships. It then estimates how much damage it will do with that weapon (taking into account accuracy, damage= weapon power*accuracy) for each player ship and multiplies this by threat. Double the hate and half the damage gives the same target priority. After the loop completes it shoots the target with the highest priority(weapon/target combination) but there are 3 exceptions: -if the expected damage is lower than 50 it will not fire a weapon -if during the damage estimation loop it finds that any weapon is expected to do more damage than the total remaining HP of the target it will fire the weapon immediately and ignore threat completely. -if it finds that moving closer to a different (nearby) enemy unit will greatly increase its defenses it will do so.

If the expected damage is lower than 50 or for some other reason can't find a reasonable target it will typically try and move closer to an enemy ship. Which ship it will move closer to is calculated like this: priority = (ship.hate/100+10) / (distance*distance/2.0) so an enemy unit with a lot of threat but that is very far away is unlikely to be target if a reasonable target is closer by.

Due to the way weapon priority works, the enemy also doesn't use Energy efficiently. Focusing mainly on the damage potential, the A.I. doesn't realize that instead of a single Laser attacks it could do 2 Assaults. This means that by nature the enemy will tend to use more-powerful but more EN expensive moves first, instead of sometime relying on multiple attacks to deal more reliable damage. It basically translates in that the enemy will tend to use Assault a lot less than lasers, but it can also have some other uses.