# Side Quest: Simple Board Game Dice

As Game Designers and Developers, we sometimes find ourselves looking back at the games that came before. And in some cases, those games can come from times before computers and electronics. Many games worked on the same principles of randomness that games us today, but how did they achieve this before random number generators. Dice, of course.

Dice, have a history that goes back as far as 2800 BCE with evidence suggesting even further. And with board games being a popular choice for re-invention and re-imagining on mobile markets, how do we make good dice for our games? I suggest using the physics engine of your system of choice.

Problem: Physics based Dice for Board Game app.

Solution: Figure out what it facing up by knowing what is facing down.

The solution of figuring out what is facing up is simple when you consider that your die will always have the opposite side facing down. My usual go to is to attach small spheres to each side of the die and sink them in most of the way, leaving just enough for it to act a that side’s collider. Each Sphere gets the named for the side it is opposite to and has its collider set to Trigger. Once the spheres are placed how you want them, you can remove their Render and Mesh components leaving only the Transform and Collider.

Next you’ll need a field or mat for the die to land on. This can be plane with a collider and doesn’t even have to be visible to the camera or player. Now we can give our Die a Rigidbody and a Collider (Box will do for a 6 sided die like this) to get everything ready to work with Unity’s Physics.

As for the mass of the dice, I have found a online shop out of the UK that has nice sheet with the size and weight of all their dice and other tokens. Since the scale size Unity uses is in Metrics (Scale in Meters, Mass in Kilograms), we can easily scale the weight to the size of our Die. In this case, The die is a bit light and gives a slow motion feel to the roll. It could use a few more zeros for it’s meter cubed size.

For the detection of the side, we use an OnTrigger call attached to one of each side of the die and have the result sent to our Manager class. For this setup, I am using a DiceManager to receive and tally the results.

This class is attached to each of the Die’s collider objects and has a bit of flourish attached to pull the die through the detection surface after the result is detected.

And with this, we can add the UI elements and Control elements needed for whatever game we are making. As stated, for this example, I used a DiceManager to allow the Dice to communicate with the rest of the scene and the UI controls talk to the DiceManager.

--

--

--

## More from Thomas Kesler

A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.

Love podcasts or audiobooks? Learn on the go with our new app.

## Thomas Kesler

A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.