]> git.cworth.org Git - lmno-server/commitdiff
Use server as authoritative source of truth for tiles in the center
authorCarl Worth <cworth@cworth.org>
Sun, 8 Mar 2026 18:14:32 +0000 (14:14 -0400)
committerCarl Worth <cworth@cworth.org>
Sun, 8 Mar 2026 18:14:32 +0000 (14:14 -0400)
Clients were trying to track the central state on their own and
getting out of synch. Let's stick to "server as authoritative"
as a principle.

anagrams.js

index 7847df7645e4591b9964316473f4ff922a9dd999..f84437c9e28ae9495a195f1996cfbde681a29e4d 100644 (file)
@@ -353,6 +353,10 @@ class Anagrams extends Game {
       reason
     });
 
+    /* Broadcast authoritative state so clients resync. */
+    this.broadcast_event_object("center",  this.state.center);
+    this._broadcast_player_state();
+
     /* Activate next claimer if any. */
     if (this.state.claim_queue.length > 0) {
       this._activate_claimer();
@@ -519,7 +523,8 @@ class Anagrams extends Game {
       reason: "accepted"
     });
 
-    /* Broadcast full player words for state sync. */
+    /* Broadcast authoritative state so clients resync. */
+    this.broadcast_event_object("center", this.state.center);
     this._broadcast_player_state();
 
     /* Activate next claimer if any. */