Download

Multiplayer setup for coop game without movement replication

Hi all,

I’m working on a first person coop prototype and both players will never meet ingame (yeah, I know it sound strange in first place) so I need no player/pawn movement replication. I just want to update states/variables from server to client and vice versa.

For example a light switch -> on/off (bool). With repnotify it’s no problem to update the client when the serverplayer toggles the light but it doesn’t update on the server when the clientplayer toggles the light. :frowning: Hope someone can give me a hint!

Cheers Daniel

Hi, variable replication only works one way, from the server to the clients. If the client want to tell the server something, then you can only do that via a “RunOnServer” RPC. That event will be called from the client and executed on the server. Then you handle all game relevant logic on the server and use replication to let the clients know about the results.

It’s the same problem. The server updates the client but the client doesn’t do anything! What am I doing wrong? Maybe it’s a problem with the* **(if owning client) ***thing?

On the second image you can see the blueprint and the repnotify variable/function and on the first image you see my the server and the client viewport (just a quick reminder: they are on different locations because the movement replication is deactivated)

The only client that can call a “RunOnServer” RPC, is the client that owns this actor. Theoratically you can dynamically switch the owner of an actor, but imho that is bad coding style. I would keep movement replication of your characters, then “Event ActorBeginOverlap” would also be called on the server and you would no longer need any “RunOnServer” RPC there. If you do not want the player to be visible to each other, then set “only owner see” to true on the mesh, then they won’t see each other. And if you do not want them to collide, then use a new collision type for the player capsule and let the player capsule ignore this collision type.

Ah. I see. Yes, I will stick to the movement replication. Thank you for your help chrudimer! :slight_smile: