Lurkars / gloomhavensecretariat

A Gloomhaven / Frosthaven Companion App
https://gloomhaven-secretariat.de
GNU Affero General Public License v3.0
175 stars 66 forks source link

Turn timer is now synced between clients #47

Closed patrickdevarney closed 1 year ago

patrickdevarney commented 1 year ago

Two clients join the public server. Their turn timers are incrementing locally but not synced on joining and not synced when phases change.

  1. Pressing "Draw" or "Next Round" on Client1 resets Client1's turn timer to 0 but fails to reset Client2's turn timer to 0.
  2. Pressing "Draw" "Next Round" on Client2 resets Client2's turn timer to 0 but fails to reset Client1's turn timer to 0.

Thank you for your work! This is amazing

Lurkars commented 1 year ago

Thanks, should be fixed in v0.31.0.

Please close this issue when happy with result ☺️

patrickdevarney commented 1 year ago

When phases change, time resetting to 0 is now synced correctly.

Bug: When joining, the joining client's time will always be set to 0.

Lurkars commented 1 year ago

Okey, I will recheck.

Lurkars commented 1 year ago

Okay have to think about it a bit more. Currently the time is only synced to server on any action. So when nothing happens and a new client joins, it just get's the time from last update. I may just change the timer to timestamps. The thought behind using seconds instead of timestamp was, that on timestamp, you start round two days ago and return, it will say the round last two days. With current state, timer only runs when client is connected which I like more. So I think besides now all clients are equal threaten from server side, it makes sense to declare one client as host to send pings with round time to server. Anyway, I don't really like all my solution for now and will think about it a bit more.

Lurkars commented 1 year ago

I tried to address this in v0.32.0. By defining first client as host for sending timer every 5 seconds. So offset of 5 seconds possible, but I think it's okay.

Please be aware you also need GHS server in verion v0.32.0! Otherwise it won't work.

Lurkars commented 1 year ago

I changed server and client now, so that new client always request latest update from an already connected client to get the current state and time. So please verify with v0.35.0

Lurkars commented 1 year ago

Since I got no feedback and no other complains, I will close this issue. Please reopen if issue isn't solved for you.