Actor Role/Remote Role & Owner/Owning Connection
(另含 actor-owner-and-owning-connection-in-unreal-engine)
- Role/remote role are not the same as ownership. GetLocalRole / GetRemoteRole; ENetRole: ROLE_None (not replicated), ROLE_SimulatedProxy (no authority to change state or call remote functions), ROLE_AutonomousProxy (simulates and has authority to change state and call remote functions), ROLE_Authority.
- Only the server should see ROLE_Authority for replicated actors. Matrix: server Authority/Autonomous = pawn controlled by a client; client Autonomous/Authority = controlled by this client; client Simulated/Authority = other client's pawn or uncontrolled; client Authority/None = non-replicated actor.
- Server replicates at NetUpdateFrequency; client simulates character movement between updates.
- GetTearOff: no longer replicated, becomes Authority on clients.
- Owner: when a client connects, a player controller is created on the server for that connection; it possesses a pawn and owns it. Owning connection of an actor = connection of its owning player controller (outermost owner). Ownership lasts only while possessed. Inventory items owned by same connection. Components: walk outer chain to owning actor. GetOwner, GetNetConnection.
- Owning connection used for actor relevancy (bOnlyRelevantToOwner; all player controllers only relevant to owner by default), owner-based replication conditions, and Client RPC routing.