Now available for everyone: Roll Calculator Software


#1

Introduction

Greetings! Have you ever gotten a roll and went, ‘huh, what are the odds?’. Well, ask no more, and certainly don’t post about it on the Realmeye Forums.

Introducing… the roll calculator!

This tool can calculate & give statistics on any roll you have, regardless of:

  • level
  • class
  • stat
  • amount

Additionally, it supports multiple rolls combined. Want to know how likely +20HP +20MP is? Now you can!

Also comes with a few settings to customize your tool with.

Where to get it & How to use it

Go to this tools’ GitHub page, and locate the .zip file.
Download this file, and extract it.

Feel free to browse around the code in case you are either curious or wondering if i’m trying to hack your PC.

here’s a direct link to the file if you struggle to find it. Note that clicking this link will initiate the download immediately.

Inside, you will find 3 files. The tool itself, and 2 launchers.
Recommended is you use runRollCalculator to open the tool, but i’m no cop.

note that java is required to run this program.

To use the tool, simply enter your rolls’ stats and press what are the odds?
If you want to enter another roll to calculate combined odds, press enter this roll and (...) instead.

Here’s a couple more demonstrations of the tool:

How does it calculate this? and why did you spend 50 hours in 5 days making this?

That’s a potentially very long and math-filled explanation that i’ll write up as a reply to this post right now.

In the meantime, consider checking out OBs post about rolling.

changelog

Ver 1.1.1

  • Improved presenting of values
  • Minutes and Rolls are rounded in a better way
  • Fixed incorrect display of subtext in statistics popup
  • Fixed incorrect display of days statistic

#2

damn , this gonna be very useful for players :3


#3

How does this exist?

You might think the tool takes a similar approach to calculating your roll the same way OtherBill did, but that is actually not the case. Mostly because I’m pretty unfamiliar with statistics like that, and I’d rather not create an algorithm that solves some satanic integral involved with Bell Curves.

Instead, it takes the set of all possible rolls, calculates some meaningful numbers based on them (e.g. amount of ways to roll a value better than yours), and works from there.

This is done by reducing the rolling in realm as follows:

Think of the act as rolling a character, as throwing some dice.
Every individual die lands on some value, the values are added together, and that is your gain in the stat from level 1 to 20.

Take health for example: Every time you level, you throw a die that ranges from 20 to 30. (-5 to 5).
If I were to turn this into normal dice, to simplify the problem, then we get a die with 11 sides: from 1, to 11.

Leveling to 20 means leveling up 19 times, so I throw 19 dice with 11 sides each.

Is there a way to count the amount of ways n, m-sided dice add up to a given value?

The answer to this, naturally, is yes. And here’s how you do it:

(yikes)
Where S is the value you are shooting for, m is the amount of sides on your dice, and n is the amount of dice you got.

Additionally, these mathematicians use weird dice: The lowest value on theirs is 0.
(So our HP dice in this example have sides 0 to 10)

Unfortunately, I do not know exactly how those mathematicians got to the answer that’s there. I know they went from this post (specifically about directly calculating the value) to that formula, but I can’t figure out the details. . . @OtherBill might know?

One way or another, the above formula is a little less daunting, and much easier on the implementation.
(That greek symbol on the left is basically crazy math ppls way of doing a for-loop). The rest is basically just a lot of multiplication.


Now that the amount of ways to get any roll can be counted,

(for any amount of dice and sides, where dice is your level, sides is the range you can roll your stat in)

You just count whatever you want to know (e.g. counting rolls equal or better than yours), then divide the outcome of that by sides^dice (== total amount of rolls you can get), and you know your probability!

This is probably more computationally heavy than calculating the aforementioned satanic integral to get the surface of a bell curve, but fortunately computers nowadays are real fast and any answer using this solution is found within a second anyways!

why does this exist?

Over a year ago now, I got a pretty good roll. And I wondered just how likely it was.

I got pretty obsessed with trying to find an answer to this problem, because I was having a hard time figuring it out.
Really wish I knew about OBs post on rolling back then, but alas.
Eventually I was able to reduce the problem to something more generic and simple, which made me able to look up the solution. (the formula and link from earlier are what I found back then)


That was in the past until I saw a post about rolling really high here a few days ago.
I was writing up a post detailing how to calculate the solution and giving a likelihood for his/her roll.

…The post got closed while I was writing.

This unfortunate event motivated me to create a program that calculated any health roll’s likelihood and returned some statistics about it.

