Projectile Start Location On Dedicated Server Not The Same As Client


• My game uses a dedicated server.
• My player character spawns a blueprint weapon in it’s hand
• When I need to fire a projectile the clients character asks the server to fire a projectile. I have a custom event to RunOnServer. Off that custom event it goes to my weapon interface.
• Inside my weapon blueprint I have a StaticMeshComponent and that mesh has custom sockets setup on that static mesh. One socket it named Muzzle.
• When the weapon blueprint receives the “Event Fire Projectile” (interface call I made) that goes to a custom event to RunOnServer and that spawns the projectile. It spawns the the projectile but by the characters feet. I know I have the socket “Muzzle” correct because if I change the custom event from RunOnServer to Multicast the projectile spawns at the “Muzzle” socket and also by my characters feet. I’ve been working on figuring this out for 2 days and it has to be something so simple I am skipping over it. Maybe I need a break haha. It seems that the server isn’t getting the spawn location or something.

Below is a pic of how I’m getting the socket location for the projectile to spawn.

This is racking my brain someone please help lol

Scroll down 15 days later I posted a test project with the problem fixed and broke. What I have found is if you call Run on Server twice in a row it breaks the projectile spawn location or something like that.

Are you passing the projectile location into the Server Event that spawns the projectile, as that should do it for you.

Thanks for taking the time to help me out. I tried that. In my WeaponBP I spawn the projectile off the interface call, right after that I put a custom event to RunOnServer and then that spawns the projectile, still spawning at the feet. I shouldn’t have to do and RunOnClient events to get the socket location right?

Sounds like the Static Mesh Component isn’t replicating properly after reading your initial post again, possibly?

When you click on the in the heirachy is Replicates, Replicates Movement, and Net Load on Client Root checked?

Edit: Changed Static Mesh Component to Root

I’ll check, I just edited my post above and put a screen shot up

1 Like

The screenshot looks good to me on initial glance.

It might be SmoothSync but I’ll try what you suggested

Ah think I found it. GetSocketLocation returns a local location and you need a world location. Try GetWorldTransform off the Static Mesh Component.

EDIT: GetComponentLocation seems to be preferred

Thanks, I’m redoing my BP_Masters to see if they need to be setup differently


Straight forward approach with Server Auth on projectiles. This “reduces” potential cheating.
e.g. clients passing illegitimate transforms, thus shooting through walls/cover etc.

For demo purposes I coded this up directly in the character class. Typically you want fire logic in the weapon class.

This should work well out of the box for very low ping game play (sub 50ms). Beyond that you’ll get discrepancies in client/server aim. Meaning a moving client will predict a hit where as the servers projectile trajectory will differ.

This will be especially noticeable if you add client-fakey simulation. e.g. client fires a local only “fake” projectile for responsiveness.

Ping mitigation will require extensive work. You’ll need a reasonably accurate network clock, server-side player position buffer and usage of projectile path prediction. Essentially setting up “Rewind Time”. You want the server to be spawning the projectile with the same transform/velocity as the client did based on where the client was and was aiming at that specific moment in time. Projectile path prediction will enable server and firing client projectile syncing.



I have a problem still and it’s not a socket problem like I thought. I’ve been trying hard to figure this out for weeks. Basically when I spawned the gun in my characters hand it was facing down and then the animation changed. So the server must think its always facing the ground lol. I tested this out by changing the rifle animation first then spawning the gun. This fixed the issue of it on the ground but throws my brain for another loop.

Right now I made a fresh Third Person Character default project to test on. I have it on my dropbox if anyone would like to take a look at it. If you test it out it will work in single player mode and on the dedicated server but there is a problem still unless I’ve always been doing replication wrong lol If I run 2 custom events in a row to Run On Server it breaks projectile start location and just spawns at the end of the barrel as if it was staright out in a default position, it’s hard to explain. As the character aims up and down the gun and pitch replicates but the projectile just spawns where the gun originally spawned and that barrel/gun position and that is right out from his waist. Take a look at the picture I will post. When you test it out you will see how it should work and after you run 2 run on server calls then it breaks it.

Picture of it Working with just one server call Projectile spawns at any angle.

Picture of it Broke with 2 server calls Projectile just spawns at one height and not up and down

• When you start/play the project/game you might need to change the stop button/s because I changed them to Left Shift and Esc.
• By default I have it setup to work.
• Press the “E” Key to spawn the gun in the hand.
• Press the Left Mouse button to fire projectiles (Note I disabled the projectile speed etc. for testing)
• Aim mouse up and down while shooting to see where the projectile spawns, they should be at different Zed locations etc. if aiming up and down.
• Press the “Z” Key to join the local dedicated server and try there. It must work on a dedicated server.
• To break the project and see my problem, on the branch of firing the projectile enable/check the checkbox and it will run the double Run On Server Call, You can also break it by changing the custom event in the weapon BP to Run On Server Too. You can do it anyway you want but if you do double calls in a row it breaks the pitch on the gun.
• I also setup Static and Skeletal meshes on the character that you can manually choose the meshes to test to bypass spawning the actor component weapon. Then you have to just connect the left mouse button input to that mess of code lol and choose what mesh either staticl or skeletal to test by checking the branch there. But if you don’t change anything just press the “Z” key that joins the server and then the “E” Key and go at it lol

Link To Test Project

In my game I have seperate BP actors that attach to the main character so the projectiles must come from the weapon bp but either way this problem with a double server calls breaks it.

Thanks to everyone who has read and help out on this!