GamesByEmail.com 
Correspondence Gaming Headquarters
GamesMy TurnsMy GamesMy ProfileLog Off

May thy dice chip and shatter

Other News

Introducing the Dice-O-Matic mark II, now generating the die rolls on GamesByEmail.com. It is a 7 foot tall, 104 pound, dice-eating monster, capable of generating 1.3 million rolls a day.

Currently, GamesByEmail.com uses some 80,000+ die rolls for play in games like Backgammon, Gambit (a RISK clone), W.W.II (an Axis & Allies clone) and others. To generate the die rolls, I have used Math.random, Random.org and other sources, but have always received numerous complaints that the dice are not random enough. Some players have put more effort into statistical analysis of the rolls than they put into their doctoral dissertation.

A few years ago I tinkered with a dice rolling machine made from Legos. Though great fun, it was noisy and cantankerous and unreliable, and it never recovered from the move two years ago. But it had made players happy, at least for a while. So I decided to make a 'professional' grade rolling machine.

I had been slowly accumulating parts for over a year when I put out a plea for financial assistance. Many players donated small amounts, and a few made some over-the-top donations. I also received a large donation of the elevator parts. The help allowed me to gather the last and most expensive bits, and four months of spare time later, everything is working better than planned.

I had a soft target of a machine capable of 200,000 rolls a day, as site traffic is growing. However, any automation project worth doing is worth over doing, and I way overshot the mark. The result is what you see here: a machine that can belch a continuous river of dice down a spiraling ramp, then elevate, photograph, process and upload almost a million and a half rolls to the server a day. I may not get nominated for a Nobel prize, but the deep rumbling vibration you feel more than hear when two rooms away is quite impressive.

There is no doubt that I will still receive complaints about the rolls, but now I can honestly say I have done all that I can possibly do: the rolls you get are exactly as random as those you would get throwing by hand. As I promised earlier, if you donate to the site and are unhappy about the rolls, let me know and I will pull a die out of the machine, melt it flat and mail it to you, as an object lesson to the other dice. Tangible revenge.

Details of the Dice-O-Matic

The Dice-O-Matic is 7 feet tall, 18 inches wide and 18 inches deep. It has an aluminum frame covered with Plexiglas panels. A 6x4 inch square Plexiglas tube runs vertically up the middle almost the entire height. Inside this tube a bucket elevator carries dice from a hopper at the bottom, past a camera, and tosses them onto a ramp at the top. The ramp spirals down between the tube and the outer walls. The camera and synchronizing disk are near the top, the computer, relay board, elevator motor and power supplies are at the bottom.

The dice start the cycle at the top of the ramp, toward the rear of the machine. The ramp is comprised of ten steps, each at about a 20 degree incline, with a right hand thread through two and a half spirals. Two layers of cloth covered foam (car headliner) keep the noise down. Felt covered foam quarter-obelisks are at each corner, sewn to the side padding. It took a few tries to get the pitch just right. Too shallow and the dice stopped tumbling, too steep and they would start banging against the Plexiglas. Now they roll very well, sometimes stopping and then getting knocked back into the stream. Perfect.

The hopper at the bottom of the ramp is pure seething violence. I am sure there is a better way to load the dice into the buckets (vibrating tables and all that) but not in the budget and footprint I have. Instead, buckets come up through the bottom of the hopper, smashing their way through the accumulated pile of dice and scooping some up. It is rather hard on the dice, much of the paint gets chipped from the edges of the pips. The buckets are close enough together that dice cannot slip through the bottom.

The 'buckets' are lengths of 1/2 inch aluminum U channel, about 5 inches long, attached to chains on each side. I cut grooves into each side of each leading edge, then slit and mounted plastic stir straws to reduce the noise and impact levels. Up to six dice can fit on a bucket, and tend to ride at a neat 45 degree angle.

The chains and attachment links are the key to the whole machine. The chains are ANSI-35 with A-1 attachment links every tenth link. I had a number of false starts with cheaper ladder chains and homemade attachments, but they simply were not up to the strain, always stretching and rattling apart. After getting the professional grade hardware, the design changed so much for the better. The hopper, buckets, and camera became a simple, streamlined sequence all from using the proper chain.

The two chains ride over 20-tooth drive sprockets at the top and bottom, powered by a car power window motor on the bottom shaft. The motor and sprocket shaft are coupled using a short piece of vinyl tube and some hose clamps. This gives some leeway in the motor-shaft alignment and provides a simple slip clutch in case something jams.

The buckets rise pretty fast, traveling over a foot per second. It takes about 5 seconds to go from the hopper to the camera near the top. Along the way there are plastic flaps to beat against the dice and make sure they have settled properly into the buckets.

Had you told me two months ago that getting the dice settled into the buckets would be the trickiest part, I would have called you insane. Processing the picture, probably. Getting them reliably into the buckets to begin with, maybe. But getting them settled once they are in, when they have tendency to settle properly anyway? What is the big deal? The deal is that some orientations you would not believe even possible, much less stable, turn out to be ridiculously frequent. A die will happily rise out of the combat-fury that is the hopper, land on an edge, and ride on that edge all the way up five feet of vibrating chain. I have seemingly impossible pictures of dice posing quite daintily on their corners, thwarting the camera by not showing a face. It certainly helped me appreciate the fine art that is automated orientation.

A machine vision/inspection camera is near the top of the elevator, looking down at a 45 degree angle to match the dice in the buckets. 20 bright white LEDs surround the lens so that the exposure time (1/2000th of a second) is short enough to eliminate any blurring.

The synchronizing of the exposures is accomplished using the camera's external trigger connection. As mentioned, the buckets are 10 links apart and the sprockets have 20 teeth, so two pictures are needed for each rotation of the shaft. A disc with two slots 180 degrees apart rotates between an infra-red LED transmitter/receiver pair on a home-built circuit, and the pulse triggers a snapshot.

After the picture is taken, the buckets crest over the top sprockets, which throws the dice out onto the ramp. In all, it takes about 13 seconds for an individual die to make a round trip. There are 200 dice in the machine, each rolling four times a minute, totaling over 1,330,000 rolls a day.

The dice are not true "Michigan Red Eyes" as I had earlier thought, but have different colored pips for each value. The different colors make it pretty easy to count rolls. For example, if 6 yellow dots are found in the image, there were three 2s rolled, no need to worry about determining the proper grouping or orientation of pips.

The images captured by the USB camera are processed by software I wrote in .NET. The camera comes with a nice software development kit with a ton of features, and you can fine tune every aspect. Because the computer cannot quite keep up with the elevator at full image resolution, the images are sampled every 3rd pixel horizontally and vertically.

The image processing begins by looking for the bright white of the dice. This eliminates everything except the faces toward the camera, and these are the areas of interest. Inside those areas are holes of darkness. The size of the hole determines whether it was a pip or not, and how many pips it represents (sometimes the pips of 6s bleed together). The average color of the pip determines the value it represents. The pips are then counted left to right and rolls the determined. The data is uploaded to the server via wi-fi in blocks of 1,000 rolls.

The program also controls the power to the lights, camera trigger and conveyor motor using a slick little USB relay board. When the server has enough rolls in the bank to last for a few weeks (I am currently storing a million or so), the conveyor shuts down until needed again. It runs for maybe 1.5 hours total each day.

Downloads | Developers | News | Donations | Privacy | Comments | Information | Copyright