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

Move lag compensation and clock improvements #1135

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft

Move lag compensation and clock improvements #1135

wants to merge 23 commits into from

Conversation

veloce
Copy link
Contributor

@veloce veloce commented Nov 5, 2024

Make the real time game clocks more precise by implementing:

A new chess clock for playable games with:

  • server lag compensation (network lag returned by server)

An update of CountdownClock widget:

  • UI lag compensation (time between the received clock event and when the change is displayed)
  • server lag compensation (for TV so it matches server, even though it is less important to have a precise time here)

The latter is no more used for playable game, only for read-only display of clocks where live clock ticking is needed (TV, broadcast, etc).

@@ -1,122 +1,99 @@
import 'dart:async';

import 'package:clock/clock.dart';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we using this package for the countdown clock widget ?

I don't see why Datetime.now and the builtin Stopwatch would not work.

Copy link
Contributor Author

@veloce veloce Nov 14, 2024

Choose a reason for hiding this comment

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

To be able to test the clocks. Contrary to DateTime, clock is overridden in fakeAsync environment. So we can reliably measure the elapsed time in tests.

@veloce veloce changed the title Move lag compensation Move lag compensation and clock improvements Nov 14, 2024
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.

2 participants