JavaScript Animated D6 Dice Roller Code Released to Public Domain

The title says it all. The JavaScript Animated D6 Dice Roller was previously made available under open source licenses, but has now been released to the public domain via a CC0 Public Domain Dedication. If you have the urge to include an animated D6 dice roller in any JavaScript-based game, for any purpose, commercial or non-commercial, then grab a copy of the public domain JavaScript Animated D6 Dice Roller package and let it do the work for you! Okay, you have to install it and write code that makes calls to it, so look for the links to the tutorial and documentation on the download page.

I’ve added sample JavaScript and HTML files to the package, showing how you can build a DARO dice roller. (DARO = Doubles Add and Roll Over.) The interesting stuff is in daro.js. When you unzip the JavaScript Animated D6 Dice Roller zip file, look for the daro.html file; run it to see the DARO effect. Or you can try it right here.

Keep rolling until you get doubles.

Author: Michael K. Eidson

I'm a software engineer, an author, a digital artist, and a music lover. I've also dabbled with composing contra dances. I've written and published a few speculative fiction short stories, online tools for gaming and fiction, and a number of Tunnels and Trolls supplements and adventures. I'm continually working on my debut fantasy novel, currently untitled. I listen to all sorts of music, primarily with female vocalists, while I'm working on all my projects.

23 thoughts on “JavaScript Animated D6 Dice Roller Code Released to Public Domain”

        1. Hi, Shoaib. I’ve not used the jQueryDice plugin, but it looks straightforward. On the page you linked to, there’s a Demo link at the bottom of the page. Maybe you saw it. If you go to the demo page, you can view the source of that page to see how they set it up. Mimic that and change it to suit your needs. Hope that helps.

          1. Michael above mentioned demo has no multiple dice roll option like d6 animator. i want throw animation in d6 dice roll. can u put

            that animation in d6 dice roll.

          2. Hey, Shoaib. I don’t want to take away the fun from you or the opportunity to learn by doing. Moreover, there are licensing issues involved that prohibit me from combining code from the two sources and distributing it as public domain code. Can’t be done. So I have to leave it to you to create what you will for your own use. If you’re motivated enough, you can do it. Good luck!

  1. Hi, I found a little bug :S
    it happens when you get same face on every dice like:
    1,1 – 2,2 – 3,3 – 4,4 – 5,5 – 6,6
    it just dont stop rolling but it re-roll the dice and add the new result to the previous one.

    1. Hi, Grayfox, and thanks for stopping by.

      The sample embedded in this page is intended to re-roll the dice when doubles are rolled, as stated. That was done on purpose, so it doesn’t qualify as a bug, but as a sample usage of the software. When you use the JavaScript library in your own projects, you don’t have to set it up to re-roll doubles. That’s entirely up to you.

      1. Thanks for your answer, i was a little confuse but now it’s all clear. Works like a charm 🙂
        Thanks for your sharing 😀

  2. Thatz a kool animator dice program what you have developed. I liked it. Although I wanted a program which has 4 dice. Every dice has only two sides with 0 and 1 dots on it. The roll should result in 1,2,3,4 as regular score and 8 as dice score when all 0’s come on the dice roll. Please suggest if you may.
    Am trying to develop a non commercial traditional Telugu people’s game for academic purposes.

    Thanks in advance
    Pradeep

    1. Hi, Pradeep, and thanks for your feedback and request.

      To do what you need, you’ll have to tweak the code and supply new dice images.

      1. Create new images for the two-sided dice. You’ll have four images, one for 0 at rest and one for 0 in motion, and likewise with 1 at rest and in motion. Name these images according to the image file name patterns I used for the results 1 through 6, but using 0 and 1 instead of 1-6.

      2. For the code, you can modify the code that is producing a result from one to six. Before it processes/saves off the random number, simply mod the result with 2, and let that be the value processed/saved. The higher level classes that make use of the generated random number should handle it just fine.

      Without trying the above, I can’t say 100% for sure that’s all you’ll need to do, but I think it should be. To get the right number of dice, you’ll set that in the configuration of the dice roller. Hopefully the dice-roller documentation available on this site will suffice to instruct you on that detail.

      Good luck! I’d like to hear of your progress, if you don’t mind.

  3. Hi, two tumbs for this very good javascript but how we can trick and threat the output with my own number?

Any thoughts?