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.
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!
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
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!
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.
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
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.