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

Allow a game to associate a color with a player in the client #749

Open
jkomoros opened this issue Mar 29, 2020 · 1 comment
Open

Allow a game to associate a color with a player in the client #749

jkomoros opened this issue Mar 29, 2020 · 1 comment

Comments

@jkomoros
Copy link
Owner

Related to #748 .

It should be possible for a game client to use the color associated with a given player in its tempaltes, for example via a CSS var like --player-0-color.

Those colors are currently assigned randomly for players based on a hash of their name. But in some cases there's a very literal color, e.g. the color of the token.

In those cases, the game logic should be able to tell the game what the color is to show in the avatar, and it should show up more proactively, e.g. with a 2px outline border of that color around the picture.

Those colors unfortunately might not be known until some point slightly later in the game, because some games might not assign tokens and colors until after some first phases have been done and tokens have been assigned.

Maybe have a GameDelegate.PlayerColors() which returns an array of colors for each player in order. The engine can call that to see who is which color. (Should we stop calling it once all players have a color, which implies that colors can be set once and never unset, or keep on calling?)

The behaviors.ColorBehavior should automatically interact with that system correctly.

What form should the color be in? It probably makes sense for it to be emitted as a CSS-interpretable string, which would allow colors like 'red', 'green', #FF30AF etc. Should we have a typical color enum that lists common colors that people can choose? But then they'd want a subset of those colors in their actual enum based on which colors are actually legal in their game. Should there be a color table that matches constant name to actual CSS color to allow indirection and more nuanced color pallettes or should it just be literal CSS colors?

@jkomoros
Copy link
Owner Author

jkomoros commented Apr 4, 2020

Note: #752 proposes a much richer model where the color is semantic to the game and tied to group membership. The solution here should be compatible with that.

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