A SAM should fire only as many as it takes to destroy its current target.
That's not something C understand though.
The question still remains: "how many AA Defenses (SAMs in this case) are necessary to destroy a VTOL". I'm interested in it just out of curiosity. We know probability for SAMs to hit the target, what is problematic, is that this probability is not the same as a probability for a VTOL to be eventually hit, since AA defenses predict VTOL location based on their current speed and direction. If a VTOL will change its speed and/or direction AA defenses will miss.
As for the second line of defenses, consider this situation: a player has built 50 SAMs near each other. Now 10 enemy VTOLs come. Let's say 20 SAMs start targeting the VTOLs, since an algorithm has calculated that 20 SAMs are "enough to kill the targets". Let's say 10 SAMs were lucky and fired at the right predicted location of the VTOLs (since hit chance has probabilistic nature). 5 of the 10 VTOLs targeted by 'lucky' SAMs has changed their speed or flying direction. Ergo only 5 out of 15 VTOLs get taken down, other 15 fly through and wreak havoc in the base. The advantage is that many SAMs haven't wasted their ammo and are ready and patiently waiting for the second wave, but the enemy is stock AI so it won't come.
I think the player will be cursing like a drunk sailor wondering why 30 of 50 costy SAMs didn't even try to move. And he will be right. He can't know that we assume that the player has a second or even a third line of defenses.
Since there are so many Linux lovers around here, you should take the UNIX approach.
I have a rough idea of the algorithm. Main thing is it should be effective and it should be able to handle any combination of different AA sites: SAMs, Whirlwind, Hurricane etc. This is probably going to be the hardest part. I'm not working on it though, just taking part in the collaborative musing about a non-trivial problem and I think it was my last contribution, it takes too much time.
Rman Virgil wrote:
* A waste of ordinance that can be deliberately triggered in a 2 wave attack wherein the 1st wave is a sacrificial decoy and the timed 2nd wave is your main force which has been given something of a safety buffer simply because your SAMs have all blown their first salvo like blind fools on the decoy (I think Troman is trying to minimize the "blind-fool" dependency).
I think it is actually the opposite, as I understand it Chojun is trying to do it.
What I think is that there's almost no way for AI to deal with such a trick. Even humans will have a hard time recognizing it.
Our main goal is to minimize number of structures destroyed by the VTOL attack. Therefore we must minimize number of VTOLs that will get through our AA defenses (not their damage, although there is a relation, of course).
Because of this it is better to spend an extra shot(s) at the enemy VTOL to maximize the chance for it to get killed than to fire just enough to take down a VTOL (taking into account SAM's chance to hit), since 50% of undamaged VTOLs getting through is better than all VTOLs with 1% health left dropping all their bombs at the base.
It is actually what Chojun said:
Chojun wrote:"Everything should do one thing and do it well."
What I just described makes SAMs doing one thing: killing VTOLs and they will be doing it well under any situation.
If the enemy uses the trick with two waves, then he has used a smart strategy, (which is not necessary now, since SAMs are not intelligent enough) and has outsmarted the game AI - the strategic AI. This is not a fault of unit AI of the SAMs and this
, the strategical part, is what SAMs should not care about IMHO, otherwise they will be doing a second thing, which is actually a game AI's task.
My 2 cents.
EDIT: looks like there are two new posts posted while I was writing my novel, I guess I'm too slow.