Source Code Project Mantis - FSSCP
View Issue Details
0001520FSSCPgameplaypublic2007-11-14 13:562010-07-07 12:03
Assigned Totaylor 
PlatformDELL Dimension 9200OSWindows VistaOS VersionUltimate 32-bit
Product Version 
Target VersionFixed in Version3.6.10 
Summary0001520: Autopilot leads you to a random place if you are not Alpha 1
DescriptionAutopilot doesn't lead you to selected NAV but to a completely random direction.

This happens if you are not Alpha 1, even if you are Alpha wing leader.

With cinematic autopilot this bug doesn't happen. It just happens with old autopilot code.
Steps To Reproduce+ Download the attached mission (Offset Autopilot.fs2). It just contains you (Alpha 2) and another Ulysses (Alpha 1) and an autopilot nav point.

+ Alt-N > Alt-A. Look how funny it is your jump.
Additional InformationFRED2 doesn't complain about mission errors.

If you enable Use Autopilot Cinematics, the bug is gone.

If you swap the fighters, so you fly Alpha 1 instead of Alpha 2, the bug is gone.

The funniest thing. I've used this build, (grab it here:,50258.0.html), with WCSaga demo instead its original wcsaga.exe. Through all this mod, you are Alpha 2 and you aren't the wing leader. And through all this mod your autopilot jumps are fine. WTH??????
TagsNo tags attached.
related to 0001888resolved iss_mneur autopilot cinematics broken in recent 3.6.10 builds, renders certain missions unplayable 
Attached Files? Offset Autopilot.fs2 (3,015) 2007-11-14 13:56
? Offset Autopilot Notepad.fs2 (3,029) 2007-11-14 16:14
jpg Alpha2 is wing leader.jpg (193,775) 2007-11-16 15:05

2007-11-14 14:46   
Usually it is related to wing leader/order of ships in a wing. To avoid this, simply open our old autopilot template in notepad, rename alpha 2 to alpha 5, alpha 1 to alpha 2 and alpha 5 to alpha 1. Done! :)
2007-11-14 16:18   
Hey what a funny and stupid bug... :D

As Tolwyn said:
+ I've just opened the mission in notepad.
+ I've moved Alpha 2 definition lines before Alpha 1 ones.
+ Then, it works.

(I upload the "fixed" mission: "Offset Autopilot Notepad.fs2")

Clearly, this shouldn't happen at all...
2007-11-14 18:04   
The waypoint navigation code just blindly assumes that the player is the leader of any formation. The spacing calculations it then uses can be based on the incorrect ship, which leads to the wing leader (if non-player) having trouble figuring out where to go.

This can be fixed quite easily by just detecting if a ship is part of a wing, not running the spacing calculation on the wing leader (regardless of player or not), and basing the spacing math on the wing leader.

That works fine in theory at least, and in a quick test, but I'll have to play with it a bit more to make sure nothing else gets broken. This is all autopilot specific though, so that greatly narrows down what needs to be tested. :)
2007-11-15 06:42   
(Last edited: 2007-11-15 06:43)
Well, it's more or less fixed.

I mean with the new build (1114) and the conflictive mission, Alpha 1, but not you, (Alpha 2), leads the run till the nav point. Remember that, in this mission, Alpha wing leader is you, Alpha 2, not Alpha 1.

At least, the jump isn't random any more.

So it seems that the autopilot run is lead by the very first ship which is declared in the fs2 file. It doesn't matter if that ship is a wing leader or not.

The "Notepad-fixed" mission works like always.

2007-11-15 07:26   
Wait, Alpha 2 is the wing leader? I must have misunderstood then. It's an easy correction, I set it to just consider the first ship in the wing as the leader (rather stupidly I might add ;)).

Unfortunately that will just recreate the original problem, so I'll have to dig a little deeper to figure out what's going on.
2007-11-15 07:52   
Ok, think I got it now. I need to tweak a few things first, but I believe it will work fine after that.
2007-11-16 06:27   
Ooops, just tested with Xt1115 and it's still more or less fixed ;) ...

+ "Offset Autopilot.fs2" works fine.

+ "Offset Autopilot Notepad.fs2" works like "Offset Autopilot.fs2" before. I mean in this edited mission Alpha 1 leads the run and you follow it.

Remember that the only difference between both files is the ship definition order. I've manually moved all Alpha 2 ship definition lines before Alpha 1.

So autopilot behaviour still depends on fs2 line order rather than in its definitions.

2007-11-16 13:58   
No, actually that's because of your changes to that mission. I changed both the autopilot handling and the wing formation AI to work properly with a wing leader that isn't the first ship in the wing. So now it will properly deal with which ever ship you specify as the leader.

In "Offset Autopilot" you have Alpha 2 as the second ship in the wing, and specify it as the wing leader. In "Offset Autopilot Notepad" you have Alpha 2 as the first ship in the wing, but specify Alpha 1 as the wing leader. So, the code is doing exactly what it's supposed to do. In other words, you can't outsmart it any longer. :)
2007-11-16 15:10   
(Last edited: 2007-11-16 15:11)
???? As I'm a bit foolish lately, I've re-downloaded "Notepad" mission, I've retested it in game and I've also opened it in FRED.

And there's something wrong here.

Take a look at the screenshot from FRED ("Alpha2 is wing leader.jpg"). FRED says that Alpha wing leader is still Alpha 2, not Alpha 1 as you say. But, as I've said before, Alpha 1 leads the autopilot run.

2007-11-16 16:02   
(Last edited: 2007-11-16 16:25)
Yeah, I'm stupid. I actually managed to screw up twice, only one being a code bug. The code should be fixed now though. :hangsheadinshame:

EDIT: Just the clarify the problem, since it might be an issue for others in the future...

