Archive for June, 2021

Shaker Dice and Edge Labelings

June 21st, 2021

Last year I saw an interesting Kickstarter campaign for “shaker dice”. The product was shaped like a credit card, with a number of reservoirs with tiny balls. Instead of tossing, you would shake the device and then read off random numbers based on where a specially colored ball ended up in a channel below the reservoir. When the campaign failed to fund, I felt pretty motivated to produce my own version, for a couple of reasons. First, it used lasercut plastic. This is a medium I’ve used for a bunch of puzzles, so I felt that the design work would be pretty straightforward for me. Second, they just got the implementation all wrong.

This was the top image on the campaign page for that Kickstarter. The first clue that they didn’t understand their market is they thought folks would not want more dice.

To see why I thought that, let’s take a step back, and consider what the function of dice actually is. It seems obvious, at first glance, it’s just to produce a random number. But I’d argue there’s more to it than that. Games are social; what you really want is to communicate a random result to other people around a table. This is why you can expect to get a bit of side-eye if you bring a D-Total to a D&D night.

It’s eighteen dice in one! Want to know what number I just rolled? It’s really simple, just read the included manual.

The biggest problem with No More Dice is that because it produces a large number of different results at the same time, it doesn’t communicate which one is the one you care about. So the first change in my design was to split each die into a separate item. I also wanted to increase the size of the balls and the numbers at the positions where the balls end up, in order to make the dice readable from farther away. There was an important practical limitation; the thickest available plastic sheet for the middle layer was 4.9mm thick, so I was looking at 4mm balls. That’s not really enough to make numbers that are readable from across a table, but at least you can see the positions of the balls reasonably well.

At this point, it became clear that the size of the dice was going to be an issue. Even a d4 would be bigger than most regular dice; a d6 would be huge, and d10 or above would be entirely impractical, once we consider that you’d be carrying each of the standard RPG dice together as a set. Getting to a full set of dice that gamers might consider reasonable was going to take a bit of creativity.

My first observation was that I could abandon the biggest selling point of No More Dice: that you didn’t have to toss them. Early on, I decided that I wanted there to be a bit of padding on the back of the dice so you could set them down on a table and let gravity hold the balls in place at the bottom of the channel. But if there was padding on the front side as well, and the dice had numbers on both sides, and you could toss them… my d4 could also be a d8. Uh oh. Multiple functions? Was I heading down the dark path to the D-Total? It’s a fair worry, but, most importantly, the result requires no interpretation. It’s still just the number above the specially colored ball. Second, the physical gesture used communicates which die was rolled. If I shook it and set it down, it was a d4. If I shook it and tossed it, (so it could land on either side with equal probability) it was a d8.

That idea was enough to get me most of the way to a full set. The same principle could give me a d6/d12, and a d10 with 5 balls. (The d10 could also be a d5, but since that isn’t a standard die, it seemed better to balance the numbers by putting the odds and evens on opposite sides.) Two problems remained. The d6/d12 was bigger than I wanted it to be, and there was just no reasonable way to get a d20.

There was a good reason to hope that solutions existed. Having only one ball be distinguishable from the others leaves a lot of potential information unused. In principle, with 5 balls of different colors, there are 5! permutations, or enough for a d120. Just one that requires a manual to decode a numerical result from the permutation. If only there was a genuinely good die-roll decoding technique. Something where a single symbol would be enough to tell you how to find your result, no manual required. Something that gamers already do all the time with the results of dice rolls. Something like basic arithmetic.

In fact, the answer was a mathematical structure that I already knew about, in another context. A perfect Golomb ruler is a way of marking a line with n marks such that each of the integers between 1 and n choose 2 is one of the distances between two marks. One perfect Golomb ruler with 4 marks is {0, 1, 4, 6}.

Another model for the same structure is a “graceful labeling” of the edges of a complete graph. We label the nodes with integers, and the edge labeling is induced by taking the absolute difference of the nodes on that edge. By using two specially colored balls whose positions correspond to nodes on the graph, the edges give us our die-roll results. Slap a minus sign on the die, and what you need to do is clear enough.

That allows us to have a d6 that is the same size as the d4, but now we’ve lost the d12 that occupied the same die. Can we get it back? Not with a graceful labeling, unfortunately, but if we use addition rather than subtraction on the other side of the die, we can get all of the numbers between 7 and 12 using {3, 4, 5, 7} as our set of numbers on the other side.

We could, in fact, have used addition on both sides of the die, as the sums from {0, 1, 2, 4} also give us 1 through 6. Complete edge labelings induced by addition have been studied by mathematicians as well: they’re called “harmonious labelings”. (The usual definition uses addition modulo the number of edges. I didn’t think gamers were likely to put up with mod though, so I’m not using it.) While I could have gone with the design with addition on both sides, I ended up preferring the one with a plus side and a minus side, mostly because it echoes what I used for the d20.

Right, the d20. Taking 5 choose 2 gives us 10 for the number of possibilities given two specially colored balls out of five. It would be really great if we could pull off the same trick that we used for the d6/d12, by getting 1 through 10 on one side of the die and 11 through 20 on the other side. Alas, no combination of addition and subtraction on the two sides of the die will allow this. However, if we remove the requirement to have it also be a d10 we can get all of the numbers for a d20 with addition on one side and subtraction on the other. I wrote Python code using Google’s or-tools constraint solver to find valid numberings; the one I went with is {0, 1, 5, 18, 20} on the minus side and {1, 2, 5, 7, 9} on the plus side.

And that’s the entire set of standard RPG dice! It worked out pretty nicely that the whole set could be done with just two different sizes of the same design, each with a one dark ball version, and a two dark ball version with extra arithmetic.

As a coda, I did put some thought into what could be done with 6-ball shaker dice. One dark ball gives us my original d6/d12 design. Two dark balls gives us 6 choose 2 = 15, from which we could make a d15 or d30 if any solutions existed. But they do not. Three dark balls — well that would be ridiculous. 6 choose 3 is 20, so you could get an alternative d20 that didn’t require tossing, or a d40 that does. But what would you even do for labeling such a die? I settled on adding the two outside numbers, and subtracting the middle one. A d20 wasn’t possible, but a d40 was:

It’s utterly chonky, and makes you do an entirely unreasonable amount of arithmetic, all in order to give you a die that absolutely nobody needs — and I kind of love it.