Hello DevForum. I have a problem with the NetworkOwner and Performance. I don’t find a post talking about my problem so here it is.
Never trust the client gave me this problem about security and performance. I have to choose between two options when setting the NetworkOwner and being sure that I don’t trust the client
Option 1: Set the car’s NetworkOwner as the server and experiencing latency as the driver Option 2: Set the car’s NetworkOwner as the driver and checking car’s movement every frame in the server to prevent exploiters.
I want to know which option is the best in terms of performance since I’m worried about my game performance and game experience and… Can you explain why please? (Experience hehe…) (Sorry if this post is in the wrong category, I’m not sure which category this post belongs).
I think it’s better to let the client determine the physics of the car, but I don’t think you should check it every frame. Checking it periodically is enough, having the server checks the car’s movement every frame is probably worse than just letting the server handle the movement.
Have the client simulate the car’s physics in order to reduce server latency and ruining the general experience. It’s also important to give the client instant feedback as we can all agree that delayed input leads to a less enjoyable experience.
As @0msh said, periodically check the car’s position with its last recorded position. You can use the distance formula d = st (Distance = Speed * Time) and check if the car traveled a reasonable distance within a certain amount of time. The amount of time would reflect your judgement on how often you sanity check the car’s position.