Button delay and repeat rate

I’ve just started looking at how the repeat works for the buttons. The on XX button block has pressed, released and repeat on it. The first two have obvious semantics but I wasn’t sure how repeat worked. In particular, I was concerned that it might be influenced by the settings of the o/s, possibly with per user customisation.

I found there’s a documented part of API for JavaScript programmers. I’m currently trying to stick to Blocks. I wrote some simple code to check the actual values including on PyGamer/Meowbit.


The values look consistent across simulator (beta beta, 0.14.2 5.21.5) and hardware which is nice. They also don’t appear to vary based on using mouse vs space bar in sim. Some representative values follow:

delay: 515
repeat 1: 20
repeat 2: 41
delay: 517
repeat 1: 38
repeat 2: 21
delay: 507
repeat 1: 41
repeat 2: 20

I found the docs for delay and interval. It would be useful for those to state the default values in documentation.

From the empirical data it looks like the repeat rate is both not guaranteed and unlikely to consistently match the set rate? Is the granularity the interval or 20ms? There’s not much going on in my code at least for first few repeats so I don’t think I can attribute the early jitter here to load from stuff going on in the app?

What’s the philosophy behind these default values? They look like values chosen for typing on a (QUERTY or similar) keyboard but Arcade is a keyboard-less environment. I’m not sure I see the justification for the lengthy delay value?

For my intended use I think I need to reduce the delay to be the same as the interval but I don’t think I can do this in Blocks?

I’d be interested to hear what others think of this feature and how they use it in their Arcade applications.

I added block to set button delay and interval to the controller extension a while back:

The timing for interval will always be approximate - which is also true for on game update intervals and other elements. The interval for all these timing based events can be thought of more accurately as a minimum delay before the event will repeat - if you set it to have a repeat interval of 100, it will never occur more than once every 100ms, but may take a bit longer.

1 Like