View Issue Details

IDProjectCategoryView StatusLast Update
0001496FSSCPFREDpublic2012-12-10 03:35
ReporterRansom Arceihn Assigned ToAdmiral MS  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.9 
Summary0001496: Ships stopping mid-waypoint
DescriptionSo, there's two fighters in the same wing. One of them's going to a waypoint, the other's guarding the first. Then they both get clear-goals and an order - the first one is told to play-dead (or stay-still) and the second gets a waypoint-once order.

But BOTH ships stop. If you shoot the second fighter, only then will it get moving toward the waypoint.
Additional InformationHappens in every build I've tried in the stable branch up to the 15th of August. I've tried a dozen variations on the situation, but it seems that whenever the first ship stops the second one invariably does the same until it's shot.
TagsNo tags attached.

Activities

2007-09-08 16:18

 

waypoints.fs2 (7,352 bytes)

karajorma

2007-09-08 20:11

administrator   ~0008512

Happens in retail too. Ships in a wing follow the orders of the first ship in the wing. Always have done. I'd love to see this fixed but I'd imagine it would break a huge number of missions unless it was applied carefully.

Ransom Arceihn

2007-09-08 20:32

reporter   ~0008513

Oh.

Well, all right then. But it only seems to affect things when the order means stopping - two separate waypoint orders doesn't result in the second fighter going to the first one's waypoint, for instance.

And it seems strange that getting shot fixes it.

taylor

2008-03-21 22:48

administrator   ~0009000

* BUMP *

So, is this not something that we can fix, or is it really a new bug?

karajorma

2008-03-21 22:55

administrator   ~0009005

To be honest it's something I'd really like to see fixed as it's pretty silly that just cause a ship is in a wing you can't give it new orders.

The problem is whether it would break missions. In general it shouldn't. If the mission designer wanted a wing to do something they usually would have told them to do it rather than give the lead ship new orders. But if someone made that mistake they wouldn't have spotted it during playtesting.

I'm tempted to say that we should fix it and see what it breaks.

taylor

2008-07-17 16:36

administrator   ~0009472

Not going to work on this.

karajorma

2009-02-02 20:40

administrator   ~0010641

I'll wait till 3.6.10 comes out and then see if changing this breaks anything.

The_E

2012-12-07 14:53

administrator   ~0014346

Changing the status here to make it more visible

Admiral MS

2012-12-08 15:46

developer   ~0014357

Last edited: 2012-12-08 16:12

So I found the reason why this happens and I can fix it but the question is: What's the right behaviour in this case?
I see the following options:
- Ship should follow its own waypoint path unless the wingleader has the same waypoint path and order
- Ship should follow its own waypoint path unless the wingleader has any waypoint order
As usual with ai changes this may or may not break old missions.
Currently in case the formation waypoint flying starts, the target path of all ships in the wing will get overridden with the path of the wing leader.

Additionally there is the option to drop the formation flag in this case to prevent it from running through all the checks in ai_formation() every frame. When shooting at the fighter that flag gets removed and when given a new waypoint order it gets added anyway.

Edit: Uploaded patch that fixes behaviour for the case presented in the test mission (second option)

Admiral MS

2012-12-08 16:13

developer  

