x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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!

Product Version: Not Selected
Tags:
more ▼

asked Apr 07 '14 at 07:31 PM in Blueprint Scripting

avatar image

Twinfun
76 5 8 9

avatar image Twinfun Apr 08 '14 at 03:07 AM

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 "https://www.unrealengine.com/blog/crash-course-in-blueprints-replication".

avatar image Twinfun Apr 08 '14 at 03:42 AM

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.

avatar image Twinfun Apr 08 '14 at 05:31 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

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

more ▼

answered May 05 '14 at 05:45 PM

avatar image

zeroexception STAFF
1k 18 16 39

avatar image The Cheese Dragon May 16 '15 at 05:23 PM

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?

alt text

capture.jpg (121.3 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

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?

more ▼

answered Jan 16 '16 at 12:35 AM

avatar image

skeleton60
620 42 59 88

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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?

more ▼

answered Apr 08 '14 at 05:16 AM

avatar image

Twinfun
76 5 8 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Jul 06 '15 at 07:28 PM

avatar image

GregFTW
46 1 7 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question