Poll

How should the auto-targeting feature distinguish between hostiles and attackers?

Auto-targeting should always favor attackers over hostiles (current behavior)
Auto-targeting should just get the closest hostile, if there is one
Auto-targeting should use a heuristic to determine whether to target the closet attacker or closest target

Author Topic: Patch submission: "target my attacker" now cycles through all attackers [r8841]  (Read 15674 times)

0 Members and 1 Guest are viewing this topic.

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch submission: "target my attacker" now cycles through all attackers
:yes:

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
Re: Patch submission: "target my attacker" now cycles through all attackers
 :bump:

 

Offline Iss Mneur

  • 210
  • TODO:
Re: Patch submission: "target my attacker" now cycles through all attackers
Committed in revision: 8841

Mastatdon or a moderator: Please edit the post OP to contain [Committed 8841].
« Last Edit: May 31, 2012, 09:07:42 pm by Iss Mneur »
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch submission: "target my attacker" now cycles through all attackers
Eh, whatever happened to waiting until 3.6.14 was out? :p

 

Offline Iss Mneur

  • 210
  • TODO:
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Just wanted to do it before it I forgot about it.  :doubt:
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Oh, I certainly agree that we shouldn't forget about it... that's why I asked Mastadon to keep bumping it. :)  But don't worry, it's not a hard-and-fast rule.  We're not doing an official code freeze like we've done in the past.

 

Offline Iss Mneur

  • 210
  • TODO:
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
We're not doing an official code freeze like we've done in the past.
Yeah, no kidding.  At the pace we are going on this RC (I know, some of that is my fault, but look we just got wxLauncher 0.9.0 out yesterday :D), we will need to do another release right after just to get the bugs out of trunk before the pilot code goes in.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Perhaps.  I'm open to ways of increasing coder participation.

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
Re: Patch submission: "target my attacker" now cycles through all attackers
Committed in revision: 8841

Mastatdon or a moderator: Please edit the post OP to contain [Committed 8841].

Thank you for committing my patch Iss Mneur!

  

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Something with this patch has changed how Auto Target works. Auto Target used to select the nearest hostile, but now it always selects nearest hostile attacker. Which seems a bit odd given that for years I've been used to it selecting the next closest valid target for me to aim my weapons at.

I have a specific issue with this in that I've just played a mission where the nearest hostiles aren't targetting me, but the hostiles that are targetting me are still 10k out and are completely irrelevant to my current goals.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
While I haven't had a chance just yet to do a more thorough code review of my modifications, I suspect that the cause of the trouble is that the hud_target_closest() function now filters out any object not attacking the player if we're looking for someone attacking a specific object, such as the player. If that is true, then one solution to the problem would be to add a default parameter to the hud_target_closest method that specifies a maximum distance to consider a target a threat. Another option would be to automatically filter out attackers that are beyond a certain distance. :v: originally wrote some commented out code that does just that by default for non-players, but the MIN_DISTANCE_TO_CONSIDER_THREAT macro they use is only set to 1500, which is just too short to be effective in FS2 with weapons such as the Prometheus S, Maxim, Tornado, and Trebuchet.


BTW, I like the new title someone bestowed upon me!  :cool:


 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Glad to hear it. :D

 

Offline Sushi

  • Art Critic
  • 211
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
I thought the problem was that the auto-target was emulating "target closest hostile" (i.e. target my attacker) instead of "target closest enemy." Seems like it should be straightforward to just make the auto-target call whatever code the latter uses.

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
I thought the problem was that the auto-target was emulating "target closest hostile" (i.e. target my attacker) instead of "target closest enemy." Seems like it should be straightforward to just make the auto-target call whatever code the latter uses.

Well, not quite. The problem is that the target closest attacker code now actually finds targets that are attacking you and the auto-targeting code first searches for and attempts to target any ship that is both attacking you and is targetable:

Code: [Select]
// ...
int valid_team_mask = iff_get_attackee_mask(Player_ship->team);

// try target closest ship attacking player
if ( Player_ai->target_objnum == -1 ) {
hud_target_closest(valid_team_mask, OBJ_INDEX(Player_obj), FALSE, TRUE );
}

// if none, try targeting closest hostile fighter/bomber
if ( Player_ai->target_objnum == -1 ) { //-V581
hud_target_closest(valid_team_mask, -1, FALSE, TRUE);
}

// No fighter/bombers exists, so go ahead an target the closest hostile
if ( Player_ai->target_objnum == -1 ) { //-V581
hud_target_closest(valid_team_mask, -1, FALSE);
}

// um, ok.  Try targeting asteroids that are on a collision course for an escort ship
if ( Player_ai->target_objnum == -1 ) { //-V581
asteroid_target_closest_danger();
}

In a nutshell, what will need to happen is that hud_target_closest() will need to be rewritten so that it either (1) limits targetting to objects within a certain distance or (2) returns the distance from the newly targetted object. If option 2 is taken, the call to hud_target_closest for ships attacking the player would need to be rewritten such that it doesn't make a targetting sound. That being said, I still think that option 1 would be the ideal way to go, as adding a default parameter to hud_target_closest has the lowest probability of causing additional UFOs  (Unintentional Feature Offering) in the code.

 

Offline Sushi

  • Art Critic
  • 211
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
The problem with a distance is that it is completely arbitrary. IMHO we should just have autotarget pick the closest enemy. That's basically what it did before (it may have tried to find the closest ship attacking the player, but since that code wasn't working correctly anyway, that doesn't have much of an effect).

So my suggestion is to just delete this whole if statement.

Code: [Select]
// try target closest ship attacking player
if ( Player_ai->target_objnum == -1 ) {
hud_target_closest(valid_team_mask, OBJ_INDEX(Player_obj), FALSE, TRUE );
}

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Yes, that's my thoughts exactly. A distance check is, as you said, totally arbitrary.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
I guess the big question is: when an event where auto-targeting kicks in (for example, your target is destroyed or warps out), would you rather (1) get the next target attacking you if they aren't too much farther away from you than the absolute closest target or (2) just get the next closet bad guy? I'll open up a poll so we can get some more concrete numbers to make a decision on.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
Well, retail was always just the next closest hostile target.. so that's what it needs to be. If anything you could create a game_settings.tbl flag and let mods choose between the two with the default being retail behavior.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Patch submission: "target my attacker" now cycles through all attackers [r8841]
I don't think in cases like this it needs to stay exactly the same as retail. We are allowed to improve gameplay, what we can't do is rebalance it.

I definitely don't think we need a table setting for this. Pick whichever one works best and go with that. That said, I'm leaning towards next closest not because it's retail behaviour but because I feel the behaviour of the "Auto-target hostile" and "Target hostile" should match.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]