It was meant to bee just health but I quickly got obsessed (starting to see a pattern here?) with this tool.

As a result of that it expanded from a simple hack to get your hp roll into a ‘any possible roll anytime’ chonky piece of software. And just like that I ended up spending every waking moment of the last 5 days working on it.

At least it’s more productive than playing Realm, I guess.


#4

11 sides?

Anyway, it really just follows from a simple recurrence. Let P(S,n) be the probability of getting an HP roll of S at level n. Then:

P(S,n) = (1/11)* (P(S-30,n-1) + P(S-29,n-1) + … + P(S-20,n-1))

The expression you gave is exactly the solution to this recurrence.


#5

Waw ez

And yeah, 11 sides:

{
-5,-4,-3,-2,-1,
0,
1,2,3,4,5
}

2x5 + 1 because 0 is included

Edit: ooooh I said 10 sides

That’s the sleep deprivation, sry


#6

Eww math, use dynamic programming instead :wink:


#7

Using memory to store any pre-computed recurrence values and you got yourself some good ol tabulation :slight_smile:

EDIT: A very similar (if not identical solution)
P(A, B) = number of ways (combinations, if you will) a level A character can obtain an HP role of B.
P(A, B) = P(A - 1, B - 30) + P(A - 1, B - 29) + … + P(A - 1, B - 20)
the 1/11 just felt out of place so i redefined the recurrence


#8

Thats the formula for dice with sides 0 to m (which have m+1 sides)


#9

So this is like, a practical way of applying the theory stuff of OB.
Rolling for dummies, one might say.


#10

Good!, but ouch! those 57.0435046846872654 numbers cause a bit of brainpain though.
Presuming they still are rounded to the final figure, maybe consider displaying them with fewer d-places? The info still gets conveyed if it’s 99.99981921287943% or 99.99981921%.

& the approximately in the later paragraph gives you the perfect getout clause to write at least the rolls/minutes/days without the decimal. The year needs to keep it ofc since that’s longer timeframe, but .224 minutes kinda gives nothing extra to the story.

Just some feedback!
:honeybee:


#11

I’ve got a class doing that though it seems the specific case you mentioned slips through. (Because it tries to round .9999 into .10000 then realises it makes no sense)

I can probably fix that pretty fast as well as rounding minutes etc. …

Which makes we realise, I’ve set up nothing at all for distributing possible updates :sweat_smile:


#12

Wow — I am very glad someone took the step to automate this.

I don’t have a big chunk of time today or tomorrow, but I should have time to review your code over the weekend.

:smiley:


#13

I think the best way is to just create a website for this. Honestly a standalone app seems a bit too much for such a simple program.


#14

Now make it pull character’s stats directly from realmeye and automatically calculate them without putting in the numbers. :ok_hand:


#15

yeee boii. Turns out the spaghetti I had implemented to do this is literally present in a Java standard library I was already using (BigDecimal). Now the numbers beehave correctly and the code got cleaner :ok_hand:


#16

@OtherBill
:eyes: very nice, I hope that there’s no mistakes made :stuck_out_tongue:

I probably have weekend time as well, So if you ever wonder what kind of unholy spaghetti you’re looking at feel free to @ me.

Hopefully you won’t need it cause I’ve tried to add documentation for every method and ample comments, but you never know.

The classes you are probably most interested in looking at (its where math happens!) are in the ROTMGRoll package

@Samcw

There is a little more under the hood than what might seem, but I do agree with you.

Any type of download required is just an inconvenience to the end user with how prominent and easily accessible ‘web stuff’ is these days. MuleDump is undoubtedly bigger and they’ve got a web platform!

The tricky part on my end for implementing a web version of the tool is mostly unfamiliarity (and a little resentment) for web development. I just have way less hours in that type of software development.

That doesn’t mean it’s impossible, though (probably just frustrating. Frick JS).
Should this tool catch on, I’ll definitely consider porting it.

Right now, I imagine it might be better to have it even less clicks away and have it serve people as a discord bot. But starting a new bot just for that purpose is ogrekill and brings other questions such as how to host it.

Optimally, I ought to ask the RealmDiscord developer if he’s interested in implementing the module. It’d just need a way to interface with the ROTMGRoll package through discord commands and bobs your uncle.


#17

realmmafia flashbacks

I wonder if we’ll get an outofbounds error if we put +100.

Hmmmmmm


#18

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.