Actors and their Owning Connections
An overview of the role of the server in multiplayer.
You will here a lot about the owning connection of an Actor. Ultimately, each connection has a PlayerController, created specifically for that connection. (read more about the process in the client connection flow details).(参考1)(参考2)
Each PlayerController that is created for this reason, is owned by that connection. To determine if an Actor is general is owned by a connection, you query for the Actors' most outer owner, and if the owner is a PlayerController, then that Actor is also owned by the same connection that owns the PlayerController.
这段话的总体意思就是:PlayerController就是一个Actor归属链的根本抓手。如果你想知道两个Actor是否属于同一个client连接,那就查它们最外层的Owner,如果这两个Owner是同一个PlayerController,那么这两个Actor就属于同一个connection链条的产物。
One example of this is when Pawn Actors are possessed by a PlayerController. Their owner will be the PlayerController that they are possessed by. During this time, they are owned by the connection of the PlayerController. The Pawn is only owned by this connection during the time it is also owned/possessed by the PlayerController. So as soon as the PlayerController no longer possesses the Pawn, the Pawn is no longer owned by the connection.
Another example is inventory items that are owned by a Pawn. These inventory items are owned by the same connection (if any) that might own that Pawn.
上面两个例子是在说:connection创建一个PlayerController作为抓手,PlayerController控制Pawn,Pawn持有其他东西,这形成一个持有链条。就像链表一样,这里建立链接的属性叫Outer/Owner。
也就是说,判断两个Object是否同一个Connection的产物,遍历其Outer链即可,只要两个Outer链上存在有一个相同的祖先,则这两个Object同属一个Connection。
Connection ownership is import for a few things:
- RPCs need to determine which client will execute a run-on-client RPC
- Actor replication and connection relevancy
- Actor property replication conditions then the owner is involved