RuneStorm
http://www.runestorm.com/forums/

BW 2.5 projectile bug during LAN play
http://www.runestorm.com/forums/viewtopic.php?f=4&t=77256
Page 1 of 1

Author:  eldarion [ Sat Oct 29, 2011 5:24 pm ]
Post subject:  BW 2.5 projectile bug during LAN play

Hi,

I have been hosting BW 2.5 on a dedicated server ever since release (and earlier versions of BW before that). Great job, it is the best mod I have ever used on UT2004.

On 2.5 though I have noticed that certain weapon projectiles, such as the E-23 plasma balls, do NOT fire in a straight line on a client machine---if you hold down the trigger on the E-23 against a far wall, a grid pattern shows up. It is impossible to fire the weapon's projectiles to any point that is not part of the grid. If I try the exact same test on the server (i.e. hosting the game instead of joining the LAN game) the E-23 works perfectly--no grid shows up and the projectiles end up exactly where I place the crosshairs.

The only reference I can find to this bug on these forums is here:
viewtopic.php?p=96447#p96447

Is there a known workaround?

Thanks! :)

Author:  Sgt. Kelly [ Sat Oct 29, 2011 8:02 pm ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

No there isn't a known workaround, but from tests I've done the effect seems to only be visible. I've had SMAT shells visually fly past bad guys who exploded into bits.

Author:  Black Eagle [ Sun Oct 30, 2011 2:34 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

There is a simple reason I believe(although it could be something else), the problem occurs when the aiming of the weapon is replicated to clients, since this value is a vector it gets clamped to the nearest non-decimal point value... :think:

On the server everything will work and appear normally despite what the clients see as happening...

Basically there is no real work around without altering the base BW weapon code... I could be wrong too and its something else... :)

Author:  eldarion [ Mon Oct 31, 2011 12:10 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

Looking at the code for the BallisticProjectile it appears that all client/server replication is inherited from the stock UT Projectile class. I know the projectiles under UT2004 (no BW) do not have this bug, so I suspect that the projectile really is firing on an incorrect vector.

To back this up I tried shooting a stationary player in the head with the E23 Viper. The projectile appeared to strike the player's body (instead of the center of the player's head, where the sniper crosshairs were placed) and I did not receive a headshot reward.

I wonder if splash damage could explain why the weapon appears to work at all? :think:

Author:  eldarion [ Mon Oct 31, 2011 12:30 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

Digging further it appears that a Rotator value is used to launch the projectile. Trouble is, a rotator is only represented by a byte value during replication:
http://wiki.beyondunreal.com/Rotator

So, the fix would appear to involve looking at how the original game engine launches projectiles (e.g. the rocket launcher) and modifying the BW code in the DoFireEffect() function to remove usage of the Rotator type as much as possible.

I might look into this further, although I do not know if I will be able to set up the environment to recompile the modified BW code (specifically I notice there are garbage characters many places in the decompiled code, so recompilation may or may not even be possible on my end). :-\

EDIT: While I am a seasoned C/C++ programmer, today marks the first time I have looked at the UT2004/BW internals, so please bear with me if I am spouting nonsense. ;D I would like to see this bug fixed and am willing to work on it if I can get the toolchain working and test modules compiling.

Author:  Sgt. Kelly [ Mon Oct 31, 2011 12:46 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

Yeah, unfortunately there are a couple problems with the way BW projectiles are handled. There is also an issue with projectiles that spawn in walls not destroying themselves properly, and in some cases problems with projectiles gliding along the floor in seemingly random vectors. Some of the BW community guns are based off of the older UT code for those reasons.

An easy way you can test the projectile vector bug would be to position a friendly bot on a tower in ONS-Torlan and attempt to shoot at them with the SM-AT/AA Recoilless Rifle or ViPeR. In the tests I've conducted the high speed rocket collided with the bot in almost all cases, so I think it's harmless.

Also, the easiest way to test out your theories would be to make a new .u pack. We've had a couple community coders make new bug fix/balance packs by making weapons based off of slightly modified base code. If you want, I can cook you up a quick basic weapon class for you to play around with.

Alternatively, if you're unfamiliar with making packages in UT2004, I can actively field test out any theories you might have. I've got a package of prototype weapons set up for the sole purpose of testing out new weapon code.

Author:  eldarion [ Mon Oct 31, 2011 2:07 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

Sgt. Kelly wrote:
An easy way you can test the projectile vector bug would be to position a friendly bot on a tower in ONS-Torlan and attempt to shoot at them with the SM-AT/AA Recoilless Rifle or ViPeR. In the tests I've conducted the high speed rocket collided with the bot in almost all cases, so I think it's harmless.

Ah, so that's what the SMAT is. ;D I'll try it out when I have some free time.

Sgt. Kelly wrote:
Also, the easiest way to test out your theories would be to make a new .u pack. We've had a couple community coders make new bug fix/balance packs by making weapons based off of slightly modified base code. If you want, I can cook you up a quick basic weapon class for you to play around with.

Alternatively, if you're unfamiliar with making packages in UT2004, I can actively field test out any theories you might have. I've got a package of prototype weapons set up for the sole purpose of testing out new weapon code.


That sounds great! As you have guessed I am completely unfamiliar with creating UT packages--I don't mind learning of course, but if the bug is something simple it can be fixed faster this way while I learn. :)

My first guess at this is based on looking through the base UT2004 projectile classes. One thing in particular makes me very nervous, and that is in BallisticProjectile::PostNetBeginPlay. There is a chunk of code that looks like this:
Code:
Velocity = Vector(Rotation);
Acceleration = Velocity * AccelSpeed;
Velocity *= Speed;
if (bRandomStartRotation)
{
    R = Rotation;
    R.Roll = Rand(65536);
    SetRotation(R);
}


Now the code itself looks fine at first glance, but if you take into account replication data compression (due to the fact that it is being called on the client machines during projectile creation/replication) "Velocity = Vector(Rotation)" looks like it could drop quite a bit of precision.

All of the stock UT2004 projectiles have that entire block of code in PostBeginPlay(), not PostNetBeginPlay(), which makes sense as PostNetBeginPlay() is called after all net variables have been replicated. As far as I can tell this would have the effect of overwriting the existing replicated variables with less precise computed values derived from the rotator-typed Rotation variable.

Testing should be a (simple?) matter of creating a PostBeginPlay() function in BallisticProjectile, calling the superclass PostBeginPlay() function, and moving the block of code I mentioned from PostNetBeginPlay() to the new PostBeginPlay() function. For an example of what I am referring to just take a look at the stock LinkProjectile class.

Thoughts? Am I even barking up the right tree here? ;)

Author:  Black Eagle [ Mon Oct 31, 2011 2:44 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

That could indeed be the problem, since a vector normally compressed to int values isn't as bad as a vector compressed to a rotator with byte values!... :-\

That only gives you 256 possible directions along each plane, more than enough to miss some space.... :o

Author:  eldarion [ Tue Nov 01, 2011 1:03 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

I have a compilation environment set up and I would like to test my theory mentioned above, but I can't seem to extract a clean (i.e. re-compilable) copy of the sources from BCore25.u (the default parameters are completely messed up). Is there any chance I could get a known-compilable copy of the source code for that particular module? :pray:

Thanks!

Author:  Sgt. Kelly [ Tue Nov 01, 2011 8:57 pm ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

You might want to check with ShadowBlade, BlackEagle or DarkCarnivour for that. All of us are using the same decompiled code as you. ;)

Though as an FYI, migrating the code to PostBeginPlay() did not fix the projectile bug in game. Regardless of whether the code is located in Post or PostNet, the effects play out in a neat little pattern. The code below was tested in many configurations inside the A73Projectile.uc class, which extends BallisticProjectile.

Code:
simulated function PostBeginPlay()
{
   Super.PostBeginPlay();

   StartLocation = Location;
   Velocity = Vector(Rotation);
   Acceleration = Velocity * AccelSpeed;
   Velocity *= Speed;
   if (StartDelay > 0)
   {
      SetPhysics(PHYS_None);
      bHidden=true;
      SetTimer(StartDelay, false);
      bDynamicLight=false;
      return;
   }
//   InitProjectile();

   if ( Level.bDropDetail || Level.DetailMode == DM_Low )
   {
      bDynamicLight = false;
      LightType = LT_None;
   }
}


simulated function PostNetBeginPlay()
{
   InitProjectile();
}

Author:  eldarion [ Tue Nov 01, 2011 11:02 pm ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

OK, thanks for testing that. :)

I will look over the source some more and see if there is anything else that stands out.

Author:  eldarion [ Sat Dec 24, 2011 2:35 am ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

Finally got some free time to set up a proper compilation environment, and was able to fix the bug in less than half an hour. :D

Please find a patch and a working BCoreV25.u file attached.

Author:  Sgt. Kelly [ Sat Dec 24, 2011 10:46 pm ]
Post subject:  Re: BW 2.5 projectile bug during LAN play

Wow, awesome! I'll check this out. :)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/