0
\$\begingroup\$

I have an UParticleSystemComponent attached to ACharacter. Its activation is controlled by user input, so it receives several updates per second.

For replicating the activation state of the particle system, the user input triggers an update of the value of a replicated variable (UPROPERTY(Replicated)) on the ACharacter. This works fine for the direction

  • Listen server -> Clients,

however not for the directions

  • Client -> Listen Server
  • Client -> Client.

I assume this is the case b/c "Property updates only come from the server (i.e., the client will never send property updates to the server)".

So for Client -> Client replication I have to rely on RPCs and can't use property replication at all?

\$\endgroup\$
1
\$\begingroup\$

In order to replicate properties, you need to replicate the actor holding the properties. In Client/Server, the server is simulating the behaviors of all the replicable actors, then sending updates out to clients. So you should use Broadcasts (Run on Server not Run On Owning Client or Multicast) to send input to the server, which then acts on receiving the broadcast.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ So a mix of server RPC (Owning Client -> Server) and replicated properties (Server -> all clients). Remains the question, if it's cheaper for the second step to use an unreliable NetMulticast instead of replicated properties (three floats). \$\endgroup\$ – Roi Danton Mar 30 '18 at 20:57
  • \$\begingroup\$ The server RPC + replicated prop method works better than server RPC + multicast RPC b/c for the replicated prop I can set COND_SkipOwner which I can't for RPC. So answer accepted. \$\endgroup\$ – Roi Danton Mar 31 '18 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.