Announcement

Collapse
No announcement yet.

Replicating MiniGun barrel rotation in multiplayer

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

    Replicating MiniGun barrel rotation in multiplayer

    Hi Guys, I'm gonna need some help.

    The problem is with replicating SkeletalMesh components of an actor which is attached to my character.

    I have a weapon pick-up system in my simple multiplayer shooter that works, it is done through an overlap event>spawn actor from class>Attach actor to actor, this is all replicated.
    Click image for larger version  Name:	4.jpg Views:	1 Size:	564.1 KB ID:	1588213

    After the Pick-Up has succesfully happenend, InputAxis is used to cast to my MiniGun BP, this is done as follows.

    Click image for larger version  Name:	1.jpg Views:	2 Size:	505.6 KB ID:	1588215

    The CastToMiniGun function looks like this:

    Click image for larger version  Name:	2.jpg Views:	1 Size:	59.1 KB ID:	1588216

    And lastly, the MiniGun Actor BP looks like this (temporarily, I need to clean this BP up once i understand how to fix this issue)

    Click image for larger version  Name:	3.jpg Views:	2 Size:	481.9 KB ID:	1588217

    In the last picture you can see the PullTrigger, ReleaseTrigger and Fire events, I think the problem is here.
    I have tried to run these events on server only, and then use a second event that multicasts.
    Also I have tried setting replication on and off on the weapon actor root and its constituent components.
    Ignore the BarrelFlash for now, I need an emitter for that.

    All I have accomplished is Server-Client replication, but that is easy, can anybody help me with this, much appreciated

    Note: I understand blueprinting a multiplayer game is limited, I am still learning the engine and what I can, and cannot do with BP.
    When I have a complete product, I might learn C++ or pay somebody to do some work for me, as off now, I seek BP solutions only.
    Attached Files
    Last edited by SkipJack_NL; 02-24-2019, 07:12 AM.

    #2
    There is no clear indication of what is being run on the server and the client in what you are showing. It would appear that you are spawning the weapon on both the server and the client. Client spawned weapons can't do any replication whatsoever so all input done by the client will never be picked up by the server.

    Is there any particular reason why you don't just use the server weapon reference and give that to the client instead of spawning a new weapon?

    Don't worry about C++ yet unless if you wan't to extend an existing Class. If you just want to add your own multiplayer game-play mechanics I can't think of anything that can't be done in Blueprint.

    Comment


      #3
      Originally posted by GarnerP57 View Post
      There is no clear indication of what is being run on the server and the client in what you are showing. It would appear that you are spawning the weapon on both the server and the client. Client spawned weapons can't do any replication whatsoever so all input done by the client will never be picked up by the server.

      Is there any particular reason why you don't just use the server weapon reference and give that to the client instead of spawning a new weapon?

      Don't worry about C++ yet unless if you wan't to extend an existing Class. If you just want to add your own multiplayer game-play mechanics I can't think of anything that can't be done in Blueprint.
      I see what you are saying, I must spawn the weapon on the server, if then the inputs are handled by the server too, all movement should be replicated by ticking the "replicate movement" box. I will try this and report back.

      Comment


        #4
        I figured it out, I moved the spawning of the weapon to the actual PickupCollisionComponent BP and ran everything from the server.
        Now the barrel rotation is properly replicated, I have tested this with 3 clients and it works.
        I am looking for a more elegant solution to run the "WeaponOffset" function (see screenshot), if I run it from the authority node it will only be run on the server, so I used a delay from the remote node.

        Thanks GarnerP57!
        Click image for larger version  Name:	1.jpg Views:	1 Size:	151.3 KB ID:	1588745
        Last edited by SkipJack_NL; 02-25-2019, 04:24 PM.

        Comment

        Working...
        X