By Art Lathrop

For quite a while players of Stars! have been speculating on how targeting order in battle is determined. Several rules of thumb were proposed; however, none of them could compare designs with difference defensive ratings. Likewise, they could not account for different mixes of weapons and components.

During a debate regarding the accuracy and usefulness of one such rule of thumb, Thomas Pfister wrote a brief post outlining his belief that as long as defensive factors were identical, ships were targeted in order of "resources + boranium." I originally had no intention of working out the details of the targeting algorithm; however, after I saw his post I was curious to see if I could apply his results to get at the heart of a problem I was considering with shielded chaff.

As David Moen mentioned in his own article on targeting, there is some rounding going on in the formula, so ships that have a very close in "attractiveness" will be selected as if they had the same value. The game engine may use integers for certain steps in determining which targets to shoot at, while I am using exclusively floating point variables which could be the source of the rounding. William Butler notice that rounding down to the nearest one hundredth almost universally predicts the exact order that ships will be targeted. Ships with identical attractivenesses are targeted randomly. The formula predicts accurately that certain shielded or jammed targets will be fired upon before less attractive unshielded targets. This of course may not be the actual formula, but it has worked so far with all the tests I have given it and I would appreciate other people trying it out. When testing it, please take care to make sure all potential targets are in range or the results from the test bed may be misleading.

The general formula is quite simple:

Attractiveness = Cost/APN

Where: Cost = Boranium + Resources

APN = Attack Power Needed (please note that other people have referred to this as eff_dp)

Since beam weapons are much simpler I will work with them first.

Attack Power Needed (solely APN from here on) is simply the combined defenses for a ship modified by weapon power reducing factors such as beam deflectors (and most likely range). I have not tested for range for two reasons. One, it is not as easy to test for range since it shifts and one does not have direct control over the ships movement. A second reason is that for player's use, this is really not that important. If you are going to use this to determine if a certain design will be targeted before another one of your designs, range is not a factor that you will be able to control very well with your ship design.

APN Formulae for Beamers

Non-Sappers:

APN = (Armor + Shields)/(.9^n)*(Range Modifier)

Sappers:

APN = Shields/(.9^n)*(Range Modifier)

Where: n = number of beam deflectors on the ship

Range Modifier = 1 - .1*(Range)/(Max Range)

Please note again that the range modifier has not been confirmed to be part of this equation; however, it is most like that it is.

This is a relatively easy formula to follow. It basically is just how much damage a ship can take from a beam weapon. To calculate which ships are targeted first, simply add APN back into the attractiveness formula.

APN Formula for Torpedoes and Missiles

Please note accuracy includes jamming and targeting computers and is a percentage expressed as a number ranging between 0 and 1. Weapon type is equal to 1 for torpedoes and 2 for missiles. Accuracy is equal to the percent chance the missile or torpedo has to hit its target. This includes the effects of jamming. Please note that in calculating accuracy, it is easy to introduce a rounding error. William Butler posted a description of how to get the correct figure in February of 1999. Either refer to his article or just check to see if changing this number one percent makes a difference. This is not the original formula that I posted; however, this formula is much simpler.

For targets that have shield values equal to or greater than their armor value:

APN = Armor*2/Accuracy

For targets that have shield values less than their armor value:

APN = Shield*2/Accuracy + (Armor-Shield)/(Accuracy * Weapon Type)

So far all of my tests have duplicated these results. I have not extensively studied whether the number of the ships in the stack matters; however, my early tests did include a wide range of stack sizes ranging from one to 280. After those tests showed no effect for the number of ships in the stack, I concerned myself more with completing the general formulae. Of course you can enter the values of individual ships or stacks into the equation and it will not change the results there (since the cost will increase in direct proportion to APN).

I encourage people to double-check this. So far, I my tests have shown that it accurately accounts for all of the targeting behaviors that I could present to it. Notice that chaff have very high attractiveness (though shielded chaff, much less so). Ships with jammers, high armor, or shields tend to be much less attractive targets. It even correctly predicted that torpedoes' choice of targets differ from missiles.

Art Lathrop

Click Here for this articles accompanying spreadsheet (in .XLS format).