Autoblocks

for Dungeons and Dragons 5th Edition by Wizards of the Coast.

Using Autoblocks, you can do the following:

  • simulate rolling any number of dice, with any number of sides, and with any modifier
  • view a list of statblocks by their names (library):
    • view statblock details
    • add custom statblocks
    • delete statblocks
  • view a list of NPCs by their names and hit points (encounter):
    • auto roll actions, initiatives, or ability checks
    • track and edit hit points
  • save and load your libraries and encounters to a file of your choosing

Screens and Features

Main Menu

The main menu, or home screen, has access to the dice roller, library, encounter, and is where the user can saving and load their data.

Main Menu

Main Menu

Dice Roller

The dice roller is a separate window that opens and has a temporary log of all rolls made with it. The rolls can be configured by the number of dice, the sides of the dice, and the modifier to add to each roll.

Custom Dice Roller

Custom Dice Roller

Encounter

The encounter screen has a list of NPCs, a roll log, and an actions list. There's also a few functions while selecting one or more NPCs such as Roll "Initiative" that will output the result to the roll log. HP tracking works the same way. The actions are populated from each NPC and multiple can be selected and rolled at once.

Encounter

Encounter

After selecting an NPC, their checks can be rolled without having to select them again and the actions window narrows to just what belongs to this NPC.

Encounter - NPC Selected

Encounter - NPC Selected

Library

From the library screen you can manage your statblocks. Each statblock represents an NPC and can be added into the current encounter.

Library - Adding NPCs

Library - Adding NPCs

Statblock Creator

The statblock creator has fields and settings that allow you to create any statblock within the rules of 5e. Any manditory fields are highlighted in red. Warnings are displayed when trying to create a stablock with invalid data such as a negative number of dice.

Statblock Creator

Statblock Creator

File Browser

Both the library and encounter can be saved and loaded to/from file. The file type is .json and allows users to easily edit their data with a text editor.

Main Menu - Loading File

Main Menu - Loading File

Project History

First Version

The first thing I did for this project was create a list of mechanics I wanted the software to do. The main idea was to automate NPC combat for D&D and to retrieve knowledge quickly. I then built a basic console version of my app that could do the following:

  1. A) store/read/edit/create statblocks, and
  2. B) turn those statblocks into NPCs that could roll attacks, checks, and track their hp.

After tweaking with this program, I narrowed down the scope until I knew exactly what I wanted it to do.

Frontend Design

Before I began planning the backend, I worked on the frontend of my app because my usual approach is to start with what the user will directly interact with. I decided I wanted to split the two broad functions I had identified above into different screens that could be reached via a main menu. I also knew I wanted a custom roller because there is always something you need to roll in D&D that is unexpected.

Main Menu Draft

Main Menu Draft

For each drafted screen, I included the names of the different panels I imagined I'd need to create and where they would go using Java Swing. I also wanted to keep certain things shared between the screens such as the button panel. I did this to reduce coupling, code reuse, and ensure the ui stays the same on all screens. So my idea was to have a 'slot' for the button panel and just insert whichever I needed depending on the context. I came up with 5: library, encounter, group, and character.

Library Draft

Library Draft

Here on the encounter screen I had the panels that would provide the remaining 4 contexts for the button panels. In the final version I ended up merging the group and encounter panels. Initially, grouping NPCs was a major feature of my app, but I realised I could accomplish grouping much easier with multi-select in the UI. Everything else stayed pretty much the same in the final version.

Encounter Draft

Encounter Draft

Backend Design

This was my initial UML diagram that layed out the different entities in the project and their relationships. I kept things as decoupled as possible using the principles of Object Oriented Programming. I chose to use JSON for persistence so the user can store files and therefore did not need a database.

UML Diagram

UML Diagram

Future Plans

I really love what this app can do, however the UI is very crude and there's limitations such as having just one encounter loaded at once. The biggest thing though is that there are quite a few mechanics that aren't automated such as critical hits and saving throws. I'd love to rebuild this as a web app and resolve these issues. Here's my list of features I'd add in the next version:

  • automate skills
  • automate saving throws
  • automate conditions (quickly try to add immunities, taking immunities into account)
  • add advantage and disadvantage option to all rolls
  • display when rolls are criticals (1 or 20 before modifiers) and double damage automatically
  • add turn tracking that update with initiative rolls
  • redesign hp tracking into 'heal' and 'damage' buttons that take into account resistances and vulnerabilties
  • add temporary hp

Thanks for reading!

Written by Simon Lotzkar on 2025-01-20

Software Developer (Vancouver, BC)