Announcement

Collapse
No announcement yet.

Replication problem

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

    #16
    Sorry but there a A LOT of basic networking example out there (for example in my signature) and Epic made training videos about this.
    The basic networking and replication part is documented enough to understand it.

    As long as you guys don't post pictures and information about your attempts, i can only say that you're doing something wrong.

    You need to make sure that the actor you're trying to call RPCs on is set to "Replicate" and is actually owned by the Client (so the PlayerController of the Client is set as the owner).
    A possessed PlayerCharacter is owned by the Client, but you need to make sure that in the ClassDefaults, "Replicates" is set to true. If the Actor is not owned by the Client (for example
    spawned by the Server without setting the correct owner or just placing the Actor in the scene), then the "Client to Server" call will be dropped and never reach the Server.

    Then you need a replicated Variable. This can only be set by the Server. So the way @LazyLoading posted is correct.

    It doesn't have to be "RepNotify" if you don't want to do stuff when the Replication is done.
    "RepNotify" is only needed if you need a function that is called on the Client once the Replication is done.
    These are the "OnRep_" functions you see in the function list of @LazyLoadings pictures. They are created
    automatically once you set a variable to "RepNotify". But you might only need the normal "Replicate".

    If you print the Variable too fast it might still be the old value. Replication takes a really short time, but it's enough time to actually see old values of you are too fast.
    When the Numbers don't change at all, make sure that the P and O buttons are actually called (PrintString or Breakpoints) and then that the ServerPKey and ServerOKey
    are called (again, PrintString or Breakpoints).
    Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

    My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
    (Including 100+ Pages Multiplayer Network Compendium to get you started.)

    Comment


      #17
      Originally posted by eXi View Post
      Sorry but there a A LOT of basic networking example out there (for example in my signature) and Epic made training videos about this.
      The basic networking and replication part is documented enough to understand it.

      As long as you guys don't post pictures and information about your attempts, i can only say that you're doing something wrong.

      You need to make sure that the actor you're trying to call RPCs on is set to "Replicate" and is actually owned by the Client (so the PlayerController of the Client is set as the owner).
      A possessed PlayerCharacter is owned by the Client, but you need to make sure that in the ClassDefaults, "Replicates" is set to true. If the Actor is not owned by the Client (for example
      spawned by the Server without setting the correct owner or just placing the Actor in the scene), then the "Client to Server" call will be dropped and never reach the Server.

      Then you need a replicated Variable. This can only be set by the Server. So the way @LazyLoading posted is correct.

      It doesn't have to be "RepNotify" if you don't want to do stuff when the Replication is done.
      "RepNotify" is only needed if you need a function that is called on the Client once the Replication is done.
      These are the "OnRep_" functions you see in the function list of @LazyLoadings pictures. They are created
      automatically once you set a variable to "RepNotify". But you might only need the normal "Replicate".

      If you print the Variable too fast it might still be the old value. Replication takes a really short time, but it's enough time to actually see old values of you are too fast.
      When the Numbers don't change at all, make sure that the P and O buttons are actually called (PrintString or Breakpoints) and then that the ServerPKey and ServerOKey
      are called (again, PrintString or Breakpoints).
      I can understand you,

      I watched some videos and I'm doing same bp.

      But it isn't working,I will download a tutorial project about it.

      Comment


        #18
        Originally posted by SoloWarrior View Post
        I can understand you,

        I watched some videos and I'm doing same bp.

        But it isn't working,I will download a tutorial project about it.
        I know it's frustrating if it doesn't work. That's why we recommend beginners to first learn the Engine in SinglePlayer Games before moving to Networking.
        It's a whole new level and the learning curve is pretty high.

        Try to fiddle around with the basic replication. Watch Epic Networking Videos on Youtube and check out Games like BallBump in my Free Project or
        the Multiplayer Shootout of Epic.
        Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

        My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
        (Including 100+ Pages Multiplayer Network Compendium to get you started.)

        Comment


          #19
          Originally posted by eXi View Post
          I know it's frustrating if it doesn't work. That's why we recommend beginners to first learn the Engine in SinglePlayer Games before moving to Networking.
          It's a whole new level and the learning curve is pretty high.

          Try to fiddle around with the basic replication. Watch Epic Networking Videos on Youtube and check out Games like BallBump in my Free Project or
          the Multiplayer Shootout of Epic.
          I'm downloading sample projects,

          And I know engine basics,bp,animation etc.

          But,multiplayer is different.It affects all of them.

          Thanks for your helps.

          Comment

          Working...
          X