You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,9 @@ Each game match runs in a Cloudflare **Durable Object** (DO). The DO maintains t
57
57
-**Tick Loop:** The server calls `GameState::step` which delegates to `game_core::step`.
58
58
-**Broadcasting:** Every 3rd tick (20Hz), it sends a snapshot to all clients via `broadcast_state`.
59
59
60
+
> [!NOTE]
61
+
> **Edge Latency Nuance:** While Durable Objects run "at the edge," each specific match runs in a **single location**. Frame updates still suffer light-speed latency for players far from that specific data center. Global latency is mitigated by region-aware matchmaking, ensuring players match in a DO close to both of them.
62
+
60
63
### 3. The Client (`client_wasm`)
61
64
62
65
The client needs to be smooth (120Hz+) even though headers only arrive at 20Hz.
@@ -122,7 +125,7 @@ graph TD
122
125
1. Browser captures key press in [`on_key_down`](client_wasm/src/lib.rs).
123
126
2. Client updates local paddle immediately.
124
127
3. Client sends `C2S::Input` to server.
125
-
4. Server applies input in its next tick.
128
+
4. Server validates input (enforcing speed limits) and updates entity intent.
126
129
5. Server includes new paddle position in next broadcast.
Copy file name to clipboardExpand all lines: ARTICLE.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,8 @@ The server advances the simulation at ~60Hz but only broadcasts authoritative sn
120
120
The server is the authority.
121
121
If the client thinks the ball is at `x = 100` but the server says `x = 102`, the server wins. Always.
122
122
123
+
For paddles, the server uses **Target-Based Validation**. It accepts the client's desired position but moves the authoritative paddle towards that target at the maximum allowed speed. This prevents teleportation cheats while maintaining responsiveness.
0 commit comments