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"

Why does my variable doesnt get replicated from the server?

Hey guys, I am trying to set a variable (the characters speed) on all players, so the animations play correctly for them. On the server, the variable has the correct value for all players, but the clients dont even get their own variable right, even though the variable is set to be replicated and therefore should be set to the servers value on all clients, right?

alt text

Product Version: UE 4.17
ue4error.png (250.8 kB)
more ▼

asked Aug 19 '17 at 06:53 PM in Blueprint Scripting

avatar image

38 3 9 15

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

2 answers: sort voted first

I will give u the answer but you also need to listen to Nachtmahr, because I think you are missing a bit of knowledge about networking.

So what you are doing right now is you are getting the velocity from the client side and the sent it so the server so u are getting a value that is not correct(because as you said it yourself: the clients don't get theyre own variable right). So what u need to do is you need to do is connect the vectorlength straight to the variable of the server(so plug it in after the event "setspeedonsv") and remove the parameter on the event because you don't need that one. You can also remove the "setspeedoncls" event because the variable is replicated and it comes from the server the variable gets automatically set on everyone.

Regards. Lex

more ▼

answered Aug 20 '17 at 12:09 PM

avatar image

16 1 2 6

avatar image yeswecamp Aug 20 '17 at 01:46 PM

Thanks a lot, I am pretty unexperienced in UE4 and only started learning about networking recently, so your help is really appreciated. But my problem is that if I execute the "velocity -> vectorlength" on the server for a client, it shows 0 because I dont have character movement set to be replicated (since it causes stuttering for the client) and I update the characters location/rotation every tick (thats how multiple tutorials told me to handle it).

So for the server, the players dont have a velocity, they are just getting teleported around, thats why I need to get the velocity from the client, and somehow send it to the server and get it replicated for all clients.

Am I completely misunderstanding how to approach replicated movement or is there any way to get a variable from the client to everyone else? Thanks in advance :)

avatar image Kwatskop Aug 20 '17 at 02:46 PM

Well, if u want to do it that way(Without replicating movement) then you need the input in the setspeedonsv event. but not the setspeedoncls because like I said the variable is replicated.

But I will give u a tip: 1. Please avoid replications on tick(What u are doing now) Because you are replicating multiple variables per tick, this can cause the client to diconnect and can cause lag. So I advice u to just use the movement replication and u can always smooth it out(Just search for some tuturials) Ofcourse replicating movement also causes multiple variables to replicate on tick but that happens in an efficient way.

Regards. Lex

Here is a screenshot of the networksmoothing(In the movement component) alt text

smoothrep.png (24.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Should cover all your Networking Questions (guess thats better than giving a straight Solution). You could also Download the Content Examples Project from the Learn Tab it has a whole section dedicated to Newtworking if you need something to look at.


Good Luck mate =)

more ▼

answered Aug 20 '17 at 06:23 AM

avatar image

7k 143 28 172

(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