LineTrace Problem

Hello, I’m here to help with a small multiplayer project. To sum up:

  • I have a line trace that triggers when an AnimNotify is activated in my anim montage.
    -the line trace does damage in cast to pnj (my pnj).
    problem: in rpc Run on server to multicast and also in run server to owning client, I can’t do any damage on the client side with my line trace, sometimes the trace called by the client executes on the server, I’ve corrected this now the client trace doesn’t do any damage (certainly because apply damage isn’t run on server) but how do I do this in my configuration? I’ll put the screens on for you.
1 Like

Hi,

Line trace and damage dealing should all be run on the server, client defacto should trigger the line trace, but never run it - it should belong to server

This should help you out - just swap spawn object for line trace https://www.youtube.com/watch?v=dKkssm6D4RU

1 Like

I’d break it up into proxy events.
On the client (autonomous) the anim_notify triggers fx and audio.
On the server (authority) it executes the trace and applies dmg.
On simulated proxies (sims) it executes fx and audio.

determining proxies…
For Client
Is locally controlled or (get local role == autonomous && Is Server NOT)

For Server
Is Server OR Is Dedicated Server

For Sims
get local role == Simulated Proxy

hello , in this configuration the line trace is done on the server side , but the client when it interacts the line trace, appears on the server player side.


any ideas ?

That’s correct, it should only appear on the server side, the damage, and other effects should be triggered by that line trace, and then replicated to the server

All Editor debug functionality (print string, traces, debug shapes etc) will be shown on all clients. That’s a part of the debug system.

For trouble shooting you should assign specific colors for each proxy. This will easily clarify what’s happening and who’s doing what.

I have Begin Play functionality that sets a Proxy Role (enum) variable and a debug color in my projects. Simplifies troubleshooting.

On Listen Server the Hosting Client is the server. Their debug color would be purple. All other clients would be red and Sims orange.


Clients Do Not, nor Cannot Replicate data. Clients can Send data to the server via RPC’s, but they cannot send RPC’s to other clients.

Replication is always Server -> Client

Damage and or any other Gameplay altering mechanic should be strictly managed by the server.

The Server calculates and applies damage via a health deduction on the servers authoritative copy of the health value. It replicates the changes to all connected clients.


Attacking client would play local only hit fx etc and only send a single RPC to the server to have it “TRY” to attack.

The Server would first check if it can attack, if so execute the attack, then multicast to SIMS to simulate an attack.


My “Preferred” approach is more granular. It uses dedicated functionality per proxy vs bloated conditional checks.

Compact variant

Your line trace should be run as server

Also check out this Network Compendium

All proxies should be running traces to reduce network footprint.

Attacking client needs them for localized hit fx…audio and visual.

Simulated proxies needs them for localized hit fx… audio and visual. If they aren’t reproducing the same hits as the server then there’s something wrong with the overall simulation. Outside of Floating Point Precision errors they should be getting roughly the same result.

Server needs them for dmg. It itself should not have to replicate anything beyond telling the hit client to play FX.

Player Health is a player state replicated value. It should be a RepNotify. The OnRep Function would update the hit clients UI.

The Apply Damage event on the server can call an event (On Owning Client) to execute the needed FX chain.