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

Merged
merged 24 commits into from
Nov 18, 2024
Merged

Move lag compensation and clock improvements #1135

merged 24 commits into from
Nov 18, 2024

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
@veloce veloce marked this pull request as ready for review November 18, 2024 10:52
@veloce veloce merged commit 816a8d4 into main Nov 18, 2024
1 check passed
@veloce veloce deleted the lag_comp branch November 18, 2024 10:58
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