Announcement

Collapse
No announcement yet.

Non Dedicated Server - Server Replication Issue

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

    Non Dedicated Server - Server Replication Issue

    Currently working on the networking of my game. The issue I am having is that whenever the "server" character equips anything in the lobby, it equips it onto any players that join later. All the logic for loading is handled in character bp and attached components ; items,equipment . the game mode spawns and possesses the character bp actor.
    Last edited by FardreamStudios; 10-09-2018, 11:25 AM.

    #2
    Unfortunately the question you asked there is massively complicated (and confusing) and requires quite an in depth understanding of the server authoritative model for networking multiplayer content.
    I'm afraid giving a solution to your specific problem won't help overall with applying multiplayer elements to your game.

    I would first point you here https://docs.unrealengine.com/en-us/Gameplay/Networking and thoroughly study the contents therein.

    Then I would point you to a great Epic Tutorial HERE that explains replication in enough detail to set you well on the right track. Be careful of youtube tutorials about replication that aren't this official epic one, because most youtubers have no idea what they're talking about and they make it more confusing at the beginning.

    Also study this document thoroughly, keep it handy all the time. - Thanks to eXi for this fantastic learning aid.

    I get the feeling that you've followed the official "Blueprint Multiplayer Network Tutorial" series hosted by Wes Bunn. Please be aware that, while this tutorial may result in a working lobby system, you'll have been taught bad/incorrect things about replication and the way replication works during the course of these videos (sidenote, we very much appreciate the time and effort Wes did put into the tutorial series itself). See HERE for a detailed breakdown by community members where the specific problems are well outlined by very learned members of the Unreal Engine Community. Again, props to eXi for his work on this.

    Once you've done all that you'll be in a much better position to ask a more specific question I think.

    Sorry if it seems i'm being a bit straightforward regarding this question, it's just that there is so very much involved in networking a multiplayer game, even though Unreal Engine makes it very much easier than alternatives, it's still very hard to grasp the concepts when starting to learn the ins and outs. That said, don't get discouraged as there is a light at the end of the tunnel

    Consider using the PlayerController class. (this is also the class that Possesses pawns/characters)

    Keep in mind also that when testing in PIE everything usually runs smoothly for the listen server player because it is the authority (which means it doesn't need to call RPC's correctly necessarily when trying to communicate with its own client)
    When testing make sure you check that the clients all behave the same for the functionality you're testing. (try set 2-3 players, one as listen and run as standalone game, if the clients are faulty in executing code as expected you'll need to focus specifically on using RPC's, aka "Run On Server"/"Run On Owning Client" events).

    Edit: Sorry i just noticed the screenshots . The reason it's equipping on every player that joins is because you're using an OnRep function that will fire on every client that joins, this is the expected and desired behavior from a variable set to RepNotify. In order to stop it occuring on subsequent joining players, you could try the following.
    Insert an if statement and check if the new player's Playerstate Class is equal to the Playerstate class of the player you're targeting (in this case, the server)
    In the false case just bypass the equipping function.
    This likely won't be a useful solution if things start to get a little more complicated (like trying to equip items on a client machine), though.

    I hope this helps/motivates/points you to a useful place (and hopefully doesn't stress you out on the topic).

    If anyone spots faulty understanding by me (very likely ) please do let me know so I can make corrections where necessary.
    Last edited by GrumpyNZ; 10-10-2018, 07:46 AM.

    Comment


      #3
      Branch and "is local controller" may be a thing to use often when you are working on multiplayer games,

      Comment

      Working...
      X