Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A behavior for players that may administer a game #771

Open
jkomoros opened this issue Jul 30, 2020 · 1 comment
Open

A behavior for players that may administer a game #771

jkomoros opened this issue Jul 30, 2020 · 1 comment

Comments

@jkomoros
Copy link
Owner

There are some actions, like reassign teams, reorder players, WaitForEnoughPlayers, that only some players should be able to do.

A prebaked behaviors.GameAdministrator that has a MayAdministerGame bool. If true, then actions like the above are allowed to proceed. If false, then those moves are only allowed if the move has been explicitly configured to allow anyone to do the action, or some other test. (Conceivably you might want a different bit for the different prebaked moves)

If behaviors.GameAdministrator is included, by default player 0 is set to administrator only. But the admin can also assign another person to be admin.

Ideally delegate.GroupMembership and related machinery could be used in Legal methods.

Related to #491. See also #770. See also #768

@jkomoros
Copy link
Owner Author

jkomoros commented Jul 30, 2020

See also #752, which proposes a mechanism where beahviors.Color has Color and ProposedColor. A player may set their own ProposedColor live, but it can only be copied from ProposedColor to Color by the administrator. But the admin might also play a move that disallows anyone but admins to modify even proposed color right now.

In general admin is not a bool, but something that is specific to each particular move. You want some mechanism that allows configuration of which playerState is allowed to apply which moves right now. Maybe it's a type of move that is called RequirePermission or something, that is designed to be embedded within other moves, that has a PlayerHasPermission(playerState) error that is called within its legal method for the proposer, and where PlayerAllowed(playerState) has some prebaked smart logic. That method could by default consult move.MinimumPermissionLevel(), and if the playerState has Permission that has an enum value larger than that, then it allows it. And then there's a WithMiminumPermission(level int) to configure that without writing code.

And maybe you could do something smart with tree enum behavior or something.

And then by default everyone starts with a permission of 0, and admin is 1, but you can override that and be as bespoke as you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant