player information should come through to the client
Alex23rodriguez opened this issue · 2 comments
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.
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 }
]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