UPDATE 12-06-2021Problem Solved
To fix: On your skeletal mesh component of your character, set Anim based visibility option to Always Tick Pose and refresh bones
Special thanks to KaosSpectrum#0001 on Discord for figuring it out, and thanks to everyone else who tried.
Hi,
• 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.
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?
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.
UPDATE 12-06-2021Problem Solved
To fix: On your skeletal mesh component of your character, set Anim based visibility option to Always Tick Pose and refresh bones