Networking replication only work in one direction (Server => Client)

Hi.

I made a little game with network only using blueprints.
The player spawn 2 time (because I have 1 client and 1 listening server with 2 playerstarts).
That’s ok.

But when I move the player on the server, I see it on my client. But if move the player on my client, the server does not see it. Any idea ?

I checked the vehicle sample and I have every checkox checked the same. (about networking)

TL;DR : Client see server’s player moving. Server doesn’t see client1’s player moving.

Thank you

Without posting code or blueprint’s it’s hard to tell what is going wrong.

In general clients can’t replicate anything back to server. Clients can only ask server to do something - RPC Function. Whether server will do it or not, is another matter.

If I open 2 clients in the Play network settings. It will open 2 window :

  • a client

  • a listening server

If I do this with a sample, no issue.
If I do this with my game, only the server player is replicate.

I don’t know which part of my blueprint or settings to show. I don’t know where to check.

In that case I have two advices:

Post everything.

Start with starter template, and work slowly from here. Try adding one things at time, and check how it works, to better understrand replication.

Networking in UE4 is fairly easy, but to get grasp of it, if never done such things before, you really should start from as simple as case possible.

Here is a screenshoot of a new blank project with just a custom player.
The server is seeing the client’s pawn moving. But the client does not see the server’s pawn moving.

Like iniside mentions, replication isn’t bidirectional.

If you want each client to be authorative of their own movement, you can make the client send positional data to the server. The server can then accept or reject this with or without validating the position data. This isn’t replication however, and replication only makes sense to be used in one direction since the server is the entity which distributes game state to all other clients.

According to this tutorial (- YouTube), it seems that you only need to check “Replicate”
The tutorial isn’t complete ? Maybe I miss a part ?

How to “make the client send positional data to the server.” ?
I have to keep the transform of the client in the server ? So I need to have a reference to the transform of the client’s player ? It looks very complexe

Can you post a link to the tutorial? I haven’t seen it.

You’d have to keep the transform on the server too, since after all things considered the server is still authorative of many other aspects of the game and it needs to replicate the position to other clients.

The client would be responsible for performing all the calculations and then it would send the results to the server. The server can then just accept the data and put the actor where the client told it, or the server can do a number of things. It depends on how secure you want it to be really. You could perform the same calculations on the server, but only so often… and then compare the results. Or you could just verify the distance travelled to see if it’s feasible to move that far in a single tick.

It sounds complicated. I’m not sure about Blueprints, but in C++ it would be quite trivial.

Hey Karton, I had the exact same issue. The problem is that certain behaviours can only be performed on the server. Moving an Actor around in the simulation MUST be performed by the server, otherwise every client in the game can cheat by moving wherever they want to without obeying your game design rules.

Have a look into “Custom Events” and how to make RPC calls in Blueprints.

These 2 tutorials were a massive help for me:

  1. Adding Networked Features to 3rd Person Template - Part 1
  2. Adding Networked Features to 3rd Person Template - Part 2

If you update your pawn to derive from the Character class, instead of the Pawn, then the network replication works as expected. Be aware that you also need to use the Add Movement Input, Add Controller Yaw Input, etc. and not update the components directly. Take a look at e.g. the “Third Person” template project, this uses the Character class and its ready made control methods.

I know this is a pretty old question, but I had the exact same issue and came here through Google. So, maybe this helps someone :slight_smile: