Skip to main content

· 4 min read
Frank Ali

Happy New Year. The start of the year has been very exciting with the controvesial changes being considered for Wizards of the Coast's OGLOpen Game License. I have been considering what I want to accomplish with this project this year. Since there's been so much upheavel in the TTRPGTable Top Role Playing Game space, I'm anticipating the development of many new apps using many other game systems. With that in mind I'm hoping to support more types of dice rolls to satisfy everyone's needs as best I can. With that I think I have a decent roadmap for version 2.0 of Fantastic Dice.

Last year ended with me digging into deterministic rolling. I think this will be the most important feature to get right and will open up this project as a viable option for more developers. There are pros and cons to engineering the deterministic setup, but I think the pros outweight the cons considerably. I started by developing dice-box-threejs. This project was based on Major's 3D Dice which was based on Teal Dice. I undertook this project to both understand the deterministic approach used as well to assist others who needed this feature right away. It does not have all the features or optimizations that the original dice-box has, but it does work well enough and has been published to NPM.

Moving forward with determinism, I've chosen to swap physics engines from AmmoJS to Rapier which advertises itself as fully cross-platform deterministic. After dropping Rapier in, it became apparent right away that determinism was not working at all. After digging into the issue I think the root issue lies in the way I've set up the 3D environment to post messages to the web worker which adds collider objects to the physics world. Fixing this issue requires quite a bit of rework. It's going to be a big overhaul and a good starting point for version 2.0.

The second feature I'm hoping to tackle is redesigning the theme system. Currently it's a complicated multi-step process to make your own dice set. I'm hoping to improve on that. Originally, I opted to use Babylon JS's blender exporter plug-in to generate json data that was compact, easy to parse and could be gzip'ed. After exporting the blender data, I would still have to add additional information to the file to map the 3D mesh face id's to numerical values. Unfortunatly, the exporter has not kept up with blender releases. I think it's time to switch over to the more universally supported .fbx file type. This creates much larger files and requires additional BabylonJS plug-ins to load. The project will go well beyond the 1MB code delivery goal of version 1.0 (Rapier also contributes to a much larger package). However, I think it will allow for more flexibility when creating assests. Also, the .fbx format will allow for inclusion of 3D animations and effects. Additionally, this approach will allow creators to use the 3D software of their choice to make dice assets.

Next up are sounds. One thing I learned when developing dice-box-threejs was how to queue and play sound effects on collision events. I plan to port this behavior over and offer it as an opt-in config option or plug-in.

Another improvement I'd like to make (perhaps as part of the theme redesign) is finding a better way to determine which dice face is pointing up at the end of a roll and what value that represents. Not all dice use numbers and I want to make sure the new system is flexible enough for systems like fate or genesys. I'm also hoping I can find an elegant way to include this information in the 3D asset file.

Finally, I want to enable some post processing render effects in BabylonJS.

Stretch goal - implement a plug-in architecture for addons.

In summary, I'm very motivated by the OGLOpen Game License upheavle to create a better dice roller that supports more systems, is easy to customize and offers deterministic rolling for integration with back-end number generators. I also plan to make blog posts more frequently so others know this project isn't dead (My day job got busy the last few months). I hope it's a productive year.

· 3 min read
Frank Ali

Big announcement. Version 1.0 has been released! The "last few things" took longer than expected. I really wanted to rework how themes were handled internally so different dice models could be used. I dug into supporting "levels of detail", "HD textures", "mobile textures" and many other things involved with over-engineering an idea. I'm happy with what I settled on which accomplishes the original goal of supporting different dice models.

Now, @3d-dice/dice-box only ships with the 'default' dice theme. All other themes I've develop have been moved into their own project at @3d-dice/dice-themes. This way, users can grab the themes they want and simply drop them into their themes folder. I even made a few custom color themes that really utilize the alpha channel in the diffuse texture. I was able to crete both color configurable textures that had a gritty overlay with the numbers. Check out the Rust and Rock themes if you're interested.

