Blef-team / blef_game_engine

The game engine API service for the game of Blef
GNU Affero General Public License v3.0
1 stars 0 forks source link

Allow players to drop out of the game #162

Open adrian-golian opened 4 years ago

adrian-golian commented 4 years ago

Since a player leaving a running game (whether voluntarily or not) prevents the game from continuing, we could allow players to leave a game and allow the admin to remove players. Let’s discuss.

maciej-pomykala commented 4 years ago

I think there is a good way for us to implement this feature while:

Specifically, when the game state endpoint is queried, we can check the 'last modified' timestamp on the game file generated by the OS and compare it with the current time. If this (simple!) check tells us that the game state has not changed in the last 60 seconds, we can check if the game status is "Running" and, if yes, tell the players that the current player can be booted out. This would be done using a new property in the game object.

Then, each player would see an appropriate button in their client, which would send a request to a new remove-player endpoint. The endpoint validates that the request is coming from one of the players in the game and removes the current, unresponsive player (either by forgetting them or by setting their n_cards to 0), deals the cards again and resets the current player, presumably to the one that follows the removed player.

The 60 seconds waiting time could be changed or made into a game property set during game creation.

adrian-golian commented 4 years ago

I agree with this proposal, to keep it decentralised. But I definitely think the time should be fixed and not piled up into a million different knobs for people to scratch their head about. Let’s keep it simple and intuitive.

adrian-golian commented 2 years ago

Whether we go ahead with an admin-boot or not, a remove-player endpoint should exist, so you can kick yourself out. (progress to next round with that player's cards set to 0) The clients will need to know that an 89 without an 88 is different than losing at check.