C++ Calling server functions on client?

Isn’t the whole point of having code execute on the server to prevent “Hacker’s” so they cant edit the property’s, but unreal’s version of server only code is having it called by the client and executed by the client!?!. Am i missing something here or is this actually the case?

If it’s possible how do i implement code that is only executed on the server and called by the client. So the clients don’t have the file installed on there machine. Its only on the server.

Unreal is based on the concept of shared code but the execution is done on each side but holding full authority on the server. So the client code can be hacked but the server must remain the final authority about the action the client wants to execute. An example is the movement code, the client will simulate its movement and sending the actions to the serer which in turn does it’s own simulation and correcting the client if needed (it can detect speed hacks among others).

When a client calls a server function it is actually an RPC call to the server and executed there, the underlying logic of the call itself is often the same code so that the simulation driven on both sides match. This does not mean that the client couldn’t hack a value, for example if the clients sets the ground speed different to the server value than his simulation will be out of sync with the server simulation, the client will see itself jumping around due to the corrections or having issues when firing a gun.

What you want to do is to have extra functionality compiled out on the client but present on the server, you could do that by adding C++ preprocessor defines adding a module that is only added when creating your dedicated server builds. Make sure that the content matches on both sides, if not you wont be able to connect them together. Having only code on one side has another drawback that is that client side simulations are harder now because you have to code and maintain two versions of the code.