Download

Replication best practice? - Soccerball Multiplayer

Hey guys,

Its my first month of using Unreal Engine. Im trying to create a simple Multiplayer Soccer game.
There is one thing I cant seem to make work and I need some help/input of whats the best way to do it.

So Each player controller controls a character,
When the character starts shooting I have a “Kick Vector” Variable which I save and replicate.

After its charged I cast to the ball to execute the function get Kicked with the Kick vector variable attached

The function simply enables physics and adds an impulse as strong as the kick vector.
This is (in my head) should be executed on the server and then cast to the players so there are no sync issues.

Everything works fine when the listen server is the kicker. But on the client side, the ball is kicked for a frame and then “snaps back” into position as if there was no force applied.
I have all variables replicated which are used in the process, and I call the “Get Kicked” Event on the server as well as the clients.
Any Idea what Im doing wrong?

Thanks in advance

[IMG2=JSON]{“data-align”:“none”,“data-size”:“full”,“src”:“https://forums.unrealengine.com/core/image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==”}[/IMG2]​
InsideCharacter.png

EDIT: Seems like I found an Issue. To Calculate the direction of the shoot Vector I use the Input Axis. I thought I could Replicate those as variables but seems like the Server can never see the clients Input.
However, Should the client be able to calculate using his own values to a finished “Shoot vector” and then send the result to the server?
I dont get what Im doing wrong.

I often read the “owner” could be the issue, but I can send RPCs for other stuff just fine. Just the maths for the Vector dont workout…

This should happen on server side, then make a run on server, Because the soccer ball location it is already replicated… Do you want to add me and I show you how to replicated the rigid body location?

Neonerone#6731 discord… :cool: