Run on dedicated server cause problems with socket location

Hello.

When im testing multiplayer projectile spawn from weapon muzzle, it works on normal run where one of players act as server, but if i check “run on dedicated server” to true, it cause problems with socket location, it spawning projectiles from one location…

IMAGE:

Is there some way how to fix this? I found that some people had this problem too but they did not found any solution too

Hi Name368,

Can you show me a screenshot of your blueprint for the firing mechanism? Additionally, try running a print string on the relative socket location, is it different on PIE when Run Dedicated Server is on/off?

Hello,

I tried print string on relative location and it returned 0 0 0 for both cases (im spawning and attaching gun at begin play), also tried world location, and both cases returns same numbers so it looks like socket location is not changed with dedicated server option

here is my fire function, its in character bp:

Try using a “User timer by event” and set the event input to the timer function you are currently using. I ran into a similar issue last week and this seemed to be the cause.

Hello, I tried but i still have same problem… This looks like a very deep bug… If you want i can send you my whole project and you can test it out, let me know… Thanks

I did one more test: 1 player and run on dedicated server:
Socket location in print string is changed (got X values between 1750 - 1800 - 1750 so its mean that socket is moving on curve as expected
but projectiles are spawned from one same point… Strange is that i can rotate horizontally that spawn, but not vertically like in video…

So i did more tests and i found that it is not only socket location problem…
In weapon blueprint, i created st.mesh component and attached it to gun at muzzle location


Now im spawning projectiles from this point but with same problem as from socket…

Try creating a rotation variable input on your custom event. Pass the rotation and location information through this. It may be that the socket information isn’t being updated to the clients properly because the data is local, not server data.

perfect! so i SOLVED this!
Thank you a lot , so for future googling for other people:
First i calculated spawn transform on client (in bp without any replication) and then i passed it to server to spawn projectile and it works.

Btw only last question, is this “bug”(dedicated server option) or it was my mistake by bad BP setup?

Unfortunately I don’t have a good answer for that. Depending on the setup it could have been as simple as a missing value or the server needing specific information to be passed through. I am happy to hear that it is working and will mark this as answered for tracking purposes.

Thanks for this. I spent half a day trying to work around this issue and your answer solved it for me in 2 mins.

(UE4.15.2) Just to help anyone having trouble with this in the future. Best than asking the client to send the position is to actually use the position of the socket on the Server to prevent cheating. The thing is, Dedicated servers don’t render the meshes, so skeletal meshes do not update their sockets or bones while not being rendered by default on the server part.

But there is this magic flag that allows you to set the skeletal meshes to actually refresh bones on update even when they are not rendered, just click on your Skeletal mesh component and scroll down to:

137458-skeletal.png

And these are the options, the first one is the one that allows you to do calculations without rendering…

Cheers.

3 Likes

Awesome! This one worked perfectly!

Worked like a charm! Thank you!

This worked for me too!

Thank you so much. I thought I was going insane here but this worked, and makes sense once I think about it…

Luiz, I love you, this worked for me too, but now we have to scroll down to (ue4.21.1)

:

Thanks a TON for this! I’ve searched a ton, and unfortunately this very prominent bug seems to be totally neglected.

Unfortunately this didn’t work for me. Dedicated server is still not getting the correct socket location. 4.21.1. Might be a return of this nasty bug!

yeah this doesnt work for me either. 4.21 as well. I cant downgrade because of another bug in 4.20. Im caught out…