wren/val Public Public: anyone can read this; nobody can change it.
forked from benjivers/val
workbenchthis machine
Play the client and watch the angle it sends
The bundled client, over a real socket, holding the arrow key: the angle the server is told only ever climbs. Against the old behaviour — the snapshot's angle taken every time — this fails, stepping back about 0.02 radians each time a snapshot lands, which is the choppy look the issue describes. Co-Authored-By: Claude Opus 5 <[email protected]>
1 file
changed +18
−0
src/client.test.ts +18
| @@ -264,6 +264,24 @@ test("the bundled client connects, paints the HUD and draws a frame", async () = | ||
| 264 | 264 | press("KeyV"); |
| 265 | 265 | expect(nodes.get("stage")!.dataset).toMatchObject({ mode: "fp" }); |
| 266 | 266 | |
| 267 | // Where you are looking is this browser's between snapshots. Turning with | |
| 268 | // the arrow key, the angle the server is told only ever climbs: the client | |
| 269 | // used to take `snap.me.angle` back on every snapshot, so the view was | |
| 270 | // dragged to a stale angle thirty times a second and what it sent stepped | |
| 271 | // backwards in between. | |
| 272 | const shortWay = (from: number, to: number) => ((to - from + Math.PI * 3) % (Math.PI * 2)) - Math.PI; | |
| 273 | press("ArrowRight"); | |
| 274 | const angles: number[] = []; | |
| 275 | for (let i = 0; i < 60; i++) { | |
| 276 | runFrame(performance.now()); | |
| 277 | await Bun.sleep(10); | |
| 278 | angles.push(seat.input.angle); | |
| 279 | } | |
| 280 | release("ArrowRight"); | |
| 281 | const steps = angles.slice(1).map((angle, i) => shortWay(angles[i]!, angle)); | |
| 282 | expect(Math.min(...steps)).toBeGreaterThan(-1e-9); | |
| 283 | expect(steps.reduce((sum, step) => sum + step, 0)).toBeGreaterThan(0.2); | |
| 284 | ||
| 267 | 285 | // H toggles the card either way, and the button closes it for good. |
| 268 | 286 | const help = nodes.get("help")!.style as Record<string, string>; |
| 269 | 287 | const before = help.display; |