Using Game Roles
How to give people specific capabilities using the role system
Please read the parent page on Role Groups before reading this
Game roles are string identifiers that correspond to capabilities inside an Unreal world. Game roles are given to users via a role group.
Setup
You can configure game roles in the Unreal Editor when creating your own mods.
For a given Unreal level, open the World Setting
and search for Roles
.
For example, the template map shows:
If you open the DT_Roles
asset you can will see the following rows. NOTE - the row names match the rows listed in the first screenshot on the page:
Selecting the Default
row will display the following:
Property | Meaning |
---|---|
Name | Name of the game role |
Granted Capabilities | The capabilities associated with game role (i.e. the things theyโre allowed to do in the world) |
Force Into Foreground | Whether players with this game role should always be visible to anyone in the world (via presence in the networking foreground). |
Pawn Lod Level Set | The player character model (and other player rendering options) for different LoD levels to use for players in this game role |
Associated Color | Used for UI elements involving roles - make sure this is at least somewhat unique! |
Starting Inventory Assets | Items which should be in players' starting inventories when using this role. |
Sizes List | A list of possible scale values for the render targets of users with this role. Used primarily with resizable characters, but can also have a single value set to something other than 1.0 to reuse character models at different scales. |
Default Size Index | The index in the above list used for scale when spawning the character. |
Movement Scale | Scales the movement of users with this role to be faster or slower (multiplicatively). |
Avatar Scheme Set | A list of cosmetic schemes for this role supported by the avatar system. |
Live Config Value To Check | The live config value responsible for enabling/disabling this role |
Emote Selection | The default emote selection set to use for this role |
Roles work via inheritance, e.g. the Director
role inherits from the Default
role. This grants the Director
all of the same capabilities as Default
, as well as additional ones.
Customizing game roles
In order to change the default role groups, you'll need to copy DT_Roles
into your project. Once you've created your own role table, you can freely create, edit, and delete games roles.
To use your new data table, change the World Settings entry for your level. (Both the Default Role, and the Data Tables list).
There are in fact three ways of configuring the default role, in order of priority:
Live Config - if the
General.DefaultRole
live config value is used, this will trump other default role values.World Settings - Default Role
the Morpheus Character - In your BPM character's Roles Component, it has a
Default Role
field. This will be used as a fallback if no world settings default role is present.
NOTE: For the live config or character default roles, they still require the relevant roles table to be present in the world settings' Data Tables
list.
When you reupload your mod, our tooling parses the world settings and sends them to the web platform.
Pawn sets
A pawn set is an asset which contains a base pawn (the โtrueโ representation of that character) and information about client LOD levels for that pawn for other clients. Pawn sets are intended to be highly reusable. As a (hypothetical) example, if the participant pawn and LOD levels for every map were the same then weโd only need one pawn set for a participantโs character and itโd be used in every mapโs role data table. However, pawn sets also give us the flexibility of being able to change client LOD levels on a per-activity basis.
The first step is to create the asset that will contain your base pawn and client LOD levels. This should be a Data Asset of the form J_PawnSetAsset
and should live in the appropriate plugin, in the Core/PawnSets
folder.
The base pawn should always be the same pawn which is possessed by the player. This pawn will be seen on their client by the player taking on that role, but not necessarily by other players.
Client LoD levels are what other clients will see for players taking on this role. You can add as many client LOD levels as you like, but in most situations two or three will be all you need. In the example below, the first client LOD level is the rendering foreground and the second is an animated crowd render target which handles everything outside the 35 characters in the foreground
Capabilities
The table below lists (a subset of) the available capabilites and when they grant within a game world.
Capability | Meaning |
---|---|
ActivityControls | Can operate activity controls, such as variables for a venue or stage |
Camera.ObserverAccess | Grants access to all observer cameras throughout the level |
ChatAdmin | Can administrate the chat including handling questions and announcements |
GraffitiWallAdmin | Grants admin access to graffiti wall functions |
ObserverControls | Grants access to observer mode hotkeys (eg. toggling HUD) |
OrbControls | Allows the user to use chat commands to control the orb |
Resizeable | Can resize its actor to make it several times bigger (see JM_ResizeableActorComponent) |
Tutorial | Allows the user to see tutorial prompts |
Visibility | Currently not hooked up and has no effect |
Voice.VoiceAdmin | Can administer voice chat |
Voice.VoiceAuthority | Can use voice chat even when all regular users are muted |
Voice.VoiceChat | Can use voice chat |
Voice.VoiceLoudspeaker | Can speak in loudspeaker mode manually (without a prop) |
Voice.ToggleVoice | Can toggle microphone input on/off with a click, besides being able to use push-to-talk |
VoteAdmin | Can administer votes in which other users can participate |
Play-in-Editor
When using Play-in-Editor, behaviour is controlled by the Roles
section in Editor Preferences
Offline Mode
In offline mode (default), you are automatically granted all roles.
To change while role you spawn with, you can either add an extra to Role Data for Each Client
OR change the Row Name
in the Default Role
section (NOTE - the latter affects launched worlds also).
While playing, you can change roles by hitting Shift + ESC
to bring up the regular Escape menu and then navigate as normal to Profile.
Last updated