Inconsistent Multiplayer Box/LineTrace results

Hey guys, I’m currently creating a multiplayer melee combat system and am having an issue with consistency of the line trace on a dedicated server.

**Issue: **Sometimes when I attack the box trace registers the hit fine and functions accordingly, often it doesn’t hit.

I am multicasting the boxtrace from a server call. I have a feeling that the box trace start and end location variables may be out of sync when functioning between the server and client but as I am new to this I am not sure! Everything when it does hit but it is inconsistent.
“Edit im fairly sure that it’s the line trace server-client call with it’s start and end location as when run on the server only then it’s performs perfectly”

Thank you for any advice!

I am multicasting the boxtrace from a server call … what??? why don’t you handle that from server, do you know how expensive that is ? :eek:

Though I have no XP with box traces I am not sure why… I never got them to work… neither I know how the work in core.

Thank you for the reply, so this should be handles through the server? Regardless when I use a box or line trace for checks that it still has an inconsistent hit rate from client to server (on server it works fine) Do you have any idea what this could be? It also might be due to using the timer by event? I’m abit lost right now with these, been trying to work it out for 3 days haha

I’m also confused as when I run it from a Listen server (non dedicated) The client to server function works 100%

Hi, first of doing several RPCs 100 times per sec and sending whole structs at this rate is really not good, that’s a fast way to break your network bandwidth =)
Also a box trace 100 times per sec is also not good for performance (might be better to use a couple of line traces instead).

if you want to debug your specific problem one way you could do it is to print everything that is relevant for the traces on the client and the server and see where the difference is.

Do you get different hit results on the server and client or is it that some RPCs from client to server or from server to clients get not executed? Cause if you have network bandwidth problems then RPCs might get dropped. To test this make all your RPCs there “reliable”. That means that if they get dropped due to network bandwidth then the computer will try to resend them until they get through.

Also regardless at what time rate you set your timer, it can never execute more frequently than tick. So if your frame rate would be 50 FPS and the timer should execute every 0.01s, then it will just execute twice per frame and then wait 0.02s then again execute twice, and so on. So if it is not your RPCs then this would be my next guess.

[HR][/HR]

In your case I don’t see any reason why you would want to sync the whole trace process between server and clients. If this is really game relevant then it might be easier to just do the whole logic on the server and then replicate the end result (or whatever information the client really needs) to the clients.

If it is not really game relevant then you could also just send one event to the clients to start the traces and one event to end the traces and execute all the logic locally on server and clients if that saves you network bandwidth compared to just do it on the server and replicate the final results from the server.
[HR][/HR]
So it seems to me that you would need to overhaul/rethink the whole logic cause if you have a couple of those at the same time then your network and CPU performance will break.

Hey! Apologies on the response, was away for a while. Your comment really helped me take a look at it all thank you.

I changed it to a single trace at the desired point during animation trigger and made two box traces; One which multicasts to display the trace on each client, and a box trace which happens in the client only and then passes the hit information into a server call event which then checks the actors hit and performs the desired functionality of applying damage on the server.

Honestly I don’t actually know exactly what the issue was still however I will definitely try and solve it using the timer by event function to check multiple line traces as initially desired however the system I setup now works well and does what is required :slight_smile: