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

player information should come through to the client #1117

Open
Alex23rodriguez opened this issue Dec 3, 2022 · 2 comments
Open

player information should come through to the client #1117

Alex23rodriguez opened this issue Dec 3, 2022 · 2 comments

Comments

@Alex23rodriguez
Copy link

Alex23rodriguez commented Dec 3, 2022

It's a bit awkward that player information is only available at the endpoint /games/[game]/[matchID]. I want to be able to access the players' name and isConnected properties to provide a better UI experience. Right now I have to rely on separately making a call to the REST endpoint only to capture the data about the match I'm in!
For example, the Board defined in the Client's documentation should receive an additional prop (in the case of React) called players containing their ID, name, and online status. This way we could add elements around the board to make it clear who is playing and whose turn is it by highlighting different areas of the UI outside the board itself that is, we could make a dedicated player card for each player.
This would also make it trivial to pass the names of the players to the Chat component, as it is currently only possible to post "Player 0 says..." instead of their name, but the name is required to join a match! Ideally, the chatMessages prop would also be expanded to include the name alongside id (msg ID), sender (player ID) and payload (which I realize can include the name, but it still doesn't make it available to the Board).

I might put some work towards creating a push request if the idea is approved. This wouldn't break backwards compatibility.

@delucis
Copy link
Member

delucis commented Dec 3, 2022

Is the matchData prop what you’re looking for? Should contain data something like this:

[
  { id: 0, name: 'Alice' },
  { id: 1, name: 'Bob', isConnected: true }
]

@Alex23rodriguez
Copy link
Author

It's possible! I was looking for a players field... I haven't gotten a chance to continue working on my project to test whether this solves my issue, but I'll get back to you soon

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

2 participants