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

use san rather than chessground callback args for sound #16461

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

schlawg
Copy link
Collaborator

@schlawg schlawg commented Nov 22, 2024

remove unnecessary "music" and "game" sound filters

fix #3109 (was already fixed, but now pentatonic & speech won't lag either)

this.ply === 0
? (this.data.game.initialFen ?? 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR')
: this.stepAt(this.ply - 1).fen;
const san = sanOf(readFen(fen), orig + dest);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure sanOf(readFen(fen), move) is expensive to run at such a critical moment; that's why the server sends the SAN to the client.
Also I'm not sure that works with variants.

If we want to play a sound before the server sends the SAN back, it should be possible to do so with computing the SAN.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanOf(readFen) takes around 2-3 microseconds.

pentatonic uses information such as castles and check which are not readily available from chessground. is it worth separate code paths to shave off a computation we could do a thousand times in a loop without dropping a frame?

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

Successfully merging this pull request may close these issues.

round game sounds can lag
2 participants