2018-06-18 10:44 EDT


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002708FSSCPgameplaypublic2012-12-11 01:46
ReporterGoober5000 
Assigned ToSwifty 
PrioritynormalSeveritymajorReproducibilitysometimes
StatusclosedResolutionunable to reproduce 
Product Version 
Target Version3.6.16Fixed in Version 
Summary0002708: Collision problems with weapons
DescriptionIt seems to be harder and harder to land a weapon hit on an enemy ship the more missions I play during one session. When it gets really bad, I can follow a ship for several seconds, whaling away at it with lasers and missiles, without getting so much as a shield hit for my trouble.

It happens in trunk, with uncorroborated reports that it also happens in RC8. Here is the thread where I first noticed it; I was playing a latest trunk build at the time:
http://www.hard-light.net/forums/index.php?topic=81717.0
TagsNo tags attached.
Attached Files
  • patch file icon bug_fixes.patch (4,908 bytes) 2012-09-09 09:40 -
    Index: code/object/objcollide.cpp
    ===================================================================
    --- code/object/objcollide.cpp	(revision 9114)
    +++ code/object/objcollide.cpp	(working copy)
    @@ -47,6 +47,8 @@
     struct checkobject;
     extern checkobject CheckObjects[MAX_OBJECTS];
     
    +extern int Cmdline_old_collision_sys;
    +
     void obj_pairs_close()
     {
     	if (Obj_pairs != NULL) {
    @@ -1019,21 +1021,50 @@
     		else
     			crw_status[i] = CRW_NO_PAIR;
     	}
    -
    +	
     	// first pass is to see if any of the weapons don't have collision pairs.
     
    -	opp = &pair_used_list;
    -	opp = opp->next;
    -	while( opp != NULL )	{
    -		// for each collide pair, if the two objects can still collide, then set the remove_weapon
    -		// parameter for the weapon to 0.  need to check both parameters
    -		if ( opp->a->type == OBJ_WEAPON )
    -			crw_check_weapon( opp->a->instance, opp->next_check_time );
    +	if ( Cmdline_old_collision_sys ) {
    +		opp = &pair_used_list;
    +		opp = opp->next;
    +		while( opp != NULL )	{
    +			// for each collide pair, if the two objects can still collide, then set the remove_weapon
    +			// parameter for the weapon to 0.  need to check both parameters
    +			if ( opp->a->type == OBJ_WEAPON )
    +				crw_check_weapon( opp->a->instance, opp->next_check_time );
     
    -		if ( opp->b->type == OBJ_WEAPON )
    -			crw_check_weapon( opp->b->instance, opp->next_check_time );
    +			if ( opp->b->type == OBJ_WEAPON )
    +				crw_check_weapon( opp->b->instance, opp->next_check_time );
     
    -		opp = opp->next;
    +			opp = opp->next;
    +		}
    +	} else {
    +		SCP_hash_map<uint, collider_pair>::iterator it;
    +		collider_pair *pair_obj;
    +
    +		for ( it = Collision_cached_pairs.begin(); it != Collision_cached_pairs.end(); ++it ) {
    +			pair_obj = &it->second;
    +			
    +			if ( !pair_obj->initialized ) {
    +				continue;
    +			}
    +
    +			if ( pair_obj->a->type == OBJ_WEAPON && pair_obj->signature_a == pair_obj->a->signature ) {
    +				crw_check_weapon(pair_obj->a->instance, pair_obj->next_check_time);
    +
    +				if ( crw_status[pair_obj->a->instance] == CRW_CAN_DELETE ) {
    +					pair_obj->initialized = false;
    +				}
    +			}
    +
    +			if ( pair_obj->b->type == OBJ_WEAPON && pair_obj->signature_b == pair_obj->b->signature ) {
    +				crw_check_weapon(pair_obj->b->instance, pair_obj->next_check_time);
    +
    +				if ( crw_status[pair_obj->b->instance] == CRW_CAN_DELETE ) {
    +					pair_obj->initialized = false;
    +				}
    +			}
    +		}
     	}
     
     	// for each weapon which could be removed, delete the object
    @@ -1144,6 +1175,7 @@
     void obj_reset_colliders()
     {
     	Collision_sort_list.clear();
    +	Collision_cached_pairs.clear();
     }
     
     void obj_collide_retime_cached_pairs(int checkdly)
    Index: code/object/object.cpp
    ===================================================================
    --- code/object/object.cpp	(revision 9114)
    +++ code/object/object.cpp	(working copy)
    @@ -192,11 +192,8 @@
     		return original_num_to_free;
     	}
     
    -	if ( Cmdline_old_collision_sys ) {
    -		deleted_weapons = collide_remove_weapons();
    -	} else {
    -		deleted_weapons = 0;
    -	}
    +	deleted_weapons = collide_remove_weapons();
    +
     	num_to_free -= deleted_weapons;
     	if ( !num_to_free ){
     		return original_num_to_free;
    Index: code/ship/ship.cpp
    ===================================================================
    --- code/ship/ship.cpp	(revision 9114)
    +++ code/ship/ship.cpp	(working copy)
    @@ -9188,8 +9188,13 @@
     	sp->model_instance_num = model_create_instance(sip->model_num);
     
     	// Valathil - Reinitialize collision checks
    -	obj_remove_pairs(objp);
    -	obj_add_pairs(objp->instance);
    +	if ( Cmdline_old_collision_sys ) {
    +		obj_remove_pairs(objp);
    +		obj_add_pairs(objp->instance);
    +	} else {
    +		obj_remove_collider(OBJ_INDEX(objp));
    +		obj_add_collider(OBJ_INDEX(objp));
    +	}
     
     	// The E - If we're switching during gameplay, make sure we get valid primary/secondary selections
     	if ( by_sexp ) {
    Index: code/ship/shipfx.cpp
    ===================================================================
    --- code/ship/shipfx.cpp	(revision 9114)
    +++ code/ship/shipfx.cpp	(working copy)
    @@ -1121,7 +1121,7 @@
     
     					if ( mc.bsp_leaf ) {
     						if ( mc.bsp_leaf->tmap_num < 255 ) {
    -							polymodel *pm = model_get(sip->cockpit_model_num);
    +							polymodel *pm = model_get(sip->model_num);
     							int tmap_num = mc.bsp_leaf->tmap_num;
     
     							if ( !(pm->maps[tmap_num].is_transparent) && strcmp(bm_get_filename(mc.hit_bitmap), "glass.dds") ) {
    Index: code/weapon/weapons.cpp
    ===================================================================
    --- code/weapon/weapons.cpp	(revision 9114)
    +++ code/weapon/weapons.cpp	(working copy)
    @@ -4887,11 +4887,7 @@
     		//if ( !(Objects[parent_objnum].flags & OF_PLAYER_SHIP) )
     		//	return -1;
     
    -		if ( Cmdline_old_collision_sys ) {
    -			num_deleted = collide_remove_weapons();
    -		} else {
    -			num_deleted = 0;
    -		}
    +		num_deleted = collide_remove_weapons();
     
     		nprintf(("WARNING", "Deleted %d weapons because of lack of slots\n", num_deleted));
     		if (num_deleted == 0){
    
    patch file icon bug_fixes.patch (4,908 bytes) 2012-09-09 09:40 +

-Relationships
related to 0002706resolvedValathil Weapons not colliding 
+Relationships

-Notes

~0013953

Goober5000 (administrator)

Possibly related to 2706.

~0013956

Swifty (developer)

Uploaded a patch with some potential fixes.

~0014379

Zacam (administrator)

Last edited: 2012-12-09 01:11

View 2 revisions

Please check against builds that use the fix for Mantis 2706 (r9414)

Also, informational: The attached patch was committed r9178.

~0014380

Valathil (developer)

Last edited: 2012-12-09 01:04

View 2 revisions

Im not expecting 9414 to fix this cause this was a subsystem issue and fighters dont have a lot of modeled subsystems. i.e. none normally. Also note shield hits are problem here

~0014381

MjnMixael (manager)

Yeah, this still needs re-verification as the posted (and applied) patch has never received feedback regarding this issue. I'll keep my eyes open for the next few days on this, but I'd prefer Goober re-test.

~0014382

Zacam (administrator)

I never expect anything, but in any case this requires replication testing in any case to validate if it still exists or not.

If it doesn't, great. If it does, we need newer information.

~0014421

Goober5000 (administrator)

I didn't expect 9414 to fix the bug either, but whatever the cause, it is no longer present. I just played the affected missions and had no trouble hitting my targets.
+Notes

-Issue History
Date Modified Username Field Change
2012-09-04 21:03 Goober5000 New Issue
2012-09-04 21:03 Goober5000 Status new => assigned
2012-09-04 21:03 Goober5000 Assigned To => Swifty
2012-09-04 21:03 Goober5000 Relationship added related to 0002706
2012-09-04 21:03 Goober5000 Note Added: 0013953
2012-09-09 09:40 Swifty File Added: bug_fixes.patch
2012-09-09 09:40 Swifty Note Added: 0013956
2012-11-05 00:45 Goober5000 Target Version => 3.6.16
2012-12-09 01:01 Zacam Note Added: 0014379
2012-12-09 01:01 Zacam Status assigned => feedback
2012-12-09 01:03 Valathil Note Added: 0014380
2012-12-09 01:04 Valathil Note Edited: 0014380 View Revisions
2012-12-09 01:11 Zacam Note Edited: 0014379 View Revisions
2012-12-09 01:12 MjnMixael Note Added: 0014381
2012-12-09 01:12 Zacam Note Added: 0014382
2012-12-11 01:45 Goober5000 Note Added: 0014421
2012-12-11 01:45 Goober5000 Status feedback => assigned
2012-12-11 01:45 Goober5000 Status assigned => closed
2012-12-11 01:45 Goober5000 Resolution open => duplicate
2012-12-11 01:46 Goober5000 Resolution duplicate => unable to reproduce
+Issue History