44 lines
1.1 KiB
Markdown
44 lines
1.1 KiB
Markdown
# Input Mental Model
|
|
|
|
Status: pedagogical
|
|
Companion spec: [`../specs/06-input-peripheral.md`](../../specs/06-input-peripheral.md)
|
|
|
|
PROMETEU treats input as sampled state, not as an asynchronous event.
|
|
|
|
## State Versus Event
|
|
|
|
The most important model to understand is:
|
|
|
|
- a button does not "fire" an action by itself;
|
|
- a button changes state;
|
|
- the game reads that state during the frame.
|
|
|
|
That looks much more like classic console register polling than like modern UI callbacks.
|
|
|
|
## Why This Matters
|
|
|
|
This model:
|
|
|
|
- improves determinism;
|
|
- simplifies replay;
|
|
- makes debugging easier;
|
|
- makes the frame loop easier to read.
|
|
|
|
It also fits PROMETEU's identity better as a machine strongly inspired by retro hardware and DIY construction.
|
|
|
|
## Good Habits
|
|
|
|
- read input in `UPDATE`;
|
|
- map actions, not physical keys;
|
|
- separate input reading from heavy logic;
|
|
- treat polling as part of the frame budget.
|
|
|
|
## Teaching Value
|
|
|
|
The input peripheral helps teach:
|
|
|
|
- the difference between state and event;
|
|
- temporal sampling;
|
|
- synchronization between input and logic;
|
|
- determinism in interactive systems.
|