Client-Side Physics Movement Not Replicating Correctly in Multiplayer


Hello everyone,

I’m currently working on a multiplayer project in Unreal Engine, where a client should be able to move a physics-based actor (a pawn with physics simulation enabled). While the setup works perfectly on the server, the client’s movements are not replicating properly to the server or other clients. Here’s a detailed breakdown of the issue:

Setup:

  1. Actor Setup:
  • The actor is a Pawn.
  • Root Component: StaticMeshComponent with Simulate Physics set to True.
  • Replicates and Replicate Movement are both enabled for the actor.
  1. Replication Settings:
  • The actor is set to replicate correctly:
    • Replicates: True
    • Replicate Movement: True
  • Physics Replication Mode is set to Default.
  1. Input:
  • I’m using Enhanced Input Actions for player movement.
  • Client inputs are processed, and a Run on Server RPC is used to send the movement request to the server.
  1. Server-Side Processing:
  • The server processes the movement by applying forces (using Add Force or Add Torque) to the StaticMeshComponent.
  • After processing, a Multicast RPC is used to sync the physics state to all clients.

The Problem:

  1. When the server moves the actor, the movement replicates to all clients correctly.
  2. However, when the client triggers movement (via input), the following issues occur:
  • The client itself does not move (no local feedback).
  • The server does not process the movement or apply forces.
  • Other clients cannot see the movement triggered by the original client.

Debugging Steps Taken:

  1. Input Validation:
  • The Input Action is firing correctly on the client.
  • The Run on Server RPC is also being called successfully (tested with Print String).
  1. Physics Processing:
  • On the server, Add Force and Add Torque are being executed correctly.
  • The server-side actor moves as expected when forces are applied directly (e.g., triggered by server input).
  1. Replication:
  • Actor replication settings (Replicates, Replicate Movement) are confirmed to be enabled.
  • Multicast RPC is called from the server but does not seem to reach other clients.

What I’ve Tried:

  1. Verified that the actor has Replicates and Replicate Movement enabled.
  2. Used Switch Has Authority to ensure that only the server processes physics.
  3. Tested different Physics Replication Mode settings (Default, Predictive, Interpolative).
  4. Added Print String at key points (e.g., RPC calls, Add Force execution) to trace the flow of events. Everything seems to work on the server, but the client’s actions don’t reflect.

My Questions:

  1. Why is the client’s input not causing the actor to move locally or on the server?
  2. How can I properly replicate client-side physics movement to the server and other clients?
  3. Am I missing something critical in terms of replication or physics setup for multiplayer?

Any advice, solutions, or debugging tips would be greatly appreciated! If you need further details or screenshots of my Blueprint setup, feel free to ask.

Thank you in advance! :blush:

You can only do a Server RPC from something you own. The client does not own these PropCha instances, so RPC calls from (actual) clients do nothing. Works on the server of course, because the server does own them.

You will need to move the RPC into your PlayerController, or Character.