RPC
1. Remote Procedure Call: Remote program call
2. One process calls the functions of another process
Because the "server-shoot" method is marked as "running on server", even though it is opening fire in the second window (client), the output information is: SERVER: Prepare for shooting, indicates that this is running on the server.
On the server, the "server-shoot" method calls the "muticast-shoot" method and the "muticast-shoot" method (marked as "multi-path transfer "), therefore, the server will notify all clients to execute this method.
The results show: SERVER: All shots and client 1: All shots.
Because "Run dedicated server" is not checked, the first window is both a server and a client. When "Multi-Channel Transmission" is used, messages are sent to the client itself, therefore, "server: All shots" is displayed"
2. remotely call actor ownership.
- If you use the get all actors of class function to obtain the role instance controlled by Client A, assign a value to the "server-shoot" method marked as "running on server" (the target is self by default ), run on client B (assign the client B instance to the target parameter "server-shoot"). The server does not perform this operation and is discarded, of course, it will not be spread to other clients.
- However, if the server calls the "server-shoot" method marked as "running on the server" on the server, no matter who the target parameter of "server-shoot" is assigned, it will be executed, it will also be spread to other clients.
The table below summarizes where specific RPC types will be executed based on the ownership of the actor that executes the call (the leftmost column.
RPC called by the slave server
Actor ownership |
Not copied |
NetMulticast
|
Server
|
Client
|
Client-owned actor |
Run on the server |
Run on the server and all clients |
Run on the server |
Run on the client to which the actor belongs |
Server-owned actor |
Run on the server |
Run on the server and all clients |
Run on the server |
Run on the server |
Unowned actor |
Run on the server |
Run on the server and all clients |
Run on the server |
Run on the server |
RPC called from the client
Actor ownership |
Not copied |
NetMulticast
|
Server
|
Client
|
Owned by invoking Client |
Run on the client that executes the call |
Run on the client that executes the call |
Run on the server |
Run on the client that executes the call |
Owned by a different client |
Run on the client that executes the call |
Run on the client that executes the call |
Discard |
Run on the client that executes the call |
Server-owned actor |
Run on the client that executes the call |
Run on the client that executes the call |
Discard |
Run on the client that executes the call |
Unowned actor |
Run on the client that executes the call |
Run on the client that executes the call |
Discard |
Run on the client that executes the call |
For more information about RPC Remote calls see the official documentation: http://api.unrealengine.com/CHN/Gameplay/Networking/Actors/RPCs/index.html
[Ue4] RPC, remote call