View Issue Details

IDProjectCategoryView StatusLast Update
0003114FSSCPgameplaypublic2014-11-21 08:40
Reporterniffiwan Assigned Toniffiwan  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64OSLinux MintOS Version17
Product Version3.7.2 RC4 
Target Version3.7.2 
Summary0003114: the behaviour of turret-tagged-only has changed from retail
DescriptionFrom this thread: http://www.hard-light.net/forums/index.php?topic=87167

The retail behavior of a turret-tagged-only ship is to fire its weapons only at bombs and tagged ships. This involves all non-cluster-bomb weapons, not just beams.

AND

In retail, cluster bombs fire regardless of whether turret-tagged-only is set, unlike the other weapons.


The current SCP behaviour is that a turret-tagged-only ship will only fire on tagged ships. The new behavior should be enabled with a flag so that mods can select if if they want it (and existing missions relying on the new behaviour won't be broken). The default behaviour needs to return to that of retail due to rule number 1.
Steps To ReproducePlay "A Game of TAG". Note the behavior of the Warspite and Lucidity (IIRC that's the name of the AWACS present in that mission).

I'll attach a hacked up / shorter test mission when I'm at my main PC.
Additional InformationCurrent code branch with partial fixes is: https://github.com/niffiwan/fs2open.github.com/commits/tagged-issue

Note that the overall balance impact seems fairly slight given that the change went undetected for so long (i.e. r1899; May 2005)
TagsNo tags attached.

Activities

niffiwan

2014-11-02 11:01

developer  

SM2-02a.fs2 (45,235 bytes)

niffiwan

2014-11-02 11:02

developer  

tagged-aip.tbm (184 bytes)

niffiwan

2014-11-02 11:06

developer  

mantis3114-svn.patch (2,999 bytes)   
Index: code/ai/ai_profiles.cpp
===================================================================
--- code/ai/ai_profiles.cpp	(revision 11169)
+++ code/ai/ai_profiles.cpp	(working copy)
@@ -463,6 +463,8 @@
 
 			set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
 
+			set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
+
 			// ----------
 
 			// compatibility
Index: code/ai/ai_profiles.h
===================================================================
--- code/ai/ai_profiles.h	(revision 11169)
+++ code/ai/ai_profiles.h	(working copy)
@@ -65,6 +65,7 @@
 #define AIPF2_ASPECT_LOCK_COUNTERMEASURE							(1 << 11)
 #define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING						(1 << 12)
 #define AIPF2_FIX_AI_PATH_ORDER_BUG									(1 << 13)
+#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING					(1 << 14)
 
 // AI Path types
 #define	AI_PATH_MODE_NORMAL 0
Index: code/ai/aiturret.cpp
===================================================================
--- code/ai/aiturret.cpp	(revision 11169)
+++ code/ai/aiturret.cpp	(working copy)
@@ -646,9 +646,15 @@
 			}
 		}
 
-		// check if	turret flagged to only target tagged ships
+		// check if turret flagged to only target tagged ships
+		// Note: retail behaviour was turrets with tagged-only could still fire at
+		// bombs, and could fire their spawn weapons
+		// this check is almost redundant; see the almost identical check in ai_fire_from_turret
+		// however if this is removed turrets still track any targets but don't fire at them
 		if (eeo->eeo_flags & EEOF_TAGGED_ONLY) {
-			if (!ship_is_tagged(objp)) {
+			if (!ship_is_tagged(objp) &&
+					( (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING) ||
+					( !(objp->type == OBJ_WEAPON) && !(turret_weapon_has_flags(&eeo->turret_subsys->weapons, WIF_SPAWN))) )) {
 				return;
 			}
 		}
@@ -2277,6 +2283,8 @@
 					}
 				}
 
+				bool tagged_only = ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags & SW_FLAG_TAGGED_ONLY));
+
 				if (lep->type == OBJ_SHIP) {
 					// Check if we're targeting a protected ship
 					if (lep->flags & OF_PROTECTED) {
@@ -2309,14 +2317,16 @@
 						ss->turret_time_enemy_in_range = 0.0f;
 						continue;
 					}
+					// Check if weapon or turret is set to tagged-only
+					// must check here in case turret has multiple weapons and not all are tagged-only
+					else if (!ship_is_tagged(lep) && tagged_only) {
+						continue;
+					}
 				}
 				else
 				{
-					//can't tag anything else, other than asteroids
-					//but we don't want to waste this type of
-					//weaponary on asteroids now do we?
-					if ((wip->wi_flags2 & WIF2_TAGGED_ONLY) || (ss->weapons.flags & SW_FLAG_TAGGED_ONLY))
-					{
+					// check tagged-only for non-ship targets
+					if (tagged_only && (!(lep->type == OBJ_WEAPON) || (The_mission.ai_profile->flags2 & AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING))) {
 						continue;
 					}
 				}
mantis3114-svn.patch (2,999 bytes)   

niffiwan

2014-11-02 11:13

developer   ~0016373

Last edited: 2014-11-21 01:22

I believe I have a patch that returns turret-tagged-only behaviour to retail, including an AI Profiles flag to retain the current "strict" (and arguably more correct) behaviour.

Could someone please give this a test and confirm that it behaves as expected? I've attached my test mission and an AI-profiles TBM. Just edit to mission file to set the desired AI Profile to test with.

Code is also available here: https://github.com/niffiwan/fs2open.github.com/compare/tagged-issue

Lastly, an in interesting note; the retail behaviour actually makes this mission quite a bit easier. When the Warspite fire on the bombs it incidentally hits the bombers. This tends to "sucker" all the bombers into attacking itself rather than the far weaker Lucidity.

niffiwan

2014-11-21 08:40

developer   ~0016386

Fix committed to trunk@11177.

Related Changesets

fs2open: trunk r11177

2014-11-21 04:26

niffiwan


Ported: N/A

Details Diff
Fix mantis 3114

Change turret-tagged-only behaviour back to retail
Add AI profiles flag to allow use of newer behaviour (i.e. stricter)
Affected Issues
0003114
mod - /trunk/fs2_open/code/ai/aiturret.cpp Diff File
mod - /trunk/fs2_open/code/ai/ai_profiles.h Diff File
mod - /trunk/fs2_open/code/ai/ai_profiles.cpp Diff File

Issue History

Date Modified Username Field Change
2014-10-01 02:01 niffiwan New Issue
2014-10-01 02:01 niffiwan Status new => assigned
2014-10-01 02:01 niffiwan Assigned To => niffiwan
2014-10-01 02:02 niffiwan Summary the behaviour of turret-tagged-only has changed since retail => the behaviour of turret-tagged-only has changed from retail
2014-10-07 02:10 Goober5000 Target Version => 3.7.2
2014-11-02 11:01 niffiwan File Added: SM2-02a.fs2
2014-11-02 11:02 niffiwan File Added: tagged-aip.tbm
2014-11-02 11:06 niffiwan File Added: mantis3114-svn.patch
2014-11-02 11:13 niffiwan Note Added: 0016373
2014-11-02 11:13 niffiwan Status assigned => code review
2014-11-21 01:22 niffiwan Note Edited: 0016373
2014-11-21 08:40 niffiwan Changeset attached => fs2open trunk r11177
2014-11-21 08:40 niffiwan Note Added: 0016386
2014-11-21 08:40 niffiwan Status code review => resolved
2014-11-21 08:40 niffiwan Resolution open => fixed