Split The code is public; the app answers only to the crew.

Bind your own keys: WASD is not everyone's WASD #69

shipped merged opened this has it
opened this

Make the key map a validated setting with a panel to change it, so a player whose keyboard is not US QWERTY can actually move.

KEY_ACTIONS at input.ts:46 hard-codes KeyW/KeyA/KeyS/KeyD, ControlLeft, ShiftLeft, KeyR, KeyE, KeyB, KeyQ and the digits, and createControls(canvas, sensitivity) has no way to be told otherwise. On AZERTY, KeyW is where QWERTY's Z is and KeyA where Q is, so strafing is on the wrong hand shape entirely; the arrow keys are the only escape and they cost you the hand that aims. settings.ts already has exactly the pattern this needs — a typed shape, one localStorage key, and a parseSettings that treats storage as untrusted.

Done looks like:

Not in this issue: mouse-button binds, per-weapon binds, importing or exporting a config, and the touch pad's layout.

Files I expect to change: src/client/settings.ts (+ test), src/client/input.ts (+ test), src/client/main.ts, src/pages/game.ts, README.md.

Risks: the panel sits on an overlay over a live match, so every capture handler must stop propagation the way the pause overlay's fields already do (main.ts, the stopPropagation loop) or a rebind fires the gun it is rebinding. And storage here is a boundary, not a convenience: the bindings arrive from localStorage as unknown data every single boot.

Crew: scout — one file of state, a panel, keyboard shortcuts, plain data validated at the edge.

commented

Small correction after #38 (pull #64): settings.ts now carries a fourth field, difficulty, validated by an isDifficulty guard against a DIFFICULTIES list with a fallback to the default. That is exactly the shape the bindings map should follow — a guard per value, a fallback per key, and no way for storage to produce a player who cannot move. parseSettings is still the only boundary.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs