How am I able to Replicate movement when using "AddMovement Input", but not AddLocalTransform?

I can clearly see that AddMovement Input is the better way to move a box around, but I’m looking to understand why LocalTransform doesn’t replicate.

I’m only moving a box forward and backward in this small example.

Here’s each Blueprint script:

Both the client character and server character move just fine when I use the below script:

http://puu.sh/7ZR4r.jpg

But in this next script, I can only move the character on the server instance. The client character jitters when I try to move, but the server seems to be keeping it in place and not allowing it to move.

http://puu.sh/7ZR6n.png

For trivial purposes, how can I have LocalTransform replicate (enable the client to move)?

Thanks!

I am very confused about the purpose of “Switch has Authority”. I have the editor configured to spawn a dedicated server with 2 clients, but each client apparently “Has Authority”. My impression is that only the server would have authority, per the explanation in “A Crash Course in Blueprint Replication - Unreal Engine”.

Nevermind, it seems the “Print” function used in blueprints prints to all clients and the server. Printing wasn’t a good way to test that condition.

I’m understanding most of this now.

Replicating a blueprint variable only replicates that variable from server to client. You need to define an RPC function that the client calls on the server and pass whatever values that you want replicated from the client to the server.
Here is the blueprint logic:

http://puu.sh/80s7z.jpg

I guess my last question would be:

Replicating an actor does not automatically sync the actor transforms? It seems that “Add Movement Input” is replicating the input and executing the input on the server, where as actor transforms are not automatically replicated when modified. Is this correct?

Confirmed. I think it’s because the actor is replicated, so the print function will print everywhere automatically.

Replicating an actor does not
automatically sync the actor
transforms? It seems that “Add
Movement Input” is replicating the
input and executing the input on the
server, where as actor transforms are
not automatically replicated when
modified. Is this correct?

We automatically handle replication for you from client → server for movement input. The simulation happens locally on the client and the acceleration/input values are sent to the server for the simulation to occur there as well.

However when you try to simply set the client’s location (only on the client), the server doesn’t know you tried to do that, and it will think the client is out of sync and send a position correction to the client to fix it up (the jerkiness you saw).

There are a few ways to approach this:

  1. If the teleport on the client is caused by player input, move locally and then use an RPC to the server to do the same thing.

  2. If the teleport is caused by an interaction w/ the world (a volume for example), you can have the volume trigger only on the server which will then correct the client’s position as well. Or you can simulate the change on both client and server, so the client doesn’t have to wait for the server’s correction (reducing perceived latency).

  3. There is a config option for “ClientAuthorativePosition” [sic, I know it’s misspelled] on the GameNetworkManager that changes the rules: the server will accept client movement as authoritative and not force a correction if it’s within a squared distance (MAXPOSITIONERRORSQUARED) from where the server last saw it. So in this case, the server would warp the character to where the client tried to move, and the client’s position is the authority. The server can still replicate movement to the client normally, this just handles rogue client movements.

You set this in your game ini settings:

[/Script/Engine.GameNetworkManager]
MAXPOSITIONERRORSQUARED=625
ClientAuthorativePosition=true

for my project I need a constantly updated float variable to be replicated to set an aim offset. I have tried countless different ways of setting this up but none work.

the custom event “look” is powered by the main tick and is not replicated.

the variable “camera rot” is set by the tick to the relative rotation of the camera arm.

all variables are set to replicate

the custom event “update look angle” is set to “run on server”

what am I doing wrong?

This is my setup and it seems to work for now, but i think that this is pretty bad workaround :stuck_out_tongue: http://i.imgur.com/2qYazTZ.png

  1. There is a config option for
    “ClientAuthorativePosition” [sic, I
    know it’s misspelled] on the
    GameNetworkManager that changes the
    rules: the server will accept client
    movement as authoritative and not
    force a correction if it’s within a
    squared distance
    (MAXPOSITIONERRORSQUARED) from where
    the server last saw it. So in this
    case, the server would warp the
    character to where the client tried to
    move, and the client’s position is the
    authority. The server can still
    replicate movement to the client
    normally, this just handles rogue
    client movements.

You set this in your game ini
settings:

[/Script/Engine.GameNetworkManager]
MAXPOSITIONERRORSQUARED=625
ClientAuthorativePosition=true

we cant have our pawn locally controlled if we check the box “movement replication” because the server will correct our client position every time we try to move locally…

but then you said we can make the client authorative on his position, this still work? i cant find any game ini at all

i just found a DefaultGame.ini and i tried to put those line inside it, but this dont work, client isnt authorative, or i did something wrong but cant find what

if someone know how to force client to be authorative, tell me pls :), where to find this game ini settings file?