After player dies in vehicle cannons or MG, weapon swings around involuntarily while vehicle is being driven

Issue #355 resolved
Colin Basnett created an issue

After a player dies in a vehicle cannon or MG position (e.g. is shot or suicides), the weapon will swing around (yaw) while the vehicle is being driven, to remain facing towards the same fixed point.

Happens in single or multiplayer.

Happens whether or not a new player has entered the cannon/MG position.

Is only fixed after a new player has entered the cannon/MG position and then exited (not died).

Comments (9)

  1. Colin Basnett reporter

    This also occurs when a player dies or is shot out of any commander spot. The gun will continue to aim in the world direction it was facing when the player died.

  2. Matt Hands

    Aaaarrrrggghhhhhh !!!! I've been going over every change I've made to find what introduced this and thought to check back to DH 5.1. And then RO. Guess what? The damn bug is THERE IN RO & DH5.1, so it's 10 years old !!! A great example of how intensive testing & scrutiny reveals old flaws that are taken to be new bugs.

    Player being killed in the vehicle weapon position is the key - I'd seen the bug in both cannons & MGs, but hadn't realised that it was only after player death. Always happens when you use the LeaveBody debug tool. which I guess is a bit like a player dying in the position. The pawn is unpossessed when using LeaveBody, so I suspect the bug may be connected with the unpossession/possession process and not specifically with death.

    When a player chooses to leave the position, KDriverLeave() gets called, where if the player is killed (including suicide) then DriverDied() gets called. Both are followed by DriverLeft() and then DrivingStatusChanged(), so common functionality goes there. So I think we are looking for something critical that DD fails to do, but which KDL does. Or, less likely, something unwanted that DD does, but which KDL does not.

    I think the clue is in the old (5.1) DH_Guns.DH_ATGunTwoCannonPawn class, now obsolete. It had its own KDL function and when I originally modded the pakwagen, in the modded pak 40 I was forced to skip over the KDL super from DH_ATGunTwoCannonPawn & made this comment: "overrides the super in DH_ATGunTwoCannonPawn because that causes the gun to swing around as the vehicle is being driven & turned !". So line by line analysis of the difference between the KDL functions should reveal what DD needs to do differently. On a quick analysis, I see the original KDL saving references to the 'old' Controller, then the Controller getting changed and then doing stuff to the old Controller. DD may need to do something similar.

    ps - Notice the way the vehicle weapon rotates smoothly back to where it should be facing when a new player gets in, after previous player death? Looks very much like the way turrets rotate to a new position when a new player gets in, whose net client didn't have the a replicated version of the vehicle when the old player turned it. So maybe, just maybe, we might find out something we can use to tackle that ancient bug. One day, not now .....

  3. Matt Hands

    Ok, think it's Gun.bActive = false, which needs to be added to DriverDied() !!!

    Will confirm when I get in tonight & commit a fix if it works.

  4. Matt Hands

    Should be fixed in commit 3961870.

    Resetting Gub.bActive to false is the key. But have included (in DriverDied) a Gun-reset block that is in KDriverLeave() but was not in DriverDied(). So we also reset the VehicleWeapon's FlashCount, NetUpdateFrequency and NetPriority, which must all be appropriate as the 'Driver' has left, i.e. got himself killed.

    Also added same fix to the LeaveBody debug tool (in later commit).

    Looking at the last UT2004 release source code, this isn't even an RO bug - it goes all the way back to UT2004 !

    Have re-written the issue description as it was universal & not specific to the StuG remote MG.

    Great spot that it occurred only after a player died in the weapon position. That allows me to home in on the problem, so cheers.

  5. Matt Hands

    Found out there was a completely separate issue affecting MGs that have some positions where player can't fire, i.e. StuG & StuH. That must have been the original reported issue here, before the much bigger and more widespread problem linked to player death became apparent & the two problems got muddled.

    Anyway, the StuG/StuH MG specific problem is fixed in commit d5f4df2.

  6. Log in to comment