@joystyk/arcade
v0.2.0
Published
Shared real-time input, pause, paces and ghost races.
Downloads
371
Readme
@joystyk/arcade
Shared browser helpers for real-time games. It has no Three.js dependency. The platform's fixed-step runner remains the authority; these helpers send intentions and draw its snapshots.
bindInputmaps keys, swipe/tap/drag and standard gamepads to named actions. Printable-key shortcuts follow the player's preference; held actions release on blur and disconnect.bindHoldgives native buttons pointer, keyboard and switch activation.bindHoldPaddelegates those events for pads rendered by Gyral;bindDragprojects absolute pointer movement for paddles. Both share the owning game’s abort signal.bindPausepauses on hide, blur and page hide; explicit resume waits one second. Its injectedafterport makes countdown tests deterministic.createRecordsstores pace and best score/replay through the game'sGameStorage. Another rules version discards the replay and retains the score.createGhostowns an independent state and RNG. Calladvance(liveTick)for the ghost view; it never dispatches to the live runner. Inputs use the runner's zero-based tick convention.mountArcadecombines the Gyral HUD with these helpers. A game supplies its status, input mapping, score and a lazy renderer factory. Daily locks pace and omits ghost races.createControlDrivers,resumeAfter,bindPagePause,swipeDirectionand the direction maps let existing games adopt the helpers without changing their public controls or rules.
Dispose every returned binding when its game leaves the page. Games import this package from
ui/ or render/. The design and performance budgets are in
host policy (Joystyk host reference).
