UE4 VR區域網(一)基礎知識
Actor的Role和RemoteRole屬性
Role:網路中扮演的角色型別
RemoteRole:遠端連線的作用型別
Role_Authority: 權威
Role_SimulatedProxy: 模擬代理
Role_AutonomousProxy: 自主代理
Server(玩家A):
A,B,C的身份為:
Role: Role_Authority
RemoteRole:ROLE_SimulatedProxy
Client1(玩家B):
A1的身份為:
Role: ROLE_SimulatedProxy
RemoteRole: Role_Authority
B1
Role: Role_AutonomousProxy
RemoteRole: Role_Authority
C1的身份為:
Role: ROLE_SimulatedProxy
RemoteRole: Role_Authority
Client2(玩家C):
A2的身份為:
Role: ROLE_SimulatedProxy
RemoteRole: Role_Authority
B2的身份為:
Role: ROLE_SimulatedProxy
RemoteRole: Role_Authority
C2的身份為:
Role: Role_AutonomousProxy
RemoteRole
注:
模擬代理為防止傳送丟失或提高效率而進行的根據之前的速率來模擬的模式;自主代理一般時本地playerController控制的Actor,會接受真人的輸入來彌補資料的不足。
Actor 及其所屬連線
注:
1.每個連線都有一個playerController.
2.actor最外圍的所有者的連線則為actor所屬的連線,動態生成時預設為spawn時設定的owner(預設是建立者)。注意:原本在場景中的actor預設為沒有owner!
3.actor必須處於連線中才可以呼叫非廣播的RPC。
4.連線所屬用來確定actor複製和呼叫RPC時知道在哪個客戶端執行。
從伺服器呼叫的 RPC
Actor 所有權 |
未複製 |
NetMulticast |
Server |
Client |
Client-owned actor |
在伺服器上執行 |
在伺服器和所有客戶端上執行 |
在伺服器上執行 |
在 actor 的所屬客戶端上執行 |
Server-owned actor |
在伺服器上執行 |
在伺服器和所有客戶端上執行 |
在伺服器上執行 |
在伺服器上執行 |
Unowned actor |
在伺服器上執行 |
在伺服器和所有客戶端上執行 |
在伺服器上執行 |
在伺服器上執行 |
從客戶端呼叫的 RPC
Actor 所有權 |
未複製 |
NetMulticast |
Server |
Client |
Owned by invoking client |
在執行呼叫的客戶端上執行 |
在執行呼叫的客戶端上執行 |
在伺服器上執行 |
在執行呼叫的客戶端上執行 |
Owned by a different client |
在執行呼叫的客戶端上執行 |
在執行呼叫的客戶端上執行 |
丟棄 |
在執行呼叫的客戶端上執行 |
Server-owned actor |
在執行呼叫的客戶端上執行 |
在執行呼叫的客戶端上執行 |
丟棄 |
在執行呼叫的客戶端上執行 |
Unowned actor |
在執行呼叫的客戶端上執行 |
在執行呼叫的客戶端上執行 |
丟棄 |
在執行呼叫的客戶端上執行 |