Closed peacetrue closed 4 years ago
@peacetrue Do you mean like a “Play Again” feature? If you’re using the Lobby API, you could either use the create
and join
endpoints to create a new game or use the playAgain
endpoint.
If you’re not using a server, you can use the reset
method of the client to reset the game to the beginning state and let the player play again.
@delucis I will try the the playAgain endpoint.
, It doesn't seem to be updated in the document. use the create and join endpoints
equivalent to restarting a new game,
the experience is not very good. When the game is over, player 1 clicks to play again,
player 2 receive the ask, start immediately when player 2 agrees.
@peacetrue Yes, create + join wouldn’t work so well for that use case but I think the playAgain
endpoint might.
@flamecoals Are you still using the playAgain
API? Would you be open to updating the documentation to include it?
@flamecoals When my test is complete, I will update the document. In addition to the interface documentation, Lobby's example also needs to be updated synchronously.
Hey, yes, we still use it. I will send a PR soon with documentation
On Sat, Apr 25, 2020, 1:55 PM 安宁 notifications@github.com wrote:
@flamecoals https://github.com/flamecoals When my test is complete, I will update the document. In addition to the interface documentation, Lobby's example also needs to be updated synchronously.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nicolodavis/boardgame.io/issues/643#issuecomment-619439512, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH4TB4OSBBU32CPWKWPMW3RONE4ZANCNFSM4MO4SLWQ .
@delucis I made some attempts. First of all, the playAgain interface is used, it looks not much different from the create interface, but nextRoomId is useful. After calling the playAgain interface, I want to see if the other player can receive the notification, but the result is no. Finally, try to poll on the client, by determining whether GameMetadata contains nextRoomId, but the result is no.
I read the interface of GameMetadata:
export interface GameMetadata {
gameName: string;
players: { [id: number]: PlayerMetadata };
setupData: any;
nextRoomID?: string;
}
`` `
It seems that the current version has not been implemented.
Or my understanding is wrong, can you give me some suggestions?
PS:I refer to Lobby's implementation, but Lobby's style is too simple, I rewrote Lobby.
I think that the client interface of the lobby can be provided separately
@peacetrue Check out the documentation @flamecoals just added. You should get the nextRoomId
as the response to a request to playAgain.
And you’re correct that this isn’t supported by the provided React Lobby component.
Going to close this now we have documentation. Let me know if you have any further questions.
After the player has played a game, They want another game, Any good suggestions from boardgame.io?