modtris
modtris · gamesInteractive Tetris-clone game module (single-user research prototype). Five gate inputs (rotate_l / rotate_r / drop_fast / move_l / move_r) are rising-edge triggered to play the game; two gate outputs fire one 5 ms pulse per event — line_cleared (a Tetris emits four separate staggered pulses, one per line) and overfill (game over). Game logic runs at visual cadence on the main thread (no audio worklet), with a deterministic, tested state stepper. Patch a sequencer or controller into the inputs and route the cleared-line / overfill gates as triggers, turning gameplay into a modulation source. See docs/design/game-modules.md.
the faceplate
5 inputs · 2 outputs · 2 params
inputs
| id | cable | what it does |
|---|---|---|
rotate_l | gate | Rotate the current piece counter-clockwise on each rising edge — one quarter-turn per pulse (acts on the leading edge only, so a held gate rotates once). gate / trigger; trigger — fires once per rising edge |
rotate_r | gate | Rotate the current piece clockwise on each rising edge — one quarter-turn per pulse. gate / trigger; trigger — fires once per rising edge |
drop_fast | gate | Hard/fast-drop the current piece on each rising edge — slams it down a step (or to the bottom) per pulse, locking it sooner. gate / trigger; trigger — fires once per rising edge |
move_l | gate | Move the current piece one column LEFT on each rising edge — one cell per pulse. gate / trigger; trigger — fires once per rising edge |
move_r | gate | Move the current piece one column RIGHT on each rising edge — one cell per pulse. gate / trigger; trigger — fires once per rising edge |
outputs
| id | cable | what it does |
|---|---|---|
line_cleared | gate | Fires a 5 ms pulse for each line cleared — a single clear is one pulse, a Tetris (four lines at once) emits FOUR distinct staggered pulses so a downstream counter or envelope sees each line. Patch into a drum/envelope trigger to sonify clears. gate / trigger; trigger — fires once per rising edge |
overfill | gate | Fires a single 5 ms pulse when the well overfills (a piece locks above the top = game over). Use it as an end-of-run trigger — fire a sound, reset a scene, or restart another module. gate / trigger; trigger — fires once per rising edge |
params
| id | label | range | default | curve |
|---|---|---|---|---|
gravityBpm | Drop | 30..240 | 60 | log |
levelStep | Lvl | 1..20 | 10 | linear |
controls
| control | what it does |
|---|---|
| Drop | DROP gravity tempo in BPM (30..240, log, default 60) — how fast pieces fall on their own before the LVL ramp is applied. Higher = faster, more frantic stacking (and a denser stream of LINE/OVERFILL pulses). It is read on every scheduler tick, so a move lands on the next drop rather than the next piece. MIDI-learnable. |
| Lvl | LVL threshold (1..20, default 10) — how many cleared lines it takes to advance a level. Each level multiplies the time between automatic drops by 0.85, so the game gets ~18% faster per level on top of whatever DROP is set to, down to a floor of 50 ms per row. Lower = a steeper difficulty curve: at LVL 1 every cleared line speeds the game up. It applies to the RUNNING game — the level is re-derived from the line count on every tick, so moving this fader mid-game re-prices the ramp immediately rather than at the next level-up — and an overfill resets the line count, and with it the level, to zero. MIDI-learnable. |
source
modtris.ts on GitHub.