Fixing the issue of ship movement-target (driver) selection

This crops up a lot, so I’ve been looking at it today.
Essentially the problem (correct me if I’m wrong) is that ships only re-choose which enemy ship to head towards if the enemy ship is destroyed or otherwise leaves the battle. This allows for a few sneaky ‘lure’ and ‘decoy’ tactics as well as being quite unrealistic.

Looking at the AI code, a few things crop up:

  1. Indeed, this is a bug of sorts. To cut a long story short, the ai checks where to go every 2 seconds (actually slower, but call it 2 seconds) , but if the current target is still valid, it shortcuts out of that
  2. Fixing that is trivial, encouraging a genuine reassessment of targets every 2 seconds instead works just fine but…
  3. it turns out when you do that, it becomes clear a LOT of the time the targets being chosen are really bad. lots of cruisers keep trying to catch fighters…

The code that works out which ship to move towards is possibly in need of changes. Right now, it evaluates all ships that it is allowed to engage (ie: there is an ‘attack’ order, regardless of priority, for that class of ship), and weights all of them based on their priority and their range. (if none are found, it will go after ships its not supposed to).
For example:
Enemy fighter 1 is at range 30 and target priority for fighters is 10%. What the code does is take 1-10% = 90% and adds 0.9 * 30 to the range, and ‘scores’ that target at 30+27 = 57
Enemy cruiser 2 is at range 500 and target priority for cruisers is 100%. so the code gives us 1-1 = 0% and ‘scores’ that target at 500.
The ship thus chases around after the fighter right under it’s feet, rather than taking the sensible route of moving to engage the high priority (100%!) cruiser.

Clearly this sucks :smiley:

So here is what I propose trying (I’ll probably set up a beta testing group of people for it).

The AI looks at the highest priority ship class according to it’s orders, if one is higher than the others. For example cruisers…
It then tries to find a cruiser, anywhere on the map, and picks the nearest one to engage.
If it fails to find one, it then moves to the second priority…
and then the third priority
If all priorities are the same, the largest (cruiser,then frigate,then fighter) gets checked first.

This is only for MOVEMENT, so the gunners on the ship will still let rip at nearby fighters on frigates en-route to their new target, which also, thanks to finding the above bug, will be re-evaluated more often (maybe not every 2 seconds though, perhaps a separate counter, at 10 seconds).



It’s a very good thing.
Goodbye lure ship.
Goodbye “keep moving” ship that stuck in other enemy ship.
Hello new kind of strategy I didn’t see right now but somebody will (without any doubt) create to bypassed it ^^

This would be lovely. I’ve lost count of the number of battles I lost basically because some of my skirmish-type frigates spent so much time trying to eliminate four enemy fighters zooming around that they missed out on the slugfest that shredded all the rest of my ships. But for frigates specifically, I don’t always like to delete the Attack Fighters order because sometimes they are more effective at picking off the fighters than anything else I have on the field.

I endorse this wholeheartedly. Yay for Cliff!

The proposed solution looks good to me. Would the driver AI also receive feedback from the gunner AI, though? As in, “we’ve been shooting at this guy for a couple minutes now, and we can’t (hit him)/(penetrate the armor/shields) - move us into range of some other target”.

I don’t think this would remove lure and decoy ships, I think it would cause the creation of lures to be slightly different (and potentially more difficult) - you’d have your fleet built so that it starts in a clump and then assign orders so that the lures head off in one direction while your real ships head off in another, for instance by combining escort and formation orders to drive the ships off in a given direction. Granted, lures and decoys would probably end up becoming much less effective, over-all, especially against fast opponents.

Cliff, here’s a potentially useful resource for you: the only substantial A.I. discussion thread for GSB. Excellent player feedback there from veterans; we covered a lot of ground with you. While a sizable chunk of that discussion revolves around specific problems with combat orders, numerous points raised there about the tactical problems caused by A.I. mishandling of moving vs shooting drivers may be of use to you right now. Enjoy.

Well there’s your problem, it’s additive instead of multiplicative. The maximum result being that the game thinks the ship is twice as far away as it really is, despite there being a 10x difference in target priority.

I’d propose something like:

Distance / Target Priority

If your ship has:

Attack Fighters 10%
Attack Frigates 50%
Attack Cruisers 100%

And there are 3 targets available:

Fighter @ 30 Distance
Frigate @ 900 Distance
Cruiser @ 900 Distance

The scores would be:

Fighter: 300
Frigate: 1800
Cruiser: 900

Your ship would still go after the fighter as is, but you could change the slider:

Attack Fighters 5%: 600
Attack Fighters 2%: 1500
Attack Fighters 1%: 3000

This is obviously less than perfect, since fighters routinely get within 10-20 of a ship during a flyover. But it’s not like we’re going to be forced to use “attack fighters” all of a sudden, most fleets already take it off.

With absolute rules like that, you would open the door for a new set of “lure” tactics. If ships always ignore frigates in favour of cruisers, we could stick a dud cruiser in the back somewhere while frigates munch on a fleet. If ships always go after frigates first, we could use the same lure tactics we do now, but with heavily armored frigates instead of cruisers.

Okey dokey, I have coded a fix for this as described. I need a few guinea pigs to try a new patched version which implements it to check it’s working as expected. It seems to work to me, but what would I know? :smiley:
Can people email me at cliff@positech dot co dot uk (hopefully from the email you used to buy the game if poss), and I will sort out a patched exe that can be used to test out this fix.

It’s a reverse order? (Higher the number, less is the priority?)

An other thing.
The driver AI didn’t detect enemy who are further than about 5000, it does not happen often, but it’s still some kind of bug…

(For the one who ask themselves, how did I find that: Use the Zombie mod and in the last mission, use station on the upper corner.)

True, although I still think ti would mean a vast improvement. because the AI would now genuinely be re-assessing every 2-5 seconds, it would only work if that ship was the only cruiser in your fleet. I think part of the current problem is the lure-tactic and the other is that a ship will continue heading towards the effectively randomly-chosen first ship it latches onto. if that ship is a tank, it will chase it forever, whereas with this system, it will swap to a more vulnerable ship of the same class quite quickly if one is available.
We really need to have a few people try it out to see if it’s better.

The problem with the system you describe is it requires some fairly accurate fine tuning of priorities by players, and is harder to explain than the more absolute rule-based ‘set priorities as you want them followed’ system I’m describing.

Oh boys now there are no way of countering lures on the host’s side… This is so exploitable on the challenger side it’s not even funny. Can’t we just have the 2 seconds check with the existing movement AI?

Or maybe I should just troll everyone with frigate spamming + cruiser lure. Because clearly every host would be forced to prioritize cruisers or risk getting troll hard by engine-less frigate in the corners.

FIFY. This is only a problem for anyone silly enough to leave the fighter tag on their cruisers/frigates. If the AI just move toward the closest frigate or cruisers and rechecks every 2 seconds, it would have been just fine.

Arrrgh, this is a good point. I wonder if the 2 second check should be in there, with the original system, but perhaps with some improvements regarding the calculations. Maybe all ranges less than a certain amount (200?) or regarded as the same, to prevent ships chasing after fighters because they got close enough to them, and maybe it should sue some kind of multiplier rather than adding the range as it currently does.
I definitely want to ensure the changes make the game better and in no way worse, but it can never be perfect.

Well in general, there are 2 kinds of lures.

  1. A lure pulling enemy fleets in, often use with rush to help get in range.
  2. A lure pulling enemy fleet to the side, useful for long range fleets for counter rushing.

The old AI was fairly good at staying at full range against all fleets as long as lures aren’t involved, and I think the 2 seconds check alone should significantly hinder lure effectiveness.

In most cases what you really want is to maintain set range against a fleet as a whole, regardless of rather they throw frigate or cruiser in front. Moving in more than you needed to fire almost always hurts more than helps. As of now Fighters would be ignored simply by removing the tag, and locking the AA ships in formation, so it’s not really a problem.

Another thing to consider is allowing formation and keep moving tag on the same ship, and simply give formation the priority. This will allow formation breaking tactics for keep moving fleets (basically you link all your ship in formation with a very weak ship in front, when it dies it releases the formation and keep moving kicks in, allowing effective counter lure and meaningful cruiser/frigate mix fleets).

The idea sounds good, but like already mentioned the ships could be lured to the back of a fleet.

So the reevaluating every 2 seconds seems like it would be a necessary change.

Since a major part of the remaining issue appears to be cruisers focusing upon fighters despite low priority on them, (If I have an AA weapon on my cruiser I’d at least like it to be used on them) could the priority formula for fighters be adjusted to compensate for the close combat nature of fighters? A reduction in just that could balance out the priority issue.

well that is what I was thinking about when I was suggesting regarding all ranges of below, maybe 400 as being the same, so that very close fighters dont ‘get lucky’ and pick-up or distract a cruiser/frigate if that cruiser/frigate has fighters as low priority. (I’ll assume for this case that the fighter priority still exists).

so assume a cruiser with
fighters priority 10%
frigates 40%
cruisers 100%

and when it evaluates there is a
cruiser at 1200
frigate at 600
fighter at 50

the fighter score is now 400 + (400 * 0.9) = 760
frigate is 600 + (600 *0.6) = 960
cruiser is 1200

so the fighter still gets pursued :frowning: Or we could just treble that secondary priority-based component, giving scores of…
fighter 1480
frigate 1680
cruiser 1200
And then the cruiser gets pursued, which seems reasonable.

I guess the real trick will be picking that multiplier (3) and the min range (400) as a good all-round case. You want ships the other side of the map to be relatively less important than local ones, but you want the priority settings to really influence decisions. Any suggestions on picking those values?

What if the range portion of the formula was replaced by another factor? DPS could be a good alternative. Just calculate the DPS it will do to the nearest ship of each class in the battle and modify by priority. This lets the player’s weapon choices influence the formula.

iv read this all and there’s one thing i didn’t notice (or was too stupid to understand)
if i remove the attack (ship) order will it ignore that type of ship, right? this isnt al;ways enough. I (and several other people as they have expressed on the forum) really do not enjoy when our ships unload all of their megaton missiles at the enemy fighter group

That behavior is totally different though, that’s weapon target selection, whereas the current issue is actual movement target selection.

Quick question - all weapons fire at any target in range if a priority target is not there (megaton missiles at a fighter) but the EMP cannon does not fire at fighters. Would their be a way of coding that into the weapons and just have certain weapons never fire at a fighter? This could keep fighter torpedoes from being blown early or the aforementioned megaton missile from being wasted on a fighter,

Grrrr long day and everyone calls in sick

Hmmmm. the ecm beam is a specifically coded weapon, hence that ability. It wouldn’t be that hard to do, but is it always desirable? some fighters are very slow…

Playing the Praetorian Industries mod highlighted another issue.

The leviathans (I think some of the dreadnoughts too) have a long set of explosions prior to their destruction. During this time the ships will continue targeting (but not shooting) the exploding ship, usually not moving in the process and doing very little in general during that timeframe.