The order of ships listed in a wing needs to match the order of the objects specified in the mission. The wing says that you have Alpha 1, then Alpha 2, with Alpha 2 (the second of the two ships) being the leader. But the object order says that you have Alpha 2, then Alpha 1, with Alpha 1 (the second of the two ships) being the leader. When the mission is parsed it is using the ships listed in the wing list, but not the /order/ in which they are listed. The "special ship" on the other hand, uses the object order, but FRED shows it in wing order. In other words, it's all completely crazy, partially because no one bothered to properly fix the wing leader handling in the first place.

The fix I'm doing is just to sanitize the order of ships in a wing, so that both FRED and people who hand-edit missions know what is what. This will be an automatic change through mission parse. FRED will be better at this however, as those who hand-edit and don't really realize what they are doing could get unexpected, but not incorrect, results.

2008-03-20 18:42   
2008-04-02 17:12   
I've just tested with SVN trunk 2008-04-01 from Taylor's testing builds and I'm not sure if this is fixed. "Offset Autopilot.fs2" and "Offset Autopilot Notepad.fs2" still behave completely different and I think they shouldn't:

+ Remember that player is flying in Alpha 2 which also is the wing leader.

+ "Offset Autopilot.fs2":
- Alpha 1 is before Alpha 2 in the fs2 file.
- Alpha 1 leads the autopilot run. (I mean Alpha 1 actually travels towards the selected NAV, and you fly in formation with it. So you don't exactly aim towards the NAV point).
- At the autopilot run start, your ship seems to move crazy but it stabilizes and follows Alpha 1.

+ "Offset Autopilot Notepad.fs2":
- I just moved Alpha 2 definition lines before Alpha 1 using Notepad. Both missions look identical within FRED.
- Then you, (Alpha 2) lead the autopilot run, you exactly aim the NAV point. Alpha 1 follows you.
2008-04-02 19:41   
What got committed to SVN is different from what you tested in the Xt builds previously. The code in the Xt build always made the special ship be considered the wing leader so when using autopilot and stuff that should would always be leader. Goober said that was actually wrong though, since the special ship is only supposed to indicate the player, not the leader of a wing.

So, I changed the code to fix the other bugs, but not handle the wing leader any differently. That means the behavior your are seeing is what it's coded to do. The wing leader will be the first object specified for that wing, which means that in the first case (with Alpha 1 listed first) Alpha 1 would be the leader, but in the second case (with Alpha 2 listed first) Alpha 2 would be the leader.

While still a bug, it's a different bug and not directly related to this one. It just goes back to the object order vs. wing order. I have a fix for that in the works though, just needs a bit more testing. I'm going to release a new build tonight with that change so you can go ahead and check it out then. If it doesn't work then file a new bug about it, like "Object order overrides order specified by wing list", or something of that sort.
2008-04-03 03:43   
Code to sort the wing/object list properly has now hit SVN.
2009-03-03 05:00   
This issue seems not being fully fixed.

Check 0001888.
2010-07-07 12:03   
The cause of 1888 is unrelated to this bug, except for they both occur in the autopilot code.

Setting this bug back to resolved/fixed.

Issue History
2007-11-14 13:56ARSPRNew Issue
2007-11-14 13:56ARSPRFile Added: Offset Autopilot.fs2
2007-11-14 14:46TolwynNote Added: 0008636
2007-11-14 16:14ARSPRFile Added: Offset Autopilot Notepad.fs2
2007-11-14 16:18ARSPRNote Added: 0008637
2007-11-14 18:04taylorNote Added: 0008638
2007-11-14 21:53taylorStatusnew => assigned
2007-11-14 21:53taylorAssigned To => taylor
2007-11-15 06:42ARSPRNote Added: 0008640
2007-11-15 06:43ARSPRNote Edited: 0008640
2007-11-15 07:26taylorNote Added: 0008641
2007-11-15 07:52taylorNote Added: 0008642
2007-11-16 06:27ARSPRNote Added: 0008650
2007-11-16 06:27ARSPRNote Edited: 0008650
2007-11-16 13:58taylorNote Added: 0008652
2007-11-16 15:05ARSPRFile Added: Alpha2 is wing leader.jpg
2007-11-16 15:10ARSPRNote Added: 0008653
2007-11-16 15:11ARSPRNote Edited: 0008653
2007-11-16 16:02taylorNote Added: 0008654
2007-11-16 16:25taylorNote Edited: 0008654
2008-03-20 18:42taylorStatusassigned => resolved
2008-03-20 18:42taylorFixed in Version => 3.6.10
2008-03-20 18:42taylorResolutionopen => fixed
2008-03-20 18:42taylorNote Added: 0008989
2008-04-02 17:12ARSPRStatusresolved => feedback
2008-04-02 17:12ARSPRResolutionfixed => reopened
2008-04-02 17:12ARSPRNote Added: 0009148
2008-04-02 19:41taylorNote Added: 0009152
2008-04-03 03:43taylorNote Added: 0009161
2008-04-03 03:43taylorStatusfeedback => resolved
2008-04-03 03:43taylorResolutionreopened => fixed
2009-03-03 05:00ARSPRStatusresolved => feedback
2009-03-03 05:00ARSPRResolutionfixed => reopened
2009-03-03 05:00ARSPRNote Added: 0010706
2009-03-05 11:16taylorAssigned Totaylor =>
2009-03-06 15:07chief1983Relationship addedrelated to 0001888
2010-07-07 12:03iss_mneurNote Added: 0012198
2010-07-07 12:03iss_mneurAssigned To => taylor
2010-07-07 12:03iss_mneurStatusfeedback => resolved
2010-07-07 12:03iss_mneurResolutionreopened => fixed