Legacy:Role
Role is a concept in replication. Actors have two properties to define their role on server and client in network games: Role
and RemoteRole
. Role always tells us (and the engine :)) about the actor's local role while RemoteRole tells about the actor's role on the other side of the network. When an actor is replicated to a client, its Role and RemoteRole properties are swapped there, so the serverside Role value becomes the clientside RemoteRole value and vice versa. When we talk about an actor's Role or RemoteRole on this page we always mean "as viewed from the local machine."
- All actors existing on the server have Role == ROLE_Authority there, while their RemoteRole can be either ROLE_None, ROLE_DumbProxy, ROLE_SimulatedProxy or ROLE_AutonomousProxy.
- On the clients the replicated actors have their Role and RemoteRole swapped, i.e. RemoteRole == ROLE_Authority and Role is any of the other values according to the Actor's RemoteRole on the server.
- Client-side actors (i.e. actors that weren't replicated, but spawned on the client) have
Role == ROLE_Authority
on the network client. These actors only exist on the client they were spawned on. They can't be replicated to any other client or the server.
What do the different net roles mean?
The net roles are defined in the Actor class, as the enum ENetRole (see Actor/Enums for others).
- ROLE_None
- In
RemoteRole
This means that none of the actor's attributes or functions will be replicated at all. Examples for this kind of actors are the GameInfo, Mutators and GameRules as well as some explosion effects and decals in UT. InRole
it is contradictory, as it implies the actor does not exist on the machine this script is executing on.
Note: is is perfectly possible to instantiate an Actor on multiple network machines by using simulated functions. However these will not be tied together by replication and the client copies will not function as proxies for the server copy. For instance, destroying the actor on the server will not destroy any corresponding actor on the client (and vice-versa).
- ROLE_DumbProxy
- The actor is replicated, but can't execute any functions on the remote side. It will update when variables are replicated to it but will not attempt to interpolate. If you see this in
Role
it means we are looking at the proxy, not the copy that was authoritatively spawned.
- ROLE_SimulatedProxy
- The actor is replicated and may execute simulated functions and simulated state code on the remote side. Often this kind of actor simulates its behavior based on initially replicated properties without (much) further "help" from the server.
- ROLE_AutonomousProxy
- Autonomous proxies come with some more magic built-in. :) They are basically simulated proxies, but may execute simulated and non-simulated functions on the client owning/controlling this actor (only on that client!).
In UT only PlayerPawns are autonomous proxies, in UT2003 only PlayerControllers are. Every other client sees them as a regular simulated proxy. Player-controlled actors, such as the guided redeemer missile (GuidedWarshell in UT or RedeemerWarhead in UT2003) are autonomous proxies on the controlling player's client, too.
Sweavo: more clarification needed here
- ROLE_Authority
- All functions can be executed. This must appear in
Role
on the machine the actor was spawned on, and must appear in eitherRole
orRemoteRole
(but not both) for every actor. In standalone games all Actors haveRole == ROLE_Authority
. In net play nearly all Actors have thisRole
on the server. The exception is actors that cannot influence other players, such as Karma ragdolls. Never manually set the RemoteRole on the authorative version of an actor or the Role on a replicated version of the actor to this value.
When your script sees RemoteRole == ROLE_Authority
it means it is executing on the proxy version of the Actor. Usually it's more useful to check the value of Role
though.
Possible Combinations of Roles
Server | Client | Owner Client | Example |
ROLE_Authority | ROLE_SimulatedProxy | ROLE_SimulatedProxy | Projectiles, most ReplicationInfos, a Pawn's Inventory |
ROLE_Authority | ROLE_SimulatedProxy | ROLE_AutonomousProxy | UT: PlayerPawns, GuidedRedeemer UT200x: Pawns currently possessed by a client player (includes Vehicles and the guided RedeemerWarhead) |
ROLE_Authority | ROLE_DumbProxy | ROLE_DumbProxy | UT200x Pickups, certain effects that need to be replicated but don't have to simulate any behavior |
ROLE_Authority | ROLE_Authority | ROLE_Authority | XPawn ragdolls (see note below) |
It's not unusual that an actor's clientside role changes. The last example is a special case which happens only when the server sets bTearOff=True on a simulated proxy after the actor has been replicated. The server and client versions of the actor become completely independant and nothing is replicated between them anymore. In UT pickups often change between simulated and dumb proxies.
Related Topics
- Replication
- Netcode Idioms – useful code to pick out different types of machine
- NetMode – tells you what type of game is running: server, client, etc.
- Simulated Function
- Replicated Function