Hello all I’ve been working on an in-game building system for my survival game, and I need some advice! Right now the way it works is the client creates a local object, places it where he wants (using line trace) and then when the user clicks, it sends a request to the server to build the selected item. Right now when that happens, the server also runs a line trace from the character and that’s how it determines where to build the object. It would be a lot easier if I just sent the transform to the server, but I am afraid people will find a way to exploit that and edit it’s location. Is there a way to prevent that? My main issue with the line trace is that there are multiple “snap points” and I’d like to make a system if 2 snaps overlap each other, destroy 1 of them, but a different snap might be destroyed in server and client, creating rotation issues, and replicating isn’t really worth it since there are plenty of snap points in a world.
You can do both: Send the transform, then on the server verify that there is a free line that’s not too long between the player’s location and the desired transform.
Anything your server don’t validate can be exploited.
Also things you do validate can be manipulated depending on how you are validating them; you really only find out when you already have someone breaking into your game though.
I’d suggest you to implement double sanity checks: must pass checks from the client itself from different game modules and only then send to the server for the final approval.
Also make sure that the code you use to check and validate the action isn’t being built into the client.exe, or ppl can reverse and read it to learn how your server works, I believe that everything you code on unreal server is also packaged into client.exe unless you tell the compiler to not add that function to it ** using #WITH_SERVER defines **.
Thanks for the feedback! I didn’t even know about the #WITH_SERVER define, but I don’t think I will use it for now, I will let players host their own servers. I will have to find a workaround I guess, or just replicate all snap components, which is probably a bad idea.