This will probably stir some controversy, especially as I know AI programming is something extremely difficult to touch.
From the lazy FREDer point of view capital ship to capital ship combat is like having to shoot a movie: every movement has to be planned carefully and ships needs to be strictly guided to obtain good results.
Using the attack command is a guarantee for hilarious consequences and ultimately ship collision most of the time as ships will try to waltz around each other ignoring their strong points.
"Use waypoints and sexps, you dummy!" has always been the standard solution but is that the only possible solution?
Rewriting AI is extremely hard indeed, but are we sure we need the same AI complexity as fighters and bombers?
Let's review for a moment the closest thing we have in reality, battleships engagements.
Without going into tactical subtleties, we could define a ship to ship engagement like this:
1) Get into optimal range for your biggest guns
2) position yourself for a broadside
3) shoot
4) if your guns are out of commission turn to fire your other batteries or try to flee
Of course this is a very simplified summary of a real battle but at the same time complexity is something we want to avoid in AI coding.
So, to translate this into something that could be coded we need to create a set of routines that AI could follow.
How could that work?
IMHO this could be coded in a series of steps (under the assumption the ship is on beam-free-all):
Phase 1, on mission start: ship fire-power assessment
1) define 6 90° ship quadrants (front, left, right, rear, top, bottom)
2) calculate main weapons position (main is defined as weapons with the "huge" and similar flags in weapons.tbl)
This could be a bit tricky and imho there are two ways to do that: either we use turret FOV from the model to auto assign them to one field or the other (difficulty: unknown) or define the quadrant(s) manually for each turret in ships.tbl (likely easier to code but a PITA to redo ship tables).
3) calculate quadrant strength (easy enough, sum the weapon damage)
4) calculate quadrant maximum range (pick the longest ranged weapon in the quadrant, which usually is the strongest at least in vanilla FS2)
Phase 2, upon attack order: Ship positioning
1) Pick strongest quadrant
2) Pick quadrant maximum range
3) Pick target distance
4) turn ship towards target
5) move ship to firing range, which can be defined as a % of quadrant maximum range (80-90% to ensure the ship can properly hit its target)
6) stop ship
7) rotate strongest quadrant towards target
Phase 3, upon receiving hit: Fighting
1) check turret subsystem health
2) for each destroyed turret recalculate quadrant strength by subtracting destroyed turret weapon damage
3) compare quadrant strength
4) if current engaged quadrant strength falls below a % of next strongest quadrant maximum strength, rotate ship to engage with the current strongest quadrant
The difficulty of coding this is unknown to me and would likely need to be seriously assessed by coders, but imho the principles are simple enough to be tied into the current code without creating a revolution.
Advantages:
- capships behaves in a realistic way by default
- reduced need for sexps
- more predictable capship behaviour
Disadvantages:
- Someone has to code it
- it could influence vanilla FS2 (although imho to a very minor extent)
- is in need of further refinements (it assumes targeted ship is static and that ship has at least one anticap weapon)
- could increase system requirements
What do you guys think?