Announcement

Collapse
No announcement yet.

The problem with replication of a variable.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    The problem with replication of a variable.

    As you can see in the first screenshot, I set the random value to a variable, but if I look from the client (the second screenshot), the variable has a different meaning. Why?
    The variable is set once, there is a switch, which does not allow to do this on the client. The error is called randomly. It can synchronize the value 10 times, but maybe 10 times - no.
    I also want to note that if you put a small range at a random node, then on the client in this variable there are values that go beyond this range. As if there is some kind of distortion during replication.
    The change is written once, and has zero values by default. I also tried to set a delay before setting the variable (anything can happen), but it did not help.
    You can play it in any actor on stage.
    Last edited by RuTzoT; 03-24-2018, 05:48 PM.

    #2
    Check if it's generating the value again on the client version. If you run a Print String after you set the "Test Rotation" variable, it'll tell you if a separate random number is generated, so it would never be the same as on the server.
    Kind Regards,
    Binkadin.

    Comment


      #3
      Binkadin As you can see, nothing is generated on the client. And since the variable is replicable, clients should see its value that was generated only on the server.

      Comment


        #4
        Of course. After all you say to the server to take that variable so only the server will generate the variable

        Comment


          #5
          Hey, I've noticed something really weird. Are you getting a pattern for these numbers? For example, if I generate 80 on the server, it'll generate 280 on the client. If you add the server variable and client variable, it'll make 360. It's really weird, but you could write a function to counteract that.

          EDIT: Apparently this has been a bug since 2015 (https://answers.unrealengine.com/que...on-client.html).
          Last edited by Binkadin; 03-25-2018, 08:47 AM.
          Kind Regards,
          Binkadin.

          Comment


            #6
            Binkadin
            Yes, I have the same thing. The value is correctly generated on the server, and after replication to the client, it seems to be subtracted from the 360, and displays this value. Thank you for providing a question on the answerhub, I understand this error entered in the bug report, but so far it has not been fixed. I still did not understand how to get around this mistake. What did you mean about writing a function? Transfer variable through multicast to function? If yes, it still does not help.

            Comment


              #7
              Siengried
              Yes, but the problem is with the correlated display of it on the clients.

              Comment


                #8
                Originally posted by RuTzoT View Post
                Binkadin
                Yes, I have the same thing. The value is correctly generated on the server, and after replication to the client, it seems to be subtracted from the 360, and displays this value. Thank you for providing a question on the answerhub, I understand this error entered in the bug report, but so far it has not been fixed. I still did not understand how to get around this mistake. What did you mean about writing a function? Transfer variable through multicast to function? If yes, it still does not help.
                Well, I think that you should write a function to convert it on the client.

                You could do something as simple as 360 minus the value received from the server. That should give the client the same value that the server is holding.
                Kind Regards,
                Binkadin.

                Comment


                  #9
                  Binkadin
                  The decision was obvious. I thought if the problem is only with the variable rotation, then why not replicate the float variable that generates the value for Y (Pitch) on the server? With her, everything is fine
                  In general, thank you very much, suffered a few days thinking that the trouble is in the code, until I noticed that there is an incorrect replication.

                  Comment


                    #10
                    Ah, I did think about replicating the float instead.

                    I'm glad you've solved your issue now.
                    Kind Regards,
                    Binkadin.

                    Comment

                    Working...
                    X