Skip to content

blocks: level-based gravity so it starts slow and speeds up per level - #17

Open
ebadger wants to merge 1 commit into
mainfrom
blocks-level-speed
Open

blocks: level-based gravity so it starts slow and speeds up per level#17
ebadger wants to merge 1 commit into
mainfrom
blocks-level-speed

Conversation

@ebadger

@ebadger ebadger commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Block Drop previously fell far too fast (~0.036 s/row, ~28 rows/sec) and never changed speed, because gravity used an 8-bit ldx #PACE counter whose period is capped at ~255 iterations.

This replaces it with a 16-bit per-level pace table so the game starts slow and speeds up as you clear lines:

  • 16-bit gravity countdown (gravL/gravH) reloaded each row from PACE_TBL_L/H, indexed by a new level value.
  • level rises every 5 cleared lines (capped at 15); shown as LVL:nn on the status line.
  • Calibrated to the emulator's ~1.02 MHz clock: level 1 ≈ 0.80 s/row ramping smoothly to level 15 ≈ 0.09 s/row.

Verification:

  • node codegen/tools/blocks.test.mjs — all sections pass, including new section E which times the level-1 fall (~0.81 s/row) and checks the curve is monotonic.
  • In-browser editor E2E (Block Drop ?src load) passes.
  • Refreshed both committed binaries (emulator/AICodeGen/blocks/blocks.prg and web/programs/blocks.prg, byte-identical) and updated the prompt/README docs.

The change was originally committed onto star-swarm, whose PR (#16) was already merged; this moves the single fix commit onto its own branch for review.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

Block Drop fell uniformly too fast because gravity used a fixed 8-bit
ldx #PACE counter, which caps the period at ~0.06 s/row no matter the
value. Replace it with a 16-bit gravity countdown reloaded each row from a
per-level pace table (PACE_TBL), so the fall starts gentle and accelerates.

  * Level rises with lines cleared (LINES_PER_LEVEL = 5, capped at 15) and is
    shown as LVL:nn on the status row.
  * Pace curve (calibrated against the emulator's ~1.02 MHz clock and verified
    headlessly): level 1 ~0.80 s/row -> level 15 ~0.09 s/row.
  * blocks.test.mjs gains section E (level display, monotonic pace ramp, and a
    timed level-1 row confirming the slowdown); gravity/accumulation checks now
    force a fast level via pokes so they stay quick.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant