Clickr

Clickr is a minigame redstone contraption. A lectern faces the player showing a written book containing one hundred pages. The player’s goal is to flip through that book as fast as possible. After reaching the last page the player’s score is readable from the number of items in the hopper.

Formulating the Game

Finding an Item

The original idea was to create a game about clicking as fast as possible0.

(0) To pay homage to the car washing minigame from Animal Crossing.

Objects like …

Were evaluated for allowing quick, readable inputs (by redstone signal or observer). One flaw of using these blocks though is that, like the backspace key, they repeat input on their own. This happens 5 times per second1 with the mouse button down.

(1) Measured in creative: in 60 seconds my avatar flipped a trapdoor 302 times.

While it’s possible to click faster than this auto rate (I could do 7 times per second2) it is not by a fair margin. With too high a floor performance players might not feel compelled to compete.

(2) Clicking on my trackpad. Any old online click speed test can measure this rate for you.

The project’s saving grace came in the form of a BlockEntity, or rather the item in that BlockEntity. The buttons to change page in written books take discrete clicks.

Substituting lecterns in place of levers and trapdoors revealed a greater issue. Observers can only make so many observations per second.3

(3) I built and destroyed many redstone contraptions before discovering this problem. I’ve omitted those failures, but know it took days if not a week to find this “bug”.
Clicks Per Second Clicks Observed4 Trial 2 Trial 3
5.00 64 64 64
6.00 64 64 64
6.0625 63 63 63
6.125 62 62 62
6.25 60 60 60
6.50 55 58 55
7.00 49 48 49
(4) Tested in game with a small lineup of blocks barrel < dropper < observer < lectern. This program clicked an exact number of times per second using the java.awt.Robot class.

One solution to this limitation is to think about the point of measuring clicks. Instead of counting each one it’s enough to track progress towards a clicking goal. A lectern’s redstone signal by comparator or surprisingly without one5 gives just that.

(5) This was another surprising property that ruined prototypes. Lecterns emit a signal lasting a single game-tick. That’s hard to spot!

How It Works

Hoppers

Only two hoppers lie at the center of this machine.

|---------------|----------|
|               |          |
|               |          |
|               |          |
|               |          |
|               |          |
|               |          |
|     |⇓|       | v feed   |
|     |⇑|       | ^ display|
|               |          |
|               |          |
|               |          |
|               |          |
|               |          |
|               |          |
|---------------|----------|
(6) Let me know what you think about representing redstone only with unicode. Is it enough?

States

The stopwatch has four desired states.

(7) The init state isn’t necessary. The state IS useful for simple input protection. It was desired to …

Four different states requires at least two bits of memory. This is best achieved with RS latches. These can be set (turning the bit ON), and reset (turning the bit OFF).

|---------------|----------|
|               |          |
|               |          |
|  ┋-o ┋        | ready SR |
|  ┋ o-┋        |          |
|               |          |
|               |          |
|     |⇓|       |          |
|     |⇑|       |          |
|               |          |
|  ┋-o ┋        | freeze SR|
|  ┋ o-┋        |          |
|               |          |
|               |          |
|               |          |
|---------------|----------|

Here is how the freeze and ready bits interpret to stopwatch states. The table includes reminders for which state requires what from hoppers.

READY TRUE8 READY FALSE
FREEZE FALSE INIT CLEAN-UP
FEED OFF FEED OFF
DISPLAY N.A DISPLAY ON
FREEZE TRUE PLAYING FINISHED
FEED ON FEED OFF
DISPLAY OFF DISPLAY OFF

(8) NOTE two things about this table …

This is possible in redstone by …

|---------------|----------|
|               |          |
|               |          |
|  ┋-o ┋        | ready SR |
|  ┋ o-┋        |          |
|      ┋        |          |
|      ┋        |          |
|  ┏ ┅|⇓|       |          |
|  ┋  |⇑|       |          |
|  ┋   ┋        |          |
|  ┋-o ┋        | freeze SR|
|  ┋ o-┋        |          |
|               |          |
|               |          |
|               |          |
|---------------|----------|

Transitions

The stopwatch is only useful if its state can changed.

There are four desired transitions9.

  1. From init to playing.
    • After the player flips past the starting-line page.
  2. From playing to finished.
    • After the player reaches the end of the book.
  3. From finished to clean-up.
    • After the player leaves the last page.
  4. From clean-up to init.
    • After the display hopper is emptied out.
(9) Compare this with the state and bit table. Every transition changes only one bit.

This is possible in redstone by …

  1. A rising-edge detector.
    • The detector will watch for the lectern increasing in power (to power 2).
    • The detector will set the freeze bit to TRUE.
  2. A direct line redstone line of lectern power.
    • This line of redstone will snake out to increase its length10.
    • It will reset the ready bit to false exactly at max power 15. If the line is shorter than 15 blocks it will reset the bit too early.
  3. A falling-edge detector.
    • The detector will watch for the lectern decreasing in power (to power 14).
    • It will reset the freeze bit to FALSE.
  4. A NOT gate on the comparator output of the display hopper.
    • This will set the ready bit to true (when there are 0 items in the display hopper).
