They're just network messages.
The server sends a message to the client, when the client receives the message it calls a function. It's that simple.
RPC is short for Remote Procedure Call.
On entities you can mark a function as an RPC:
Here, "Client" tells us that this method should only ever be called on the client.
So, if you're on the server and you do this:
It gets called on the client version of the entity. We've done some magic in the background.
You can also use RPCs on static classes.
This can then be invoked from the server using
We have a problem with the above example. We wouldn't want to show the death screen to every player. We'd want to show it to just one.
The code generator has got you covered, it's created another function in the background which takes a target as the first argument.
Calling this will only call
Client-to-Server RPCs aren't enabled yet, but you can send console commands instead.
Here, the client sends a command to the server, which modifies their Pawn's rotation.
Now you need to call this static function within the client-side code. For this example, it can be used in the Camera Controller Update function.
If you need to send a reference to an entity to the server you can do so by taking advantage of entities "network identifiers."