The two ideas the input revamp leads with, built in Ludic over the single-key poll every target already provides: - Action maps: gameplay reads named actions, not physical keys, so keys are rebindable and a scheme is data. Input.bind(action, key), Input.down/pressed(action), Input.rebind(action, from, to). - Deterministic record/replay: Input.poll() is the one per-frame input read; Input.record() captures the key each frame and Input.replay() feeds the tape back, so a run reproduces exactly — the seed of lockstep netcode. "Read input" and "read a recorded snapshot" are the same call. runtime/native/input.ludic (spliced when the new Input.* methods are used; pulls in core.ludic for rt_poll). emit_ns_call routes the methods to the @fn_input_* runtime; parse.ludic gates the splice. Seven docs/language pages; worked example + regression examples/library/input_actions.ludic (1 0 1 1 0 1 0). Full suite 75 passed, self-host fixpoint intact, no golden drift. The device layer (multi-key held, gamepads, touch, analog) needs a platform key-state backend and is tracked separately. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
850 B
Markdown
27 lines
850 B
Markdown
---
|
|
id: input-replay
|
|
name: Input.replay
|
|
category: input
|
|
kind: namespace-method
|
|
tokens: Input.replay
|
|
sig: Input.replay() -> void
|
|
tip: Replay recorded input; poll then reads the tape, not the device.
|
|
order: 7
|
|
ns: Input
|
|
member: replay
|
|
---
|
|
|
|
Rewinds the recording made by <a href="input-record.html"><code>Input.record</code></a> and switches to <em>replay</em> mode: each subsequent <a href="input-poll.html"><code>Input.poll</code></a> returns the next key from the tape instead of the live device, so the recorded session runs again exactly — deterministic replays, demo playback, and the basis of rollback netcode. Past the end of the tape, poll reports no input.
|
|
|
|
```ludic
|
|
program Replaying {
|
|
entry {
|
|
Input.bind("up", 'w')
|
|
Input.record()
|
|
Input.poll()
|
|
Input.replay()
|
|
Input.poll()
|
|
if Input.down("up") { print(1) }
|
|
}
|
|
}
|
|
```
|