Skip to content

pocket blocks 1.5: frame clock instead of a shell loop, for battery - #527

Open
thucngyyen wants to merge 2 commits into
SimonSchubert:mainfrom
thucngyyen:pocket-blocks-frame-clock
Open

thucngyyen wants to merge 2 commits into
SimonSchubert:mainfrom
thucngyyen:pocket-blocks-frame-clock

Conversation

@thucngyyen

@thucngyyen thucngyyen commented Nov 20, 2026 •

Copy link
Copy Markdown

Pocket blocks keeps its 8-a-second gravity tick with a bash stream that runs sleep 0.125 in a loop. On the phone that means a process under proot forking eight times a second for as long as the app is open, paused or not, which drains the battery noticeably and makes input feel laggy.

This version counts the same ticks in every frame instead:

  • fps: mode == "play" ? 8 : 2, so 8 frames a second while playing and 2 between games, for the blinking PUSH START
  • no Linux process at all, so requires { bash, coreutils } is gone
  • a piece that has landed locks on the next tick (an eighth of a second) instead of at the next gravity step, up to a second at level 1, during which it could still be slid sideways
  • the blink now alternates every frame since it only shows outside play
  • owl goes from 11 to 21 for every frame, version 1.4 to 1.5

java -jar tools/owl.jar review passes. Played through on a phone: gravity, holds, pause and game over work as before.

Measured on the phone, the old loop used about 0.4 s of CPU per 10 s in bash alone (proot's own overhead on top), and only reached 69 of 80 ticks in 10 s, so gravity ran about 15% slow and unevenly.

Note: this changes an app under another author's folder, so the review check's ownership rule fails; the file itself passes.

🤖 Generated with Claude Code

… a shell loop

The 8-a-second tick came from a bash stream that ran sleep 0.125 in a loop, which
under proot keeps a process and the CPU busy the whole time the app is open, even
paused. It now counts ticks in every frame with fps 8 while playing and 2 between
games, so no Linux process runs and bash and coreutils are no longer required.
Needs owl 21 for every frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thucngyyen
thucngyyen marked this pull request as ready for review November 20, 2026 00:51
A piece resting on the floor or the stack only locked at the next gravity step,
up to a second at level 1, so it could still be slid sideways after landing. It
now locks on the next tick, an eighth of a second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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