Jerky projectile movement on clients

As discussed here:

Client projectiles were moving jerkily, whereas the server projectiles worked fine. Specifically happened more often when more projectiles were in the scene, or when they bounced. Had to implement this blueprint in the projectile object to make it constantly update client machines.

Hi Russ,

I can’t seem to reproduce any jerky projectile movement on my end here. Can you send along a test project with which this happens? You can upload it somewhere like Dropbox or Google Drive and get me a download link, if it’s too big to attach here. Thanks!

Hey Russ,

We haven’t heard back from you in a while, so I’m resolving this post for now. If you’re still having trouble with jerky projectile movement on the Client, please feel free to respond with the information requested above and we can continue investigating. Thanks!

Hi, so, still having problems here, sorry for not getting back sooner, thought I’d fixed this by setting the projectile position manually, by getting it’s location on the server each tick and firing it to all the clients. That quite understandably seems to have caused a silly amount of lag when there’s lots of projectiles going on…

So, what i want to happen is; the player presses fire to spawn a turret, then the projectile is fired from that turret

I’m triggering firing like this:

On the client:

To an event on the server (reliable)

59425-capture2.png

Which does some checks and sends some info to the turret, to tell it to fire:

The turret then fires:

And the projectile should just do its job from there, as it has nothing attached to tick.

Here’s the network settings for both the turret and projectile:

59428-capture5.png

I’m running in editor, with 2 multiplayer games running at the same time (1 server, 1 client)

Any ideas?

My guess without seeing the project is that this has something to do with calculations being run on the projectile at spawn, since it appears you are setting a number of variables on spawn and these are probably being used immediately. It would be helpful to see this in a test project. Are you able to reproduce this in a new project, or only your current project? If in a new project, would you upload it someplace like Dropbox or Google Drive and get me a link? Thanks!

Here’s a link to the dropbox folder - i’m getting the problem when running in editor, 2 multiplayer screens on the same PC.

email russ_earwaker@hotmail.com if there are problems

Just removed everything from the projectile spawn apart from this:

so it can set the speed in construction script:

59740-capture2.png

then getting the projectile and setting all the variables as before on that variable, and I’m still getting problems :confused:

Can you zip up the project before adding it to your Dropbox, please? It’s too large for me to download unless it’s zipped first. Thanks!

Hey Ben,

First, thanks for the quick replies, really appreciate it, this thing has been driving me crazy for a while now!

I’ve added 2 new archives to the folder - one with and one without the starter content folder, in case the files are too big :slight_smile:

Hey Russ,

It looks like your projectile is doing a lot over the network. A useful tool for determining the load on the network is the Network Profiler. Run your game and use the console command, “netprofile” on the server, then fire the projectile a bunch. Exit Play and find the .nprof file for the session and open it in the standalone network profiler tool.

I did this for your game and compared it to a blank First Person Blueprint template project (with the projectile set to Replicates and Replicate Movement). The projectile on the FP project has a much lower profile on the network than the one in your project.

My suggestion would be to remove as much of the functionality as you can out of the projectile class itself, and instead call functions in other classes or from other classes as appropriate. If you place the projectile from the FP template in your project and spawn that instead, I think you’ll notice the lag ceases.

Hope that helps!

Hey Ben,

On further investigation, you’re right, creating a new blank projectile type seems to fix the problem. As info, when I tried to set the speed of the projectile within the projectile itself, the judderyness came back. Seems like if i set the initial speed with an a spawn variable and the construction script, or set the velocity with a message sent to the projectile, it gets all shivvery and confused. Setting the speed by getting the projectile movement component externally in the parent object seems to work fine though :slight_smile:

Cheers again,
Russ

For anyone coming around late to this like me. In part because I had this issue. Here’s what I bet was happening with the OG poster. If you make a projectile that’s just spawn and forget, then both the client and server know speed and importantly, velocity of the projectile. But if you spawn the projectile first, finesse it, then set its velocity… well the velocity is only known to the server. And the client gets intermittent, even jerky appearing updates. But if you multicast the initial velocity setting, then both server and client have the projectile close enough and moving together smoothly.

Brefin you are 100% correct. Thank you! Anyone struggling with this, make sure you manually set the speed etc on your Multicast method, instead of relying ProjectiveMovement replication.