2018-12-10 22:17 EST


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0000945FSSCPdockingpublic2012-07-01 01:59
ReporterThe Trivial Psychic 
Assigned ToGoober5000 
PriorityurgentSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformAMD-2600+ 1GB DDR400 ATI9600XTOSWinXP in OGLOS VersionSP2
Product Version 
Target Version3.6.14Fixed in Version3.6.14 
Summary0000945: Non-Leader Docked Craft Attempt Maneuvers
DescriptionIf you dock one or more fighter craft to a larger ship, regardless of the fact that the larger ship is the dock leader, the smaller craft will still attempt to loiter, or engage nearby hostiles, causing the larger craft to spin about. If there are more than one small fighter docked to the large craft, it will also cause a degree of jerkiness to the spinning, since there are multiple fighters trying to maneuver the ship. The only way to avoid this is to give every ship except the dock leader, orders to play dead. If a wing is docked in this manner, the individual fighters in the wing must be given such an order, rather than the wing as a whole.

Unfortunately, this behaviour has been somewhat present since Retail, and I'm certain that one or more campaigns have taken advantage of it for comedic effect. Therefore, the best way I can see to preserve backwards compatibility would be to add a checkbox either in the docking controls or in the ship flags, that causes the ship to be inactive while docked, which includes engines and weapons primarily, though perhaps not turrets. Not sure if this should be engaged by default for any new missions created with a such-enabled FRED, so that when a designer docks 2 or more objects together, any object not deemed as the dock leader, automatically has this checkbox enabled. Missions previously created and loaded either in FRED or in FS, will default to the previous behaviour.
Steps To ReproduceTake a ship with multiple dockpoints, dock several fighters to it, make all hostile, then play in mission and watch the core ship spin around. Then, change the intial orders of the fighters to "play dead, 89", then replay the mission and watch how it behaves as it should.
Additional InformationThis was split from bug 0000530.
TagsNo tags attached.
Attached Files
  • ? file icon MultiDockTest.fs2 (9,481 bytes) 2012-06-21 16:26
  • ? file icon MultiDockTest2.fs2 (10,171 bytes) 2012-06-25 09:54
  • patch file icon patch2_for_945.patch (3,402 bytes) 2012-06-25 19:29 -
    Index: code/ai/aicode.cpp
    ===================================================================
    --- code/ai/aicode.cpp	(revision 8915)
    +++ code/ai/aicode.cpp	(working copy)
    @@ -10589,9 +10589,8 @@
     	case AIS_DOCK_4A:
     	{
     		if (aigp == NULL) {	//	Can happen for initially docked ships.
    -			// Goober5000 - if we just "sit and wait for further orders", then we're not doing any behavior, grrr...
    -			// (commenting out a retail bug)
    -			//ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );		// do the default behavior
    +			// this now "just sits here" for docked ships
    +			ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );		// do the default behavior
     		} else {
     			mission_log_add_entry(LOG_SHIP_DOCKED, shipp->ship_name, goal_shipp->ship_name);
     
    @@ -13585,6 +13584,12 @@
     
     	Assert((aip->mode != AIM_WAYPOINTS) || (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC));
     
    +	if (!stricmp(shipp->ship_name, "GTF Ulysses 2")) {
    +		mprintf(("ship 2\n"));
    +	} else if (!stricmp(shipp->ship_name, "GTF Ulysses 3")) {
    +		mprintf(("ship 3\n"));
    +	}
    +
     	// Set globals defining the current object and its enemy object.
     	Pl_objp = &Objects[objnum];
     
    @@ -14188,42 +14193,42 @@
     
     void ai_do_default_behavior(object *obj)
     {
    -	ai_info	*aip;
    -	int		ship_flags;
    -
     	Assert(obj != NULL);
     	Assert(obj->instance != -1);
     	Assert(Ships[obj->instance].ai_index != -1);
     
    -	aip = &Ai_info[Ships[obj->instance].ai_index];
    +	ai_info	*aip = &Ai_info[Ships[obj->instance].ai_index];
    +	int	ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
     
    -	ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
    -	if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
    +	// default behavior in most cases (especially if we're docked) is to just stay put
    +	aip->mode = AIM_NONE;
    +	aip->submode_start_time = Missiontime;
    +	aip->active_goal = AI_GOAL_NONE;
    +
    +	// if we're not docked, we may modify the behavior a bit
    +	if (!object_is_docked(obj))
     	{
    -		int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
    -		set_target_objnum(aip, enemy_objnum);
    -		aip->mode = AIM_CHASE;
    -		aip->submode = SM_ATTACK;
    -		aip->submode_start_time = Missiontime;
    +		// fighters automatically chase things
    +		if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
    +		{
    +			int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
    +			set_target_objnum(aip, enemy_objnum);
    +			aip->mode = AIM_CHASE;
    +			aip->submode = SM_ATTACK;
    +		}
    +		// support ships automatically keep a safe distance
    +		else if (ship_flags & SIF_SUPPORT)
    +		{
    +			aip->mode = AIM_SAFETY;
    +			aip->submode = AISS_1;
    +			aip->ai_flags &= ~(AIF_REPAIRING);
    +		}
    +		// sentry guns... do their thing
    +		else if (ship_flags & SIF_SENTRYGUN)
    +		{
    +			aip->mode = AIM_SENTRYGUN;
    +		}
     	}
    -	else if (ship_flags & (SIF_SUPPORT))
    -	{
    -		aip->mode = AIM_SAFETY;
    -		aip->submode = AISS_1;
    -		aip->submode_start_time = Missiontime;
    -		aip->ai_flags &= ~(AIF_REPAIRING);
    -	}
    -	else if ( ship_flags & SIF_SENTRYGUN )
    -	{
    -		aip->mode = AIM_SENTRYGUN;
    -	}
    -	else
    -	{
    -		aip->mode = AIM_NONE;
    -	}
    -	
    -	aip->submode_start_time = Missiontime;
    -	aip->active_goal = AI_GOAL_NONE;
     }
     
     #define	FRIENDLY_DAMAGE_THRESHOLD	50.0f		//	Display a message at this threshold.  Note, this gets scaled by Skill_level
    
    patch file icon patch2_for_945.patch (3,402 bytes) 2012-06-25 19:29 +
  • ? file icon 0MultiDockTest2.fs2 (10,183 bytes) 2012-06-25 19:32
  • patch file icon patch3_for_945.patch (1,427 bytes) 2012-06-26 06:08 -
    Index: fs2_open/code/ai/aicode.cpp
    ===================================================================
    --- fs2_open/code/ai/aicode.cpp    (revision 8915)
    +++ fs2_open/code/ai/aicode.cpp    (working copy)
    @@ -11999,6 +11999,11 @@ void ai_maybe_evade_locked_missile(object *objp, ai_info *aip)
     		return;
     	}
     
    +	// don't evade missiles if you're docked
    +	if (object_is_docked(objp)) {
    +		return;
    +	}
    +
     	if (aip->ai_flags & (AIF_NO_DYNAMIC | AIF_KAMIKAZE)) {	//	If not allowed to pursue dynamic objectives, don't evade.  Dumb?  Maybe change. -- MK, 3/15/98
     		return;
     	}
    @@ -12097,6 +12102,11 @@ void maybe_evade_dumbfire_weapon(ai_info *aip)
     		return;
     	}
     
    +	// don't evade dumbfires if you're docked
    +	if (object_is_docked(Pl_objp)) {
    +		return;
    +	}
    +
     	//	Make sure in a mode in which we evade dumbfire weapons.
     	switch (aip->mode) {
     	case AIM_CHASE:
    @@ -14635,7 +14645,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
     		
     		//	Hit by a protected ship, don't attack it.
     		if (objp_hitter->flags & OF_PROTECTED) {
    -			if ((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) && (aip->target_objnum == -1)) {
    +			if (((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) && (aip->target_objnum == -1)) || !object_is_docked(objp_ship)) {
     				if (aip->mode == AIM_CHASE) {
     					if (aip->submode != SM_EVADE_WEAPON) {
     						aip->mode = AIM_CHASE;
    
    patch file icon patch3_for_945.patch (1,427 bytes) 2012-06-26 06:08 +

-Relationships
parent of 0002557closedGoober5000 Jettison-cargo-delay doesn't work 
has duplicate 0001723closedGoober5000 Fighters/bombers with no orders will keep trying to fly around when docked to another ship 
+Relationships

-Notes

~0012422

The_E (administrator)

Is this still current?

~0012433

Goober5000 (administrator)

I believe so.

~0012434

FUBAR-BDHR (developer)

Last edited: 2010-10-23 19:45

I second that believe so and know that the speed issue still happens as well. Probably should a relation to that one.

Guess I never filed that report in SCP Mantis because this one was here. It's still open in Diaspora Mantis so the problem still exists in some form.

~0013020

Goober5000 (administrator)

Okay, here's how I propose to fix this:

If a ship is docked to something, and does not have any active goals or orders, then it should not perform evasive maneuvers.

Note, the decision should not be whether the ship is the "dock leader" or not, because the dock leader only matters as far as warping into the mission. It's not necessarily the ship that has control of the stack at a particular time.

~0013021

Goober5000 (administrator)

I should also look through the code to see if I made that incorrect assumption anywhere else the dock leader is referenced.

~0013022

Alan Bolte (reporter)

I don't understand the relationship to 2548. 2548 is for non-docked cargo containers, nav buoys, and sentry guns. In the patch I attached, all I had to do was give non-flyable 'ships' the same exclusion from shockwave-dodging that big ships have (which is handled separately from normal weapon dodging as far as I can tell). I guess the shockwave-dodging behavior might be feeding into the docking issues, I dunno.

~0013023

Goober5000 (administrator)

Oh. I assumed 2548 was for docked cargo containers. Reopening then.

~0013680

niffiwan (developer)

Would a kind soul be able to FRED up a test mission for this bug?

~0013695

MjnMixael (manager)

Test mission uploaded for no mods.

~0013700

niffiwan (developer)

Thanks MjnMixael!

~0013721

Goober5000 (administrator)

Okay, the case demonstrated in the test mission is now fixed. You should also draw up a test case for a fighter that isn't initially docked. (Initially docked ships have a particularly clean AI state that later-docked ships may not have.)

~0013722

MjnMixael (manager)

New mission uploaded, is that what you mean?

Also, the Argo's maneuverability in retail is impressive..

~0013723

Goober5000 (administrator)

Hmm. As I feared, the Argo flips out in the second test mission. More detective work is needed.

~0013724

Goober5000 (administrator)

I have patched most of the gaps, but the fighters still pulse their engines if shot at. I'll defer this for now, but revisit it later.

~0013725

Goober5000 (administrator)

I've uploaded my current patch.

~0013726

Goober5000 (administrator)

This new version of MultiDockTest assigns one of the ships to stay-still (the other is still play-dead) and changes the mission name.

~0013727

niffiwan (developer)

I had a go at stopping the fighters from maneuvering by preventing them from entering AIM_EVADE_WEAPON mode (see patch3) - in testing with the 1st mission this has stopped most of the movement, but not all. There are a few "twitches" which don't appear to be being caused by changes in the AI mode, i.e. the fighters are staying in AIM_NONE the entire time. So I'm not sure what's causing this...

~0013729

Goober5000 (administrator)

Well done niffiwan. Two out of three of those are solid fixes. The third I'm not sure about; will have to double-check.

~0013740

Goober5000 (administrator)

All fixed!
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2006-06-11 15:15 The Trivial Psychic New Issue
2006-07-19 21:27 Goober5000 Additional Information Updated
2006-11-24 18:04 Goober5000 Relationship added child of 0000530
2007-10-22 01:41 Goober5000 Relationship deleted child of 0000530
2010-10-22 09:00 The_E Note Added: 0012422
2010-10-23 16:33 Goober5000 Note Added: 0012433
2010-10-23 19:41 FUBAR-BDHR Note Added: 0012434
2010-10-23 19:45 FUBAR-BDHR Note Edited: 0012434
2012-01-03 03:05 Goober5000 Relationship added related to 0002557
2012-01-03 03:08 Goober5000 Relationship added parent of 0002548
2012-01-03 03:09 Goober5000 Relationship replaced has duplicate 0002557
2012-01-03 03:09 Goober5000 Relationship replaced parent of 0002557
2012-01-03 03:10 Goober5000 Priority normal => urgent
2012-01-03 03:10 Goober5000 Severity minor => major
2012-01-03 03:10 Goober5000 Target Version => 3.6.14
2012-01-03 03:15 Goober5000 Note Added: 0013020
2012-01-03 03:17 Goober5000 Note Added: 0013021
2012-01-03 03:51 Alan Bolte Note Added: 0013022
2012-01-03 03:57 Goober5000 Note Added: 0013023
2012-01-03 03:58 Goober5000 Relationship deleted parent of 0002548
2012-06-19 21:08 niffiwan Note Added: 0013680
2012-06-21 16:26 MjnMixael File Added: MultiDockTest.fs2
2012-06-21 16:26 MjnMixael Note Added: 0013695
2012-06-22 05:23 niffiwan Note Added: 0013700
2012-06-25 06:33 Goober5000 Changeset attached => fs2open trunk r8914
2012-06-25 06:35 Goober5000 Note Added: 0013721
2012-06-25 09:54 MjnMixael File Added: MultiDockTest2.fs2
2012-06-25 09:54 MjnMixael Note Added: 0013722
2012-06-25 18:52 Goober5000 Note Added: 0013723
2012-06-25 19:27 Goober5000 Note Added: 0013724
2012-06-25 19:29 Goober5000 File Added: patch2_for_945.patch
2012-06-25 19:29 Goober5000 Note Added: 0013725
2012-06-25 19:32 Goober5000 File Added: 0MultiDockTest2.fs2
2012-06-25 19:33 Goober5000 Note Added: 0013726
2012-06-26 06:08 niffiwan File Added: patch3_for_945.patch
2012-06-26 06:13 niffiwan Note Added: 0013727
2012-06-27 01:32 Goober5000 Note Added: 0013729
2012-06-30 23:24 Goober5000 Changeset attached => fs2open trunk r8918
2012-06-30 23:25 Goober5000 Note Added: 0013740
2012-06-30 23:25 Goober5000 Status assigned => resolved
2012-06-30 23:25 Goober5000 Resolution open => fixed
2012-06-30 23:25 Goober5000 Fixed in Version => 3.6.14
2012-06-30 23:25 Goober5000 Description Updated View Revisions
2012-07-01 01:59 Goober5000 Relationship added has duplicate 0001723
+Issue History