Appearance
Appearance
Developer Players have special powers! They can:
DevelopmentOnlyActionAttribute
in production environments.Developer Players make it easier for you to test features in production environments and allow you to perform critical final sanity testing before turning off maintenance mode for all players.
First, we need to find the player we want to mark as a developer either through player search or the recently active players list. Open the Manager Players page from the sidebar and find your player.
After we have found our player, click on it to open the player details page.
In the player details admin tools section, you can find a button under disruptive actions labeled Mark as Developer.
Clicking the button will open a modal window explaining what Developer Players can do. Flick the Developer Status switch to on, and click Save Settings.
Our player is now marked as a developer and can immediately use their newfound powers!
💡 Note
Marking a player as a developer requires the api.players.set_developer
permission in the dashboard. If the button is deactivated for you, check that you have the correct privileges!
Both client and server code can check for developer privileges by looking at the IsDeveloper
flag in the player model.
if(playerModel.IsDeveloper)
{
// Show developer tools menu
}
Developer Players are indicated on the dashboard by a small icon next to their name in the player list and in the player details page.
Actions marked with the [DevelopmentOnlyAction]
attribute are only allowed to be executed in development environments or by Developer Players. This is validated on the server.
[ModelAction(ActionCodes.PlayerGainGemsDebug)]
[DevelopmentOnlyAction]
public class PlayerGainGemsDebug : PlayerAction
{
public int Amount { get; set; }
public PlayerGainGemsDebug() { }
public PlayerGainGemsDebug(int amount) { Amount = amount; }
public override MetaActionResult Execute(PlayerModel player, bool commit)
{
if (commit)
player.Avatar.NumGems += Amount;
return ActionResult.Success;
}
}
If you want to learn more about development-only features, you can read the guide on Development-Only Features.
Sometimes we might want to check if a player is a developer while only having access to their EntityId. In such cases, developer status can be queried by EntityId from the node-local GlobalStateProxy
.
if(GlobalStateProxyActor.ActiveDevelopers.Get().IsPlayerDeveloper(PlayerId))
{
// Do something developer-only
}
Normally a player is marked as a developer through the dashboard API, and this should work fine for most use-cases. If, however, we need some other way to set players as developers, this can be achieved by sending a SetDeveloperPlayerRequest
to the GlobalStateManager
.
SetDeveloperPlayerResponse response = await EntityAskAsync<SetDeveloperPlayerResponse>(
GlobalStateManager.EntityId,
new SetDeveloperPlayerRequest(playerId, true));
if(response.IsSuccess)
{
// Player was set as developer
}
This state does not propagate to the GlobalStateProxy
instances immediately, so the status might not be available immediately after receiving a response. Setting a player as a developer this way does not generate an audit log entry either, so please be mindful of that.
Developer Players can log in during maintenance mode while normal players are locked out. This allows them to check that everything works before opening up the servers to the general public.
If a developer logs in during maintenance mode, SessionStartSuccess.DeveloperMaintenanceBypass
is set to true
. This value can be checked on the client to show a message to the developer during login.
You can read more about the maintenance mode features in Maintenance Mode).
GlobalStateManager
as a set of EntityId
's, so changing a player's IsDeveloper
flag does not automatically make them a developer. Do not change this flag directly. Use the correct messaging pattern instead.