One of the hangups in my "last few things" was discovering that the dice models I had purchased from Sketchfab and CG Trader had royalty free licenses, but redistribution was not allowed. Finding good license free game dice was a problem. Thankfully, I had been collaborating with the dev team at Quest Portal. They recently implemented dice-box into their virtual table top platform. This was a great experience and helped to really test the project's overall viability and production readiness. More on that in another post. Anyway, the team at Quest Portal was kind enough to help me out with procuring some license free game dice models. They are now the 'default' set. The default set will soon have a couple of bonus dice, including a d2 a fate die and a d6 with pips. However, while I was waiting on those dice to be produced, I decided to learn how to make my own dice set as well. I really wanted to show off the ability to use wildly different dice models in the project.

Dice models in Blender

I learned soo much about Blender. Thank goodness for YouTube. While it was a struggle, I was finally able to create two sets of 3D dice models. One is the "smooth" set and the other is the "gemstone" set. Carving the numbers out of the faces and then generating proper normal maps was a real struggle. After that the struggle continued as I attempted to create smooth low-poly assets, but I finally made it across the finish line. What we have now are two CC0 dice model assets.

Gemstone models in Blender

Some other great features in 1.0

  • New config option for illumination level
  • New config option for shadow transparency
  • A truly random auto-generated fallback for non-standard/unsupported dice such as d5
  • New config option to suspend the 3D animation and just get the random numbers (using the new random auto-generated fallback)
  • Support for fate dice
  • Improved error catching and error messages
  • Multiple other bug fixes

In order to avoid a wall of text, I'm going to wrap up here. There are many other new features that came with version 1.0. BabylonJS finally did hit version 5.0. Yay! So this release will benefit from all the performance improvements in Babylon as well. I hope other devs find this project useful and that I'm able to continue to developing useful features.

· 3 min read
Frank Ali

This is kind of like my own feature request post. There are a bunch of things that I still want to accomplish with this "side project" of mine. I'm going to leave some of those ideas here for future me.

  1. I just discovered Rapier.rs. This is a new physics engine built using Rust (and also documented using Docusaurus which this site uses as well). This looks like an amazing physics engine and something I certainly want to try. AmmoJS has been great, but development on the Bullet physics engine has slowed down and I think Rapier will be a quality successor. Check out this comparison on YouTube. Right now, the only bottleneck I get during playback is from the Bullet physics simulation at around 400 dice which still isn't bad.

  2. I would love to implement the sounds of dice rolling. I've been looking at other projects such as Dice So Nice and BabylonJS's own physics imposter implementation to see how I could implement the onCollideEvent to trigger sounds. Then there might even be different sound packages similar to Dice So Nice

  3. Special Effects. The great thing about having a 3D engine and digital dice is that the sky is the limit when it comes to effects. I would love to see exploding dice actually explode. I would like to see some sort of effect when critical roles are triggered. I'd also like to try to implement animated materials, such as water, or even animated dice, like clockwork steampunk dice with moving gears. Take a look at the Pride dice set from D&D Beyond. They get the idea.

  4. An easy one to do would be to implement some simple post-processing in BabylonJS, such as motion blur, anti-aliasing, or other fun effects

  5. On the "very near future" list is creating the Genesys Dice set. The new theme system in version 1.0 allows for rolling and identifying dice beyond their number type. So creating the Genesys set should be a good test for the theme system's flexibility. It will probably involve creating a new parser that I'm hoping to do as a true "plug-in". Soon to be followed by Legend of the Five Rings which I also enjoy playing.

  6. Also on the "very near future" list is an "additional dice" theme. I've got a set in the works that includes d2, d14, d16, d18, d20, d24, and d30. The modeling is almost complete. I still have to UV map everything which will be tricky. I really need to write a tutorial on how I make my themes from scratch.

  7. I'd like to make a few more UI modules as well, such as:

    • last "x" rolls - records the last few notations
    • theme picker - an easy interface for switching up themes and theme color
    • quick dice picker - similar to the dice table on Roll20
    • die roll distribution - roll results are saved to the browsers IndexedDB and processed to produce distribution graphs
    • favorite rolls - save a few frequently used notations
    • notation builder - a simple touch based ui to build complex notation

Well, that's it for now. Wish me luck.

· One min read
Frank Ali

It's been almost 2 years since I started digging into what it would take to build a fantastic dice roller that anyone could use in their own JavaScript projects. I've spend many hours optimizing this project so it would be both flexible and performant. I'm hopeful that it will gain traction and live up to expectations.

I have some more exciting features in que before hitting the version 1.0 switch. I'm also waiting on BabylonJS to hit version 5 this Spring.

This site will continue to be updated along the way.

Cheers!