Every ally and enemy ship is given a "personality" when it is created. This consists of a number of attributes that control their bravery, aggression, fanaticism and loyalty, and is based on the race of that enemy or ally.
During play, your ally ships will engage the enemy at will although you are allowed to give them a few general orders. These include who to attack, what course to follow, hold fire, etc. They will almost always follow these orders unless they are not very loyal or the order is very unreasonable. In any case, they will give a response to that order.
It is important to remember the orders you issued or you may render an ally useless. For example if you order an ally to follow a course, he will most likely follow that order until you cancel it.
If your ship sustains heavy damage (or even if it doesn't) you are allowed to trade ships with one of your allies.
The code that controls the enemy strategy also controls your ally ships (unless you give them specific orders.) In the absence of specific orders, the ally ships use the same decision routines and tactics as enemy ships do. However, no two ships will use exactly the same strategy, since there are various modifications to the common strategy based on the loyalty, bravery, aggression, and fanaticism of the individual captain. The modifications based on these parameters are not always given in the following explanation, but almost every decision that the strategy code makes is influenced by one or more of these factors.
Strategies of Different Nations
Bravery, loyalty, aggression, and fanaticism are determined separately for each captain when the game starts. Although each captain is different, there are certain generalizations that are true for the various nations. Exceptions to these rules can occur, but anyone who strays far from the norm would have been eliminated from consideration for command. The exception to this is the Pirates. Since anyone can become a pirate, there are no generalizations that can be made about them.
Federation captains are very brave. This causes them to fight to the last weapon on their ships. You will rarely see a Federation ship leave the battle before it is completely wrecked. They will also be then first to return to the fray after their ship is slightly repaired. Federation captains are also very loyal. They will never question your orders, and will carry them out to the death. Since their fanaticism is very low, you will rarely see a federation ship self-destruct. They make good allies and tenacious enemies.
The Klingon captain is not as brave, on average, as the Federation captain. However, no one could call them cowards. They are extremely aggressive, which causes them to attack no matter what the odds. They also seem to prefer a good old-fashioned phaser battle instead of torpedoes. Klingons are loyal. They also can be somewhat fanatical. Once in a while, a healthy Klingon ship will self-destruct next to you in a blaze of glory. Klingons are good opponents. They also make good allies.
Romulans are not as good as the Klingons or the Federation when it comes to battle. They disdain short range combat and prefer to rely on their deadly plasma torpedoes. Romulans hate to lose, however. All of their ships carry a suicide bomb that can quickly even the odds at the end of a battle. They do not hesitate to use it. Otherwise, they are lackluster fighters. Most of them will retire if they lose their big gun, but since their ships move slowly, this makes them easy meat. If you can defend against plasmas, Romulans make easy opponents. As allies, they would like to obey your orders, but their slow ships and long charging time on their plasmas make them seem unresponsive to your commands.
There are no hard and fast rules about pirates. No two pirate ships are the same. The qualities that influence their behavior vary widely. Some pirate captains will fight to the death, while others will turn and run at the sight of an enemy vessel. Some of them are aggressive, and some are timid. You will have to determine the characteristics of the captain you face in the heat of battle. Pirates make exasperating allies and frustrating enemies. What can you expect from a bunch of pirates, anyway?
Who to Fight
The first thing that a ship must do is decide on a target. If you have told an ally to attack a specific target (and he is loyal enough to do it), he will just pick that target. Otherwise, he goes through a process of determining the "threat level" of all the enemy ships in the simulation. The one with the highest threat level is the one he chooses to fight. The threat level of a ship is influenced by many factors. The range of the ship, the weapons it carries, and the number of ships already attacking the target ship all affect the threat level. There are other factors as well. Finally, a ship is more likely to choose a target that it is already attacking. This makes the attacker more determined to destroy a certain target before he chooses a different one.
Determining the Type of Attack
After a target is chosen, the prime weapon to use against the enemy is chosen. Once again, if you have ordered a ship to use a certain weapon against the enemy, he will try to use that weapon. If there are no specific orders, a comparison of relative strengths of the various weapons is made between the ship and its target. The weapon that gives the best chance for damage without being damaged back is the one that is chosen. For example, if the target ship has no phasers, and the attacking ship does, a phaser run would be the most effective tactic.
A special check is made to see if a probe could finish off the target ship. If it can, a probe is prepared and launched. Probes can also be used for defense, if the situation warrants.
The selection of the prime weapons system to use influences the movement of the ship. Once the weapon is selected, the ship will maneuver to gain the best position to use the prime weapons system. If the relative positions of the attacker and target prevent use of the prime weapon, the other weapons will still be used. For example, a ship that desires to make a phaser attack will still fire its torpedoes while it is closing for the phaser run.
As explained above, maneuvering is mostly concerned with bringing the prime weapons system to bear. At the same time, a "zig-zag" movement is usually employed to avoid enemy torpedoes. Orders from the player can drastically affect the movement of a ship. The various orders, and the ship movements that they produce, are explained below. Of course, the loyalty of the ship determines whether or not it will actually follow your orders.
All ally ships will attempt to perform the orders that you give them. In most cases, orders cause the ship to modify certain priorities in order to achieve the desired goal. A side affect of this is that a ship may not instantly drop what it is doing to carry out what you have told it to do -- sometimes it takes a few turns for the order to take affect. If a ship is loyal, it will do what you say. If it is not, it will tell you and refuse to do it. No ship will refuse to carry out an order without telling you first.
Since the immediate tactical situation that a ship is in can affect when the ship will be able to carry out your order, some people have called them "advice, not orders". While this is true to a certain extent, it usually means that it would have been too dangerous to carry out your order at the exact time you gave it. After all, the other ship captains are responsible for the lives of their crew, as well as doing what you say.
Besides battle tactics, there are other issues that are decided by the strategy routines. Some of them are explained below.
Phaser Incoming Ordinance
All computer controlled ships check to see if any incoming torpedoes can be disposed of by phaser fire. The phasers are not aimed specifically to destroy incoming torpedoes. If it happens that the phasers are pointing the proper way to destroy the torpedoes, the phasers are fired. This usually is sufficient, because the phasers are normally locked onto the target of the ship, and the target is usually the one that is firing at the ship.
There is quite a bit of code dedicated to probe avoidance. The problem with probe avoidance is how to get around or destroy the enemy probe without abandoning your target. Computer controlled ships could easily dispose of all probes if they ignored enemy ships while doing it. Of course, this is not possible. So, probe avoidance is a compromise between the safety of the computer controlled ship and the maneuvering to attack the enemy target ship.
Normally, the ship will try to maneuver around any probes. If this is not possible, a phaser will be swiveled to point at the probe and the probe will be destroyed. This is a time consuming operation, however, so maneuvering around a probe is definitely preferred.
Engine Temperature Control
Ships must also check on the temperature of their warp drives. If the drives are in danger of overheating, the ship will slow down to give them a chance to cool off. The ship will move slowly for several turns until the engine's temperature is safe. However, if there are engines that are in much better shape than the hot engine, the bad engine is allowed to overheat. This lets the ship travel at a greater average speed.
Computer controlled ships must also worry about managing the amount of energy the ship is using. If there is not enough energy to run the life support system, the ship will stop using the warp drive in order to use it's power to keep the crew alive. If only some of the shields can be raised in order to preserve power, the weakest shields are turned off to preserve the good ones.
The normal maneuvering of the ship can be interrupted for a number of reasons. For example, if a self-destructing ship is nearby, it must be avoided. Also, if the rear shield has been destroyed on a retreating ship, the ship is turned to present the front shield to any attacker. If the computer controlled ship is self-destructing, it wants to get as close as possible to it's target before it blows up.
When to Exit
Ships must also decide when they have had enough. The basic formula for retreating is:
if damage to ship >= captain's bravery, then retreat
As you can see, if the captain is a fearful, it does not take much to get him to run. On the other hand, a brave captain will fight to the death, no matter what shape his ship is in. There is also a variation that can happen when a ship decides to retreat. If the captain's fanaticism is high and his ship can damage the enemy, he may choose to kill himself rather than retreat. Ships with suicide bombs will blow themselves up more because they can still hurt the enemy no matter what shape they are in.
There are other things that influence the actions of a computer controlled ship as well. But some of them must remain secrets. After all, part of the excitement in begin is not knowing what your opponent will do next!