30 Days of Code — Day 10
Simple TTRPG Dice Roller
Hello! I hope everyone had a safe and relaxing Memorial Day. I stepped away from the project for the holiday weekend, but I am back and I want to talk about the features I plan to add going forward.
Users and Persistent Data
Being able to save complex rolls for easier re-use later has always been on the roadmap, but it requires the ability to save data and fetch it again later. I don’t love the idea of incorporating authentication and user management as it introduces a lot of complexity, but it seems like the best way to add the saved rolls feature and ensure it works across browser sessions and different devices.
That said, I don’t want people to feel like they have to create an account and hand over personal information (because let’s be honest, we all have too many different accounts these days), so if at all possible I want to try to create a version of the saved rolls functionality using local storage. It should work, but I may have to add a warning that it may get deleted if they clear the browser cache.
Discord Integration
A lot of people these days play TTRPGs remotely using Discord voice and text servers. It’s very common for people to use Discord bots for dice rolls in their channels. For that reason I want this dice roller app to be able to integrate with Discord and post the results of the user rolls to the channel of their choice.
I am fairly certain this will require an account, so likely it won’t be possible for users who opt for the local storage only option, but I think that’s a fair trade-off. I’m sure the integration is possible, but I will need to familiarize myself with Discord’s API as I’ve really only glanced at it. Maybe using SSO with Discord as the auth provider will make the integration easier?
Dice Calculator
I recently discovered an awesome app by developer Toby Coulstock called Dice Ex Machina. He created this really cool interface for quickly entering dice rolls that I absolutely love. My app currently requires constantly switching back and forth between the alpha and numeric keyboards, and it’s unclear if the user should use a lowercase ‘d’ or an uppercase ‘D’. Toby solves that problem by implementing a custom number pad:
This likely won’t make sense on desktop, but for mobile UI, this would be a game changer. I’m going to find a way to adapt this for my own dice roller.
Keyboard Shortcuts and Tooltips
A fancy number pad will be helpful for mobile, but desktop users would benefit more from keyboard shortcuts. Shortcuts should map different reusable/customized rolls, quick-selections, form submission (which is already set to Enter), an eventually rolls with dis/advantage.
Rolls with Advantage and Disadvantage
The concept of dis/advantage in TTRPGs is important. Basically it means that when you make a roll, you do it twice and either drop the lowest value or the highest value respectively. For example your dungeon master might allow you to roll a persuasion check with advantage if your character is an elf talking to another elf. In that case you would roll 2d20s, and keep whichever result is higher (ex. [5, 14] = 14). You might have to roll at disadvantage if your character is a dwarf in that scenario and then you’re stuck with the lower result (ex. [5, 14] = 5).
A user could do this now by rolling 1d20 twice and ignoring one of the results, or by rolling 2d20 and looking at the resultsArray and ignoring the final (summed) result, but we can make this easier for them by returning letting them specify if it’s with advantage or disadvantage.
Looking Ahead
These upcoming features aim to make the dice roller app more versatile and user-friendly. Your feedback is invaluable as we continue to develop and improve the app. Thanks for your continued support and enthusiasm!
You can check out Toby’s ‘Dice Ex Machina’ in the App Store
(I am not affiliated with this developer or the app, I just think it’s neat)