waypointflying.patch (454 bytes)   
Index: code/ai/aicode.cpp
===================================================================
--- code/ai/aicode.cpp	(revision 9405)
+++ code/ai/aicode.cpp	(working copy)
@@ -11464,6 +11464,12 @@
 	}
 	
 	if (aip->mode == AIM_WAYPOINTS) {
+
+		// skip if wing leader has no waypoint order
+		if(laip->mode != AIM_WAYPOINTS){
+			return 1;
+		}
+
 		aip->wp_list = laip->wp_list;
 		aip->wp_index = laip->wp_index;
 		aip->wp_flags = laip->wp_flags;
waypointflying.patch (454 bytes)   

Admiral MS

2012-12-08 21:24

developer   ~0014361

As suggested the fix now comes with an ai_profiles.tbl setting named
$fix ai path order bug: YES / NO

Behaviour with YES is:
Ship should follow its own waypoint path unless the wingleader has the same waypoint path and order

Uploaded it as waypointflying_v2.patch

Admiral MS

2012-12-08 21:25

developer  

waypointflying_v2.patch (1,503 bytes)   
Index: code/ai/ai_profiles.cpp
===================================================================
--- code/ai/ai_profiles.cpp	(revision 9408)
+++ code/ai/ai_profiles.cpp	(working copy)
@@ -465,6 +465,8 @@
 
 			set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
 
+			set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
+
 			// ----------
 
 			// compatibility
Index: code/ai/ai_profiles.h
===================================================================
--- code/ai/ai_profiles.h	(revision 9408)
+++ code/ai/ai_profiles.h	(working copy)
@@ -64,6 +64,7 @@
 #define AIPF2_NO_WARP_CAMERA										(1 << 10)
 #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)
 
 // AI Path types
 #define	AI_PATH_MODE_NORMAL 0
Index: code/ai/aicode.cpp
===================================================================
--- code/ai/aicode.cpp	(revision 9408)
+++ code/ai/aicode.cpp	(working copy)
@@ -11464,6 +11464,14 @@
 	}
 	
 	if (aip->mode == AIM_WAYPOINTS) {
+
+		if (The_mission.ai_profile->flags2 & AIPF2_FIX_AI_PATH_ORDER_BUG){
+			// skip if wing leader has no waypoint order or a different waypoint list
+			if ((laip->mode != AIM_WAYPOINTS) || !(aip->wp_list == laip->wp_list)){
+				return 1;
+			}
+		}
+
 		aip->wp_list = laip->wp_list;
 		aip->wp_index = laip->wp_index;
 		aip->wp_flags = laip->wp_flags;
waypointflying_v2.patch (1,503 bytes)   

Zacam

2012-12-09 03:15

administrator   ~0014371

Fix committed to trunk@9412.

Related Changesets

fs2open: trunk r9412

2012-12-08 22:45

Zacam


Ported: N/A

Details Diff
Fix for Mantis 1496: Ships stopping mid-waypoint; From Admiral MS Affected Issues
0001496
mod - /trunk/fs2_open/code/ai/ai_profiles.cpp Diff File
mod - /trunk/fs2_open/code/ai/ai_profiles.h Diff File
mod - /trunk/fs2_open/code/ai/aicode.cpp Diff File

Issue History

Date Modified Username Field Change
2007-09-08 16:18 Ransom Arceihn New Issue
2007-09-08 16:18 Ransom Arceihn File Added: waypoints.fs2
2007-09-08 20:11 karajorma Note Added: 0008512
2007-09-08 20:32 Ransom Arceihn Note Added: 0008513
2008-03-21 22:48 taylor Note Added: 0009000
2008-03-21 22:55 karajorma Note Added: 0009005
2008-04-05 00:31 taylor Status new => assigned
2008-04-05 00:31 taylor Assigned To => taylor
2008-07-17 16:36 taylor Note Added: 0009472
2008-07-17 16:36 taylor Assigned To taylor =>
2008-07-17 16:36 taylor Status assigned => new
2009-02-02 20:39 karajorma Status new => assigned
2009-02-02 20:39 karajorma Assigned To => karajorma
2009-02-02 20:40 karajorma Note Added: 0010641
2012-10-28 13:47 karajorma Assigned To karajorma =>
2012-12-07 14:53 The_E Note Added: 0014346
2012-12-07 14:53 The_E Status assigned => acknowledged
2012-12-08 15:46 Admiral MS Note Added: 0014357
2012-12-08 16:12 Admiral MS Note Edited: 0014357
2012-12-08 16:13 Admiral MS File Added: waypointflying.patch
2012-12-08 21:24 Admiral MS Note Added: 0014361
2012-12-08 21:25 Admiral MS File Added: waypointflying_v2.patch
2012-12-08 23:57 Zacam Assigned To => Zacam
2012-12-08 23:57 Zacam Status acknowledged => code review
2012-12-09 03:15 Zacam Changeset attached => fs2open trunk r9412
2012-12-09 03:15 Zacam Note Added: 0014371
2012-12-09 03:15 Zacam Status code review => resolved
2012-12-09 03:15 Zacam Resolution open => fixed
2012-12-10 03:35 Goober5000 Assigned To Zacam => Admiral MS