(10) This could be done without long redstone lines by using comparators. I prefer long lines since they have no delay.

These redstone choices also mirror the transitions to the other side of the state table. In each case the effect is rare if not impossible to trigger11.

(11) I chose these 4 transitions precisely because they were safe on the other side of the table.

For example, the transition from finished back to playing if the display hopper is empty is OK. Players are not expected to finish the game with zero items in display. In fact, it would be incredible! Zero items indicates a stopwatch time of zero.

Ignoring this issue enables the simplicity of this contraption.

state transition state
INIT → book power is 15 → CLEAN-UP
INIT ← display hopper mt ← CLEAN-UP
↓ book power past 2 ↓ book power past 2
book power off 15 ↑ book power off 15 ↑
PLAYING → book power is 15 → FINISHED
PLAYING ← display hopper mt ← FINISHED
|---------------|----------|
|      ┏┅┅┅┅┅┅┅┓|          |
|      ┋       ┋|          |
|  ┋-o ┋       ┋|          |
|  ┋ o-┋       ┋|          |
|  ┋   ┋       ┋|          |
|  ┋   ┋       ┋|          |
|  ¡  |⇓|  x┅┅┅┫| note new |
|  █┅<|⇑|  ┋   ┋| redstone |
| old  ┋  |↓|  ┋| ontop    |
|  ┋-o ┋  |⇑|  ┋| old in   |
|  ┋ o-┋   ∇   ┋| this pic |
|┏┅┛   ┗┅┅┅█   ┋|          |
|∆             ┋|          |
|⇒⇐┅┅┅┅┅┅┅┅┅┅┅┅┛|          |
|---------------|----------|

In edge detectors using hoppers the item used is a sword.12

(12) With normal items, this would limit signal strength to 1. Swords produce a signal of strength 3.

The Book Itself

The current page (P) and total number of pages (M) determines the signal strength of a book in a lectern.

(13) I read this formula like this …

This formula has some effects …

To make a long game the book needs to be long. At the same time, a round number of clicks to complete the game is desirable as well. For example, a race to the fastest 100 clicks is easy to advertise. A race to the fastest 94 isn’t.

100 clicks is off limits since there can only be 100 pages total. The next round number is 90.

TOTAL PAGES FIRST POWER 2 PAGE14 TOTAL CLICKS
M S = CEIL((M - 1) / 14) + 1 M - S + 1
90 8 83
91 8 84
92 8 85
93 8 86
94 8 87
95 8 88
96 8 89
97 8 90
98 8 91
90 8 92
100 9 92

(14) This is how I derived the first power 2 page from the total number of pages.

The written book placed in the lectern should have exactly 97 pages. The “starting line” then is page 7. The stopwatch starts when the player reaches page 8.

Bugs

Cropping out a piece of the state transition diagram …

CLEAN-UP
↓ book power past 2
book power off 15 ↑
FINISHED

It is possible for players to stop clean-up and set the machine to the finished state.

If during clean-up players flip from page 7 to 8, then they must flip backwards from page 97 to 96 to restart clean-up.

Extra Modifications and Extensions

Here are some ideas for future builders.

Competition

Instead of filling a display hopper, the feed could fill chest minecarts. A vertical stack chest minecarts would make a good leaderboard. And wouldn’t it be cool to make redstone to sort that leaderboard?

Simplification

Trusting players to move items back into the feed hopper would simplify the redstone.

Book Art

97 pages is a lot to decorate. These pages will likely be blank without help from robots. The medium shade and full block characters can combine to make a cool progress bar15. The java.awt.Robot class can write them.

(15) I used the medium shade and full block elements because in the Minecraft font they rend with the same width.

The attached program also does a little extra on the first page. Random formatting codes and random elements combine to something resembling art.

The art on the first page looks like this.16









(16) Getting this art into HTML was tricky. I used another script to convert the Minecraft text to <span>’s.

The progress bars look like this.

   ████████████
   ████████████
   ████████████
   ██████▒▒▒▒▒▒
   ▒▒▒▒▒▒▒▒▒▒▒▒
   ▒▒▒▒▒▒▒▒▒▒▒▒
   ▒▒▒▒▒▒▒▒▒▒▒▒
   ▒▒▒▒▒▒

Gameplay

A few notes on Clickr gameplay itself.

Reception

I deployed this game on my homeserver of Thugcraft.

I noticed that players wanted to …

Some players aren’t ready to spam-click. Keep two stacks of items in the feed for slower first-timers.

Tips and Tricks

To play the game effectively …