Announcement

Collapse
No announcement yet.

Replicating animations to server and all clients

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

    Replicating animations to server and all clients

    Hi, I'm currently playing around with multiplayer in UE4 but have run in to an issue and I'm not sure why it's not working as it should.
    So I've got a video showing the issue with the server on the left and the client on the right.

    The first section of the video shows the server and the client equipping the weapon. You can see this from the weapon moving from the belt to the hand. So the left screen equips the weapon and it happens on both screens. The right screen equips the weapon and it happens on both screens.

    The second section shows (at about 0.36) shows both the left and the right screens activating the weapon but it doesn't show on the other screen.



    Here is the blueprint for equipping the weapon:
    Click image for larger version

Name:	EquipFlipflop.PNG
Views:	1
Size:	131.8 KB
ID:	1168984

    Here is the blueprint for activating the weapon:
    Click image for larger version

Name:	Activate.PNG
Views:	1
Size:	146.5 KB
ID:	1168985

    As you can see they are both the same. I have tired executing the LMousePress_Client event as "multicast" and "run on owning client".
    When it's set as "run on owning client" it only shows on the screen that activated it.
    When it's set as "multicast" it shows both on the left server screen.

    Why isn't this working? Am I missing something obvious or going about this the wrong way?


    Thanks
    Last edited by AutoLiMax; 12-21-2015, 05:51 PM.

    #2
    OK I found out that I have set it up correctly. The problem was a bool that I didn't include in my previous post.
    Here is the BP for activating the weapon with the Problem causing bool:
    Click image for larger version

Name:	BladeActiveBool.PNG
Views:	1
Size:	170.4 KB
ID:	1097383

    The bool is right as the end of the script. If I remove that bool the animation works as it should.
    I think its because a branch checks to see if the "Blade Active" bool is true or false and if its false it sets it to true all in the same sequence.

    The problem I'm faced with now is getting that bool set to true after the animations played.

    Any one have any ideas?

    Thanks

    Comment


      #3
      AnimNotifies are your friend, should be pretty easy, failing that as a placeholder you could put a timed delay node and just set it after that.

      Comment


        #4
        Yeah its an annoying issue with replicating variables especially bools, across the network sometimes they are set true and false in the same frame or packet being sent effectivly cancelling each other out so sometimes nothing will happen other times you might get some animations playing but not others. I had this problem with a combo system using a switch on int and bools where it should have played 3 different attack animations one after the other but on the server and owning client everything was fine on the other clients the animations.would just randomly jerk and switch around.

        Like suggested above you just have to find workarounds like using anim notifies, delay nodes timers etc if its only switching between 2 animations you can use a flip flop, a do once or sometimes a sequence but its all just a case of trial and error .

        Unless im wrong and other people have a fix or solution ?? i will be interested to watch this thread and see the responces
        Last edited by EniGmaa; 12-22-2015, 03:24 AM.

        Comment


          #5
          Originally posted by AutoLiMax View Post
          OK I found out that I have set it up correctly. The problem was a bool that I didn't include in my previous post.
          Here is the BP for activating the weapon with the Problem causing bool:
          [ATTACH=CONFIG]71021[/ATTACH]

          The bool is right as the end of the script. If I remove that bool the animation works as it should.
          I think its because a branch checks to see if the "Blade Active" bool is true or false and if its false it sets it to true all in the same sequence.

          The problem I'm faced with now is getting that bool set to true after the animations played.

          Any one have any ideas?

          Thanks
          Is LS_Equipped bool set via server-multicast event? or is it being set on the client only? post a screenshot of where you're setting that bool. You could try moving the LSEquipped branch or even both checks outside the MC event. Put it immediately after the Left Mouse Button pressed, before the LMouse Press Server event.
          Snap-In Systems: <<< CLICK
          | Inventory (Battle Royale) |Smart Select Box | Ready Game Modes | Handy Macros | Gun Weapon System |Simple Mesh Outliner |

          Comment


            #6
            Hi guys, Thanks for getting back to me. Only just got in from work so I have had a chance to reply. The delay seams to have worked in this instance but I'm worried if ping or other factors could affect this? I've previously tried using Anim Notifies to to fire off traces at specific points in an animation but I couldn't get my head around it so I ended up using delays in between traces.

            Here is the rest of the Equip section.
            Click image for larger version

Name:	EquipFlipFlopFull.PNG
Views:	1
Size:	296.2 KB
ID:	1097431

            So when F is pressed the weapon is equipped or unequipped via a FlipFlop.
            FlipFlop "A" attaches the weapon to the to the right hand socket, Sets the LS_Equipped bool (which is replicated) to true and then changes the anim Blueprint to the appropriate one.
            FlipFlop "B" checks to see Blade_Active bool (which is replicated), If true stops a sound and If false it skips stopping the sound. It then attaches the weapon to the belt and sets the LS_Equipped bool to false, Plays the blade deactivate animation, Then sets the Blade_Active bool to false and then changes the anim Blueprint to the appropriate one.

            I'm just attempting to set the LS_Equiped branch to run right after the mouse click instead of using the delay.

            This is my first try setting up a multiplayer game so I don't fully understand it. Also I've just noticed Iv'e misspelled Equipped in my BP.

            I'll let you know how it goes but if I'm not going about this the correct way then let me knowww!

            Thanks

            Comment


              #7
              So adding the branch right after the mouse click does not fix the issue. It looks like I'm stuck with using short delays. Unless someone would like to talk me through anim notifies?

              Thanks!

              Comment


                #8
                AnimNotifies are really easy - basically just right click on the bar that appears above the timeline but below the animation preview window, and it will let you make a new one, give it a name, then you can go into your AnimBP and it will appear as an event. The event will fire when the animation hits the point on the bar where the AnimNotify notch is at.
                Storyteller - An immersive VR audiobook player

                Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                Comment


                  #9
                  ahhh so I can set the bool as true or false in the anim BP instead of the character BP and not have the delay?

                  Thanks

                  Comment


                    #10
                    Also I'm guessing this is why I was unable to use anim notifies before. I was trying to find them in the character bp and not the anim bp.

                    Comment

                    Working...
                    X