The preferred targeting only increases the chance of targeting the ideal target - it isn't guaranteed. And that is assuming you end up targeting a formation that includes your preferred target. For example, if your heavy tank formation is fighting an infantry formation (with different types of infantry, including AT), the heavy armour formation won't be very effective because even with preferred targeted, there is no armour to target. Equally if your all-infantry formation runs into a heavy armour formation that won't be very effective either, especially if it is anti-infantry armour. If heavy armour runs into mixed, then assuming the armour and infantry in the mixed formation are equal sizes, there will be 33% chance of targeting the infantry, while the opposing armour will have an ideal target 100% of the time.
The combination of random formation selection and weighted formation element selection (based on preference) should mean sufficient randomness to have formations fighting outside their comfort zone, while giving them a decent chance of encountering a preferred enemy. I don't think we should have an entirely random selection regarding who targets who. In fact, I was wondering whether double weight to preferred targets was enough.
This is a situation where intuitive understanding disagrees with actual reality, unfortunately. I know you think preferential targeting not always hitting the right target should help, and it sounds like it should help, but I'm trying to show you that it really doesn't.
That is assuming that the specialised formation is a) assigned a formation that contains an element with their preferred target type and b) is assigned the preferred element during target selection (which is in no way guaranteed). The specialised formation could easily end up completely unsuited to its opponent formation. I think mixed formations are probably the safer option, but both should work. Also, bear in mind that mixed doesn't necessarily mean infantry and armour, it could mean armour designed to fight armour plus armour designed to fight infantry, or a multi-role rank designed to do both.
a) is exactly my point. Giving any amount of preferential targeting at all means that a unit does more damage when it engages a formation with the type of target most suited to some of its weapons. And mixed formations are obviously more likely to contain one of those targets.
Let's say a unit has 10 anti-infantry, 10 anti-light vehicle, and 10 anti-heavy tank weapons, just to make up numbers.
If it targets a unit containing only infantry, light vehicles, or heavy tanks, then those respective 10 weapons will hit at best efficiency, and the other 20 will hit at reduced efficiency. The exact numbers don't really matter here, but we can call it 10 efficient and 20 inefficient.
If it targets a unit containing half infantry and half heavy tanks, and weapon assignment was completely random, then 5 anti-infantry weapons would hit infantry, 5 anti-heavy tank weapons would hit heavy tanks, and the remaining 20 weapons would hit inefficient targets. Note that this is
exactly the same as if it targeted a unit containing only one type of target.
If instead each weapon hit the preferred target 2 out of 3 times, then on average 6.66 of those anti-infantry weapons would hit infantry, 6.66 of the anti-heavy tank weapons would hit heavy tanks, and the remaining 16.66 weapons would hit inefficient targets. The end result is 13.33 "efficient" hits, which means the unit does more damage against formations with more than one type of target. The specifics of the weapons or the formation don't matter here; it also applies if the target formation has infantry, light vehicles, and heavy tanks.
So end result:
If targeting is random, attacking a formation with multiple types of targets (say, infantry, light vehicles, and heavy vehicles) is statistically the same as attacking a formation with only one type of target. This means players have no reason not to make the formations however they like (within reason). Even though intuitively it sounds weird that completely random targeting should make things worse, it's not the case.
If targeting is preferential, even by just 1%, then attacking a formation with multiple targets will inflict more damage than attacking a formation with only one type of target. The end result is that you are motivated to use single target formations whenever possible.
This isn't something you can get around by changing the numbers; it's a universal truth if the combat works like you're describing.
I don't believe it is true that specialised is best or equal armour is best. It will depend on the type of opponent encountered. For example, take the two tank designs below. The former will fare well against armour and the latter against infantry. Although the Hellhound has only two-thirds of the armour and is designed to fight infantry, it is also less than a quarter of the cost. A mixed formation of 40 Leman Russ and 180 Hellhounds would massacre infantry and, while it would be at a disadvantage against a specialised heavy armour formation (say 80x Leman Russ), it isn't that bad because the Hellhounds take the same amount to kill as the Leman Russ when attacking by Heavy AV and they cost far less. In other words, the specialised formation would actually kill less BP value than the mixed formation in a straight-up fight if they concentrated on the Hellhounds (which will happen one third of the time).
Leman Russ Annihilator
Transport Size (tons) 132 Cost 15.84 Armour 60 Hit Points 60
Preferred Target Type Heavy Vehicles
Heavy Anti-Vehicle: Shots 1 Penetration 60 Damage 60
Heavy Anti-Vehicle: Shots 1 Penetration 60 Damage 60
Hellhound Anti-Infantry Tank
Transport Size (tons) 42 Cost 3.36 Armour 40 Hit Points 40
Preferred Target Type Infantry / Static
Crew-Served Anti-Personnel: Shots 6 Penetration 10 Damage 10
Crew-Served Anti-Personnel: Shots 6 Penetration 10 Damage 10
Ok, let's take what you say and imagine that it's a formation of 40 Leman Russ and 180 hellhounds... and make it vs a formation of 40 Leman Russ *and* a
separate formation of 180 hellhounds.
50% of the time, the mixed formation targets the Leman Russ tanks, and 50% of the time it targets the hellhounds. On average, this means the Heavy Anti-Vehicle weapons are firing on the Leman Russ tanks half the time.
The Leman Russ and Hellhound tanks target the mixed formation 100% of the time, and when they do, one third of the time the the heavy anti-vehicle weapons fire on the hellhounds (as you note), and two thirds of the time they'll fire on the Leman Russ tanks. This means that on average they're firing on the Leman Russ (the preferred target) 66% of the time.
The end result is that the two specialized formations will kill the Leman Russ tanks 33% faster. The hellhounds will die a little slower (though if the Hellhound tanks had anti- medium vehicle weapons, the mixed formation would be losing
both Leman Russ and Hellhounds faster than the specialized ones, since the Leman Russ would take 66% of the anti-heavy weapons and the Hellhounds would take 66% of the anti-medium weapons.)
If, on the other hand, weapon targeting was completely random, then the specialized formations would target the mixed formation 100% of the time, and have a 50% chance to fire on the Leman Russ tanks.. exactly the same as the mixed formation firing back at the specialized ones. It's balanced, and I think you shouldn't fix what isn't broken.
Edit: Please note that you might look at the above and think you need to give formations a preference to targeting other
formations that their weapons work best against. This is a bad idea and will work even worse than what you have now; instead of splitting heavy vehicles and infantry into their own formations, it would mean you'd want to never have infantry and heavy tanks on the same
planet if you could avoid it, and would make the ground combat system much worse as a whole, at least in my opinion. It would also mean that you'd generally want a formation to be limited to weapons specializing in hitting a certain target, which is really the situation now except reversed (specializing formation by weapon instead of by target)