Network: Communication between clients don't work correctly

Need help!

Only clients like 2 and 3 see the movement of the charakter actor in the server client(dedicated Server).
Also the clients don’t see the actor movement mutally.
And only the pickupable actors disappear in the server client.

Thanks for help:)

Charakter settings 1

Charakter overview

Host script

Charakter settings 2

246869-2.png

Join script

Your session logic and character settings are probably fine.

I think the problem must be with how you are handling the interactions and movement, so we need to see your code for those parts.

Remember a replicated actor has to change on the Server for the change to replicate to clients, and if the actor is not Relevant for replication when the interaction happens, some clients will miss it unless they receive a repNotify later (and that’s okay for most interactions), but they will still receive the variable update once the actor becomes relevant to them again (in range).

So make sure things that spawn or destroy actors that need to have the spawn or destroy seen by other clients, all happens on the server side. You have to make sure of this on your items too, not just your character.

Do you mean i have to replicate all actors?If so, I already did that.

I send more code…

8.png
247139-


247141-247142-

I can’t see it

Oh. i’ll send it again.

Here are more code…

And here the rest…

Is the character not moving at all, or is it just missing the rotation?

When it comes to the pickup-actor, there’s a couple of things to keep in mind:

  1. Your actor needs to have “Replicates” enabled in the Class Defaults panel.
  2. Whenever an actor overlaps with your “PaperSprite”, the “On Component Begin Overlap (PaperSprite)”-event will execute on the server and all clients.

In order to make your pickup-actor work in multiplayer:

  1. Enable “Replicates” in your pickup-actor’s Class Defaults panel.
  2. Make a new custom event, call it whatever seems the most relevant to you, and move the logic from your “On Component Begin Overlap (PaperSprite)”-event to this new custom event.
  3. Then set the “Replicates”-variable of your custom event to “Multicast”. This means that the event can only be executed on the server and when it does, it will tell all the clients to execute it as well.
  4. From “On Component Begin Overlap (PaperSprite)” drag out and connect it to a “Switch has Authority”, which leaves two outputs, “Authority” and “Remote”.
  5. From “Authority” call the custom event.

Your pickup should now work seamlessly in multiplayer. As far as it comes with the movement, I am not entirely sure how to solve it, apologies ;(

If you still don’t understand the concept I would highly suggest you look into [this][1] tutorial, more specifically the “Function Replication” part. Hope this helps! :slight_smile:

Here’s a picture which quickly illustrates what I’m explaning:

For your pawn movement on the network, I see you are not using a child class of Character.
That means your movement will only replicate from server to client, not client to server.
To fix that, you euther have to make a new pawn class that is based on Character, or every movement you do needs to send a Server RPC to move the same amount, and you might have to also send a Multicast drom the server out to all the oter clients so they can see it too (maybe not. but try it if the client can move themselces on the server but the other clients dont see it)

so you have to choose: use a character blueprint type or add your own movement RPCs,
because wverything but Character classes will only replicate movement or anything else from the server to the clients and not the other way around, by having variables marked Replicate and the Replicate Movement checkbox ticked.

Thank you for your help.

I tested out to make a charakter blueprint class and the network movement works…but how I can set up the charakter to an 2d charakter?Because default the charakter blueprint is for 3d charakters…I don’t need the capsule and mesh component, but i can’t delete these compoment because they are inherited.

Can you send what a code looks like to the other method?
Because I don’t know what exactly is to do.

Thank you for your help.

I try whether it works:)

If 2d character is inherited from base Character class it should work the same in network I think. It has a CharacterMovement Component right?

Yes it’s right.

But I have a new problem. The joypad of one client moves the character of the other, but the keyboard control moves the right one and the other one works properly.

Unreal by default maps gamepad 0 to player 0, even though player 0 already has keyboard and mouse. You can change this by setting the Number of Players in PIE options to 2 and ticking the checkbox to map first Gamepad input to second player. I think it still stays that way even if you reduce the number of PIE players back down to 1.

Oh but I re-read your question and see that it’s just behaving normally if you have two standalone instances or packaged instances of the game open on the same computer. gamepads get mapped to the same player 0 on both instances of the running game when they’re on the same computer. So gamepad 0 goes to player 0 in BOTH windows. This is not a problem when you have two computers running it because they will have separate machines, and separate gamepad 0s, so gamepad 0 on machine A will not affect gamepad 0 on machine B.

Thank you for your help:)