Download

Another network issue. Projectile spawns on server but not client...

Ok, here’s the setup. I’m trying to create a basic networked game. I’ve gotten player movement to work over the network fine, but when trying to shoot a gun (raycasted/linetraced, or a projectile) it doesn’t work right. Both have the same issue. If I play on the client, everything happens as expected for the client, but not the server. In the current case, I’m using a projectile. It spawns and moves forward on the client end, but on the server end, it sees nothing. When the server fires, the server sees only one bullet and the client sees two slightly off center from each other (probably from spawning inside the other bullet, they push each other out of the way enough to spawn). This makes no sense as to how one side can see it perfectly fine, and the other sees an extra bullet or nothing. @_@ Kind of confusing. I know that the way I did it would have desync issues down the line, but I just want to make something spawn by a blueprint on the network. That shouldn’t be too hard, right? Any help would be appreciated. Attached is my gun logic (probably done horribly.)

**NOTE: At the moment, I have everything set to replicate (projectile and player) including functions. I’ve tried server only, client only, etc, but nothing seems to work. It’s probably something I’m doing wrong, but really, the documentation and tutorial videos haven’t really given a clue on this, at least not that I’ve seen.

projectile movement component can be replicated, when you create a projectile bp, just set it to enable replicate/replication movement.
And then all you need to do is make sure you let server to spawn projectiles(run on server), while client issue requests.

This is the step I need doing today. I have the standard C++ FPS template (with projectile tennisballs) and I have viewed the network tutorials. Just going to figure out this step in BP. Edit: Had to do it in C++ (changed the OnFire() method to become a RCP).

Solved it I think. Turns out that it wasn’t spawning because it was inside the player. Changed the multiplier for direction from 1 (I know, kind of pointless to have there in the first place) to 100 and it worked fine. Also, to get it to shoot up and down instead of just left and right, I had to have it get the controller, instead of the camera. (worked server side, but not client side)

Now I have a bug though where the bullets fire, but the sound doesn’t play when the client fires, but plays when the server does. Ahhh the joys of networking. (also, the client end the projectiles kind of jump back and forth a smidgen. I know that it has to do with authenticating through the server, but it still shouldn’t be that noticeable. It “should” only have to fix it once and be pretty much accurate after that point, but it’s jumpy as can be.)

EDIT:
Should note, yes, I had the box checked to spawn even if inside a collider, but it was still not spawning for whatever reason. Probably server authentication not seeing that value as checked.