-
Notifications
You must be signed in to change notification settings - Fork 49
add a pause/resume option in the web client #125
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
base: main
Are you sure you want to change the base?
Conversation
Thanks. A few comments:
I'll check your PR and think about it. |
I looked at the PR. It's a nice implementation and I will keep it here for a bit, but I will not merge it as it is. Since you can achieve a practice mode by setting competition_mode = false in web.json, I don't see the use case for the pause feature. In a competitive FUMBBL-like setup, there should be some rules around requesting a pause and a max. pause time limit. |
Thanks for your feedback! You already signalled that you did not see a use case, but I tried anyway. Some interesting discussions on this topic i found: After this, I came up with the following analysis and proposal. Starting point for me is the four-minute time limit, which is part of the official game rules (at least i see it mentioned in CRP). Disabling this in the config would, to me, make it a different game. I am no longer playing the game as it is intended. Then we have FFAI. This has as an overarching goal creating an AI that beats human players. You brought forward that allowing a player to "disable the timer" defeats the purpose of it. The purpose, i guess, would be to limit the amount of time a player has to analyse the game state and make moves. |
I think it makes sense to have a pause button for human players in competition mode. The most common use case for the web client is probably practice matches against oneself or against a bot to learn rules and basic strategy. Playing with a timer to learn how fast you need to think with the ability to pause and take care of "real life" is appealing to me. To be honest, not enough for me to implement it myself but since it's already there. My feedback on the implementation is that you should not be able to play with a paused timer and the other human player should be able to unpause (after all it is a gentleman's game). |
I want this framework to be as flexible as possible, so I suggest we add the pause feature along with several options in the config file:
Could be something like this: What do you think of that? |
Perfect! |
Great! I'd like to try and prepare a new / updated PR that includes the proposed functionality. |
Any updates on this? Especially playing against some intermediate trained bot, this feature makes a lot of sense to me as a full game easily takes over an hour. With a pause button, I could test a bot (with time limits), in several episodes, but don't have to play a full game at once. Ultimately, it would be really nice, to branch a replay, and continue with a bot from the position your are branching from. E. g. replaying the first four turns from a replay, but then introducing some human turns and letting the AI continue. |
I made some progress, but I ran into the refreshing aspect of the game. I am testing in the browser with two tabs, one for each player. My plan was to study the JS code that is executed while moving players around, since those changes immediately become visible for both players. |
Any plans to continue on this PR? |
Hi! I have prepared a pull request for a pause/resume option in the web client.
This introduces a Pause button in the left upper corner.
When a human coach has the turn, the button can be used to pause the clock.
Clicking the button again resumes the clock.
This allows the user to take a break from a running game, to resume it later.
It works only if a human coach has the turn, when the AI is playing the game cannot be paused.
Regarding the code:
I noticed that the files in
web/static/js/*
together are identical topybowl.js
(inweb/dist/js/
)I went along with this by making the changes in both places. Maybe Niels can explain why this is :)
I struggled a bit with the function naming.
The button is called a pause button, but clicking it again resumes the game.
When the button is pressed, it calls
pauseResumeClocks()
, that uses the"/games/ <game_id> /pause"
route to callapi.pause_resume_game()
that callsgame.pause_resume_clocks()
.Open for suggestions to improve this.
Regarding testing: I played a few games, both new games and games that were previously saved and loaded again, and it seems to work.
I checked the tests, but there do not seem to be any tests for the web client.
Note:
I had to disable two lines of code at the end of
_check_clocks()
that resumed all stopped clocks.This code was added in an earlier commit by danj3000 (dec 2019) to be able to resume a saved game.
The new Pause button can be used to resume the clock after loading a saved game, removing the need for these lines of code.
@njustesen, i noticed that you disabled the save option after this change (in jan 2020).
I enabled this again, I hope you don't mind :)
I included an empty
ffai/data/saves
folder (using the.keep
file trick) to allow save games to work out of the box.