Closed DamienThryn closed 5 years ago
Are the escorted ships unarmed?
I'm pretty sure that they are armed. And they do get targeted by new pirates entering the system, so the issue seems to be specifically with the pirates that spawn when you accept the mission.
This behavior occurs because those mission-specific fleets spawn with the nemesis
personality. They solely engage the player's ships. The code that governs this is AI::FindTarget, specifically blocks near L#746
bool isPotentialNemesis = (person.IsNemesis() && it->GetGovernment()->IsPlayer());
if((isPotentialNemesis && !hasNemesis) || range < closest)
{
closest = range;
target = it;
isDisabled = it->IsDisabled();
hasNemesis = isPotentialNemesis;
}
and L#699
// If this is a "nemesis" ship and it has found one of the player's
// ships to target, it will not go after anything else.
if(hasNemesis && !it->GetGovernment()->IsPlayer())
continue;
Here we see that nemesis requires the ship in question to belong to a fleet having the government of the player, and once a nemesis ship finds a nemesis, it ignores everything else.
Escort mission npcs have government Merchant
and only appear in the player's list of escorts because they are given the personality trait escort
, so they never can trigger the nemesis behavior.
Generic pirate fleets do not have this restriction, which is why they will attack the escorted merchants.
In short: Escort mission pirates will never target the ships you are escorting, because personality escort
doesn't meet the criteria of "player's ships" in the current code implementation. I would agree that this is at minimum unexpected behavior on behalf of the mission-writer, and requires either updating how nemesis
works (to include player government and personality escort
), or how the mission antagonists are defined.
I'd never noticed escort pirates spawn with the nemesis personality. As I mentioned to @DamienThryn elsewhere, I don't think I ever actually stay in the same system as an escort I'm escorting. You know... that whole subject...
But is there any good reason for those pirates to be marked as nemeses of the player?
loosely relevant: https://github.com/endless-sky/endless-sky/issues/1731
The one thing I like about a default 'Nemesis' setting is that it avoids my losing an escort 2 seconds after takeoff because a hostile fleet happened to spawn in close orbit, then decide some poor freighter needs to die.
Code-wise, I wonder how difficult it would be to implement some kind of AI re-targeting mechanic, a periodic update (chance-of-update?) that could change the 'nemesis' personality.
Or, when pirate fleets spawn, how hard would it be to have one or two members be set to specialize in disabling (eventually, boarding, once that is implemented) whatever ship is carrying the highest-value cargo? So the player would need to make sure those types of pirates were disabled asap - if they aren't just bailing out of the system entirely (separate discussion).
Pirates will already board and plunder... But they do not do this if there are hostile targets "in range". You can observe this behavior by cloaking in the mining systems near Orbona.
Right now nemesis means they will latch on until someone wins - nothing matters so much as fighting their current nemesis - so they do not retarget unless you become untargetable.Non nemesis ships will retarget as needed already. If you own a few extra ships, it is entirely possible the nemesis plates see one of them first and thus gets tunnel vision only for that player-owned escort.
@tehhowch, do you know, is an NPC with the escort characteristic (like the freighters in these missions) considered your team for nemesis purpose? I take it not, esp. based on Damien's first sentence in his last post.
Let's say they they did count as your team, but at double the effective range (or more likely +1000 or +2000). Then when you first take off, nemesis pirates would prefer you and your fleet – you appear 'closer' – but if you move further away, they'll prefer the freighters.
(Just to add for anyone that doesn't know, this 'double the effective range' isn't a gimmicky workaround, it's how AI targeting decisions work already.)
The targeting decision for nemesis calls GetGovernment, which for the freighters will return Merchant and not the players government
Might be worth a try then. For me, though, the bigger problem with escort missions is that they're safe out-of-system.
@DamienThryn, do/can you compile from source? At some point (not immediately), I could try setting up a feature branch on my fork that might solve your issue. If you could compile it, you could have a play and see if it seems like better behaviour.
@Elyssaen I'm still learning the architecture, but I should be able to figure it out.
Totally agree this is a lesser issue than being able to just ditch the escorts (I usually do that too), though 'nemesis' behavior on the whole seems vulnerable to exploits.
It could be a pretty simple patch to check the parent of the target, for nemesis personality targeting, as the parent of an escort (hostile, friendly, or player-owned) is the player.
I'm not sure how far down this cascades (e.g. if you are escorting carrier ships, who is the parent of the carried fighter), but it seems like a simple enough way to tweak nemesis targeting.
I can provide a branch to play test in a bit (for those who can play from source..)
Even better than parent-checking, is a check to the target's personality, which has the IsEscort() method.
@DamienThryn let us know if this seems better now that #2653 has merged, and we can get this moved to the 0.9.7 (done)
milestone.
No complaints from me, thanks!
Issue with pirate targeting behavior on Job Board 'Escort' Missions
Pirate ships that spawn when player takes on an escort mission from the job board appear to only target the player's ship (0.9.6)
This makes it easy to 'game' escort missions by taking on as many as are available, then on takeoff flying out to the edge of the 'fence'. Pirates will ignore the escorts to go after the player, who can either engage, lure them past/over any Navy ships in the system, or jump away.
Mostly apparent in regions (like the Paradise Planets) where pirates spawn mostly as a result of the player accepting an escort mission (subsequent pirates jumping into the system DO go after escorted ships).
Impact: A player in a fast enough ship can rapidly rack up credits from running escort missions without much danger to self or escorts. Sooner or later those freighter captains are going to stop paying 150,000 credits for a decoy they share with 3 other ships :). Couple this with the high probability of getting multiple escort missions offered at each planet between Alphara and Betelguese, and a player can earn a lot of credits very quickly.
Possible solutions:
Here's a screenshot to illustrate - note the hostile ships all clustered together chasing my Rogue Dreadnought, while 4 escorts hang out unaccosted over by Prime (minor shield damage resulted from initial crossfire before I flew away). I believe @Elyssaen was able to replicate the same behavior.