Close

June 24, 2018

Dice Roller

Terribly sorry for the 2 week hiatus, I was at Georgia attending TSA Nationals for a majority of said gap.

Anyways, to return into programming, I decided to create a dice roller app, to challenge myself I wanted to create it in only one hour, but include as many features as I could. However, as such a task is still incredibly simple, this project comes nowhere near the scope and grandeur of my other projects, but still an enjoyable and useful one regardless. Additionally, while I do have a multitude of other applications I’ve created over the years, they’ve all served no purpose other than a school assignment, and as such, I won’t be displaying them here on this website.

For these past few years I’ve fallen in love with Table Top RPGS, games such as Dungeons & Dragons, or Mutants & Masterminds have captivated my —as well as my friends’— attention. However, as we are still High Schoolers, it was a nightmare to try and schedule sessions, due to pre-existing schedules, as well as the issue of transportation. To accommodate, we had to play online, utilizing voice chat. However, all of the Dice Rolling websites and applications I came across were incredibly linear, not allowing custom die types, not having modifiers, etc. This is what motivated me to create a dice roller app.

I decided to utilize Microsoft Visual Studio 2017 to create this app for its simple yet effective build results, only creating an executable, and nothing else, and due to the fact I had excellent knowledge regarding to C# before hand.

I first created the UI for this application, and while it doesn’t sport any art, it is effective and easy to follow. It features buttons for the basic dice types, as well as a custom one, a text box to decide upon the amount rolled, as well as buttons to decide a modifier operation, as well as the modifier it self. Additionally, the middle box shows the current total, while the larger box showcases more information regarding the roll, such as the individual rolls, as well as all the other previous rolls.

The UI

 

As the code required for such a project is incredibly rudimentary, only being under one hundred lines in total, I won’t be discussing it in this post.  The code was simply calling the Random function multiple times with a variable maximum, then attaching on a modifying value, and displaying the results. Here’s an example of the output.

The output after a roll

 

The finished application, upon selecting a die type and its modifier displays the output in the main text box by first displaying the amount and type of dice rolled followed by the modifier, in this example 1 D20, meaning one 20 sided die was rolled, then it displays the roll value it self in addition to the modifier (8) + 4 meaning the program generated 8 as the die roll, and the user has selected an addition of 4 to be added. The program then displays the final total, 12 in this case.

As always, here’s a link to view the application itself: Dice Roller

Leave a Reply