D20 AutoRoller

I’ve had this idea rolling around in my head for a few months, but it was watching the VOD of !!Con (BangBangCon) that finally pushed me write this post and really begin to figure out how to start tackling this project rather than just have it stuck in my head.

The What

In 2009, the website PlayByEmail, built a robot called the Dice-O-Matic to roll a bunch of D6 dice to use as the random numbers used on the website rather than rely on digital random methods. Beware your volume, this video is rather loud as the Dice-O-Matic is loud.

I’ve always loved this idea. Not that I don’t trust digital randomness to be random-enough, but I love the idea of a tangible dice machine that could generate random numbers for use in virtual D&D or simply as a random generator.

What I would ideally love is actually something more akin to a desk sculpture, something that is compact enough and quiet enough, that I could set it up on my desk and let it run. Have it as a conversation piece and distraction.

The Why

Necessity is the mother of invention. But necessity also removes a playfulness and freedom from this sort of project. On the one hand, I have no timeline for it. I have no hard deadline.

This is a purely fun project that I can come back to from time to time and no requirement for ongoing attention. It’s something I can fiddle with.

And I have learned, one of the keys to my own sanity, is to have exactly this sort of project.

On top of that, this is a project which will require a number of learnings, and honestly that is super exciting to me. I understand the concepts of almost everything in this project, and yet I look at it and realize there is almost no part that I can pick out and go, “I know exactly how to do that.”

The How

I’ve done a few iterations, but I would really consider this my first concept sketch for this project.

A – This is the roller box. It has a unique shape.
B – A D20, a twenty-sided die
C – In the roller box, these are stairs or ridges, high enough to agitate the dice and ensure it tumbles rater than just slides
D – A motor mounting on the box which is used to rotate the A box 90 or degrees in a back and forth motion. I have it pictured outside here, but I imagine it is probably attached behind it or done smartly to minimize space it takes.
E – This is a pair of webcams which will capture the upward face of the D20.

Not pictured: Raspberry Pi controller for activation of the motor as well as the processing the d20 cameras and recording the results.

In terms of size, I’m imagining it is 12″x12″x6″ or so. I doubt the first iteration will get down to that size, but I won’t consider it done until it fits into that space. Maybe I’ll find that’s just not doable, but I have to believe it is.

The D20 part of this project is something that could be interesting. One of the things The Dice-O-Matic did was it used a brand of D6 which had color-coded faces to aid in the computer-vision reading of the upward facing side.

So, I am wondering if I might need a blank D20, and then develop a color-coding / simple patterning for computer vision readability. An example could be, Red X = 1, Blue X = 6, Yellow X = 11, Black X = 16. Red O = 2, Blue O = 7, etc.

It could also be that computer vision processing has progressed far enough since the days of the Dice-o-matic.

Once I have the visual processing figured out, then comes the question of what to do with the D20 rolls. I assume I just keep it in a running text file and then can pull from it whenever I need a d20 roll for D&D online. Or maybe something else, no idea.

Humorously, what to do with these rolls is not something I really care that much about.

What’s Next

So that’s the idea. Here’s my sketch of what I think my process will be:

  1. Build the roller box.
  2. Figure out motor solution for rolling the box back and forth
  3. Attach Raspberry Pi to control motor
  4. Attach cameras and solve computer vision of rolling result tracking
  5. Implement full control and tracking of rolls

Simple enough, Right?

We’ll see.

(We all know it’s not going to be that simple, right?)