input-handling
暂无简介
- License 许可
- MIT
- 所属仓库
- poppyTM/oride
- 最近更新
- 2026-09-30
- Stars
- ★ 1
- Forks
- 0
02 资源文件 5
- 参考文档checks/input-handling-invariants.md1.3 KB
- 参考文档manifest.json1.7 KB
- 参考文档references/input-handling-guide.md2.0 KB
- 脚本scripts/verify.sh3.7 KB
- 参考文档templates/input-handling-template.md2.2 KB
03 SKILL.md 正文
Input Subsystem
Purpose
Implement responsive, remappable multi-device input: action-based mapping (not raw key polling), input buffering with timing windows, dead-zone and sensitivity calibration, chord/gesture detection, gamepad hot-plug, and latency within an explicit input-to-photon budget.
Use when
- Adding action mapping, rebinding UI, or multi-device support (keyboard, mouse, gamepad, touch).
- Implementing input buffering, coyote-time/jump-forgiveness windows, or combo/chord detection.
- Calibrating sticks (dead zones, response curves), triggers, or pointer sensitivity.
- Auditing dropped inputs, double-fires, focus-stealing, or input latency.
Do not use when
- Designing the simulation that consumes input (use
game-runtime). - Building editor gizmo manipulation UX (use
editor-tooling). - Securing networked input against cheating (server-authoritative validation concern, pair with
network-securityfor transport).
Required context
- Device matrix: keyboard, mouse, gamepad, touch with platform APIs.
- Action inventory: gameplay actions, chords, and rebinding requirements.
- Latency budget: input-to-photon ceiling and buffering window (ms).
Procedure
- Map Actions, Not Keys: Define gameplay actions (
jump,dodge,confirm) with per-device binding tables. Gameplay code reads actions; devices produce them. Example:jump ← Space | GamepadA | TouchButton(jump-zone). Raw keycodes never appear in gameplay logic. - Buffer with Windows: Queue discrete action presses with timestamps; consume within an explicit window (e.g., 120 ms buffering, 100 ms coyote time). Buffer size is bounded (e.g., 8 events); overflow drops oldest with a debug counter, never newest.
- Calibrate Sticks & Triggers: Apply radial dead zones (e.g., 0.15 inner, 1.0 outer) plus a response curve (e.g., cubic ease) per stick; document per-device overrides. Triggers use press/release hysteresis (press > 0.4, release < 0.3) to prevent flutter.
- Detect Chords & Gestures Deterministically: Chords require all members within a simultaneity window (e.g., 50 ms); sequences match against a trie with per-step timeouts. Conflicting bindings (same gesture → two actions) are rejected at bind time with a named error.
- Survive Device Churn: Handle gamepad hot-plug/unplug mid-frame: pause-on-disconnect for single-player, migrate bindings to the replacement device, and persist user rebinds to versioned storage with conflict resolution on load (user binding wins; log the override).
- Verify: Run
scripts/verify.sh. Prove buffered-input execution rates at 30/60/120 fps simulation, dead-zone curves against calibration tables, chord timing boundaries, and zero dropped actions in a scripted input replay.
Decision rules
- Actions Only in Gameplay: Gameplay polling raw device state is a defect; all input arrives as named actions.
- Bounded Buffers: Unbounded input queues are forbidden; every buffer has size, window, and drop policy.
- No Silent Conflicts: Overlapping bindings fail loudly at bind time, never at press time.
- Rebinds Persist: Default bindings are code; user bindings are versioned data that survives updates.
Evidence required
- Input-replay test: scripted sequence yields identical action streams across frame rates.
- Calibration tables: measured vs expected stick curves and trigger thresholds.
- Chord/gesture boundary tests and conflict-rejection cases.
- Passing execution log from
scripts/verify.sh.
Output contract
- Action-mapped input subsystem with buffering and dead-zone calibration.
- Rebinding persistence with conflict-resolution rules.
- Latency and dropped-input benchmark evidence.
Stop conditions
- All actions mapped, buffered, and rebindable within latency budget.
- Zero dropped or double-fired actions in scripted replay.
- Token budget exhausted.
Escalation rules
- Escalate to lead architect if platform input latency floor exceeds the design budget (needs game-feel tradeoff).
- Escalate immediately on device-churn crashes or input handling on the wrong thread causing races.
04 同仓库更多 Skills
zoom-reflow
暂无简介
wireframe-styleguide
暂无简介
visual-regression
Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates
ui-implementation
Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.
tui-editor-engine
Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.
tree-sitter-context-indexing
暂无简介