News:

Forum changes: Editing of posts has been turned off until further notice.

Main Menu

Dice distribution calculator

Started by Jasper Flick, May 01, 2009, 12:47:00 PM

Previous topic - Next topic

Jasper Flick

I made a little online calculator for dice distributions and like to share it: http://catlikecoding.com/dice/

You can use any linear combination of dice, like 1d6, 2d10, or 1d6 + 6d10 - 2d100.

It's useful if you want to see the impact of changing your dice.

There are probably others out there too, but I couldn't find them. Those I did find used random numbers, not the real mathematical distributions, which I use.

This isn't first thoughts for a RPG itself, but I suppose this is the best place to put it.

Trouble with dice mechanics? Check out AnyDice, my online dice distribution calculator!

zmobie


Egonblaidd

Interesting little tool.  You can even put in dice types that don't exist, like d49's or d10000's (it takes a loooooooong time to load that one).  Some things you might want to think about adding: dice multiplication and division, like if you roll two dice and then multiply them together, in fact, you might want to think about non-additive dice handling in general.  Say I roll 3d6 and I want each one to individually come up as greater than 4, say.  So if all are greater than 4 I have 3 successes, if only two are greater than 4 then I only have two successes (which may mean I don't succeed, or don't succeed well).  So you could have the user enter a "difficulty", and it would calculate the probabilities that X dice would come up greater than (or less than or whatever) that difficulty.  Another one would be the probability of rolling so many dice with the same number (doubles, triples, quadruples, etc.).  That sort of thing.  Obviously there will always be new ways to read dice to get a result, but if you could include some of the more common ones like I listed then that would be helpful.

Still, it's helpful as is.  It's definitely going in my bookmarks, I will want to fiddle around with it later.
Phillip Lloyd
<><

mjbauer

Great tool. Really useful.

Thanks.
mjbauer = Micah J Bauer

Jasper Flick

Nice suggestions. Egonblaidd!

:) Sure, nonexistent dice are no problem. Using d10000s is asking a lot though! But I think it's fast enough for all practical purposes. 100d100 runs in about ten second, which is funny to try out by the way.

Are there any games that use something like 1d4 * 1d6? Anyway, it's a funny idea and not hard to do, so I'll add it.

How would you deal with divisions in a game? 1d4 / 1d6 can produce nonintegers like 3/5. I think actually doing the math at the table is painful and slow, so you would probably want to use the numbers as they are. Which means you would use the mathematical division to represent something completely different. Something like 1/4 meaning 1 for succes and 4 for effectiveness. Like a D&D attack / damage roll: 1d20 / 1d6. Hey, that's actually pretty sweet. Ok, division is in too!

This calculator deals with totals, not successes. I could do a success distribution too, but that would have to be a separate calculator. Might do that later.

Chances of rolling doubles and triples is easy to calculate, but requires its own calculator as well.

Granted, I could combine it all into one general purpose calculator, but I'm not building a spreadsheet program, just simple calculators.

Glad I could be of use!
Trouble with dice mechanics? Check out AnyDice, my online dice distribution calculator!

Seamus

This is a cool program. Very helpful. Anything like it for a system built on successes with multiple dice (like vampire).
Bedrock Games
President
BEDROCK GAMES

Egonblaidd

Yeah I realize that some of those things you can't do with that calculator without modifying it (which may be as simple as adding buttons next to "calculate" that instead find # of success or doubles etc., plus actually building the other calculators) but they'd be handy for those using those types of dice mechanics or looking into using those types of mechanics.  One really handy thing about your calculator is you can quickly see the probability distribution of a set of dice and compare different variations, for example, 3d10 vs 4d10 vs 3d12, to try and find one with the probabilities you want.  I discovered this way that flipping 50 coins isn't too random, you'll come up with 25 heads +/- 5 heads around 50% of the time, so if you want a wide range of numbers with a greater randomness, roll less dice with more sides.  I suppose this makes intuitive sense (compare 1d100 with 10d10), but I haven't studied probability so I don't really know these things.  Outside of physics, that is.

Hmm, Schrödinger's orc, you don't know if he's alive or dead until you roll the die.  Interestingly, I suppose RPGs are composed almost entirely of probability functions, like particles, and when a resolution occurs you are merely "observing" the game so that you know what the result is instead of just having a probability, in the same way you would observe a particle to know its position (or momentum, you can't know both) (actually, I think I confused the uncertainty principle (that you can't know certain quantities if you know another, like position and momentum) with superposition (that a system exists in all possible states until it is observed, in which case it collapses into one state, not to be confused with observer effect, which is that observing a system changes that system, like a thermometer absorbing (changing) heat in order to measure heat)).  Did those orcs regroup and come back to ambush the party?  Right now, it's merely a probability function, but when you roll the dice it ceases to be a probability of many possible results and becomes a single certain result.  So is there a correlation with the uncertainty principle?  You can either know if your attack hits or how much damage you did, but not both?  That would be kind of silly, and I think you'd have to specifically design your mechanics to do it, but the idea of varying probability distributions is interesting.  You have a coin (d2) and a d10, you use one to determine the degree of success and the other to determine the speed of completion (attacking doesn't really work for this since either you hit or you don't, although maybe with hit locations...).  If you use the d2 for success, then you can only either succeed or fail, while if you use the d10 then you can succeed or fail to varying degrees, and if you use the d2 for time then either the task takes a while or is completed quickly, while with the d10 you can finish a task in a more variable amount of time that on average yields a result in between the d2.  Mechanics alone don't make a good RPG, but this sort of thing can be a good way to make something new that will distinguish itself.

Anyway, I'm working on a universal system (more as a practice exercise and just for the fun of it) and I don't have a resolution system yet.  Actually, all I really have are attributes.  So I'll be checking out your calculator from time to time to try out different dice combinations to find one works for me.  It would help if I knew what sort of relationship I wanted between attributes and skills, or if I even need both (I probably will use both).  I'm thinking maybe a dice pool equal to skill, with resolutions as roll under attribute, but then attributes must be less than the maximum dice value.  It would be nice to have attributes be unrestricted, so dragon or something could have a 30 strength when the average human strength is 7 or something.

One last thing, I'm not really familiar with many of the RPGs available, all I've really played is WFRP (actually I only GMed it, twice), but I understand that FUDGE uses a special dice that gives -1, 0, or +1 (it's a modified d6, apparently) (Wikipedia).  While you could model these dice as d3's and just say 1 = -1, 2 = 0, and 3 = +1, it becomes especially hairy when you combine them with other dice types.  What you could do is have your calculator model them as d3's then subtract 2 from the face value of the d3 (you can actually do this on your current calculator by doing 1d3-1d1-1d1).  The dice notation for fudge dice is dF (or df, I suppose).  I've never used fudge dice, and I don't know if I will, but some people might find it handy.

I feel like I have to say this.  Your calculator is great.  You don't need to change it.  If you want to improve it, though, feel free to follow my suggestions.  If you don't, it will still see a lot of use, and we will still love it.  I feel like I'm just criticizing your work, so I wanted to make sure you know that that's not the case.  When I see something like this, though, I immediately start thinking of how it could be improved and/or, often, made more complicated.

By the way, these long, rambling posts are the norm for me.  I do a lot of thinking, and have a little trouble organizing my thoughts and distilling them down into a more concise form.  I apologize to everyone that puts up with my endless walls of text.
Phillip Lloyd
<><

Egonblaidd

One last note I wanted to make, as someone that's interesting in designing video/computer games as well as RPGs, something like this can also be quite useful for probability calculation.  A random number generator is essentially a, well, a real die, or rather the other way around, but on a computer a random number generator is like rolling a die, but you aren't limited by what type of dice you can physically obtain, nor are you as restricted in the sorts of formulas that use dice, since the computer does the work.  You can use non-real dice like d33's in a program if you wanted to.  You could use 100d100, even though it would be impractical to roll a d100 a hundred times.  So those interested in random number generation for computer programs can also make great use of this tool.

By the way, if you know what you're doing, you can also use this for cards.  For example, in a standard deck of 52 cards with four suites, you have a 1.92% chance of getting any particular card (1d52) and a 7.69% chance of getting a particular value of any suite (1d13).  Cards do work slightly differently, as you only get one result (per draw), but multiples exist.  Say you have a deck with two sixes and four tens (maybe it's a standard deck, but two of the sixes are already in play while none of the tens are), you can't really model that as a dice roll because dice are assumed to have exactly one of all integers between (including) 1 and their number of sides.  If you really wanted to work with cards, especially if you're using custom cards (like a monster deck for a trading card game) rather than a standard deck, then it would probably be easiest to just make a spreadsheet to compute probabilities.  It wouldn't really be that difficult, either.  If there are X of this particular card, and Y total cards, then the chance of getting that card is X/Y.

What if you had multiple decks?  I suppose "standard" card games are "1c52", but you could do something like 2c52, draw from two separate decks!  Of course, if the cards are just the cards, then it's exactly like drawing from one deck, but twice (not twice from the same deck, just like drawing once from a single deck, but twice), but if the card values are combined then it's more like rolling dice.  Drawing a six and a four to get a "result" of ten (rather than two separate results of six and four) is like rolling two dice and getting a six and a four.
Phillip Lloyd
<><

Jasper Flick

Whoa man, you're rambling indeed! This is no quantum mechanics, just dice probabilities. Anway, welcome to Probability 101 I guess.

Ok, I've put in a decent parser and now you can insert stuff like "2d4 + (1d3 * 2d6 - 1)". So a Fudge die is simply "(1d3-2)".

So yea, now you can multiply dice too!

I've thought some more about proper division and it just doesn't make sense. It's also a pain to implement fractions, so I won't. Integer division might work, but I don't see it getting used in a game.

Actually, the division example I posted earlier is not a division at all, but a cartesian product. I'll see if I include that.
Trouble with dice mechanics? Check out AnyDice, my online dice distribution calculator!

Jasper Flick

Cartesian product added! You use it like "2d4 x 2d4". If you combine multiplications and cartesian products you can get some wacky graphs.
Trouble with dice mechanics? Check out AnyDice, my online dice distribution calculator!

Egonblaidd

That's some really cool stuff.  The Cartesian product can generate some bizarre probabilities, for example 2d3x2d3x2d3x2d3 looks like a sine wave whose amplitude is also a sine wave, etc.  And multiplication and Cartesian products together result in what looks like a random distribution of probability.

I'm already getting some ideas on how I could use Cartesian products for resolutions.  Essentially, it would be something like rolling separate sets of dice for damage and hit location/to-hit.  I could even have separate dice pools for attributes and skill that are rolled together, like a simultaneous skill and attribute test.  As an example, in combat you need to be both skilled enough and fast enough to hit your opponent, though practically you'd want to roll them together probably.  Although, that might be a way of tying skills and attributes together, rather than saying "difficulty is attribute + skill" or "attribute * skill", instead you'd test both the attribute and the skill simultaneously and try to cover the shortcomings of one with the other (i.e. level up a skill really high that depends on a low attribute).  Maybe you aren't as fast as your opponent, but maybe your skill allows you to anticipate his movements so you can have your weapon already moving to where he will be when you hit him.

Anyway, like I said, a really cool tool.  Just fiddling around with it gives me ideas of things I could do.
Phillip Lloyd
<><

Jasper Flick

Good it's spurring your imagination!

Some results might look weird, but the distributions really aren't haphazard. It sure gets hard to read though. I've alleviated this a bit by removing all "holes" from the display. So "1d2*1d2" won't show an empty row for 3. Now something like "1d4*1d4x1d4*1d4" looks more pleasing.

I also fixed a bug in the "<=" & ">=" table. Because the distributions of a multiplication is almost always asymmetrical, the assumption of a symmectrical distribution was no longer valid. So now I check whether it's asymmetrical, in which case I split the table in two.

The funny thing about the cartesian product is that it combines dice, but keeps the results seperate. So you didn't just roll an 8, you specifically rolled a 6 and a 2. You can use this to count successes. So I'll be adding that after all!
Trouble with dice mechanics? Check out AnyDice, my online dice distribution calculator!

chance.thirteen

After a brief looksee at the math behind it, wouldn't counting successes and thing liek roll 4d6 keep the highest 3d6 be signidicantly more difficult?

If you could ever make an application that could caluclate 4d8 + highest 2 of 5d12, I would love you forever.

Also is there a way to have zero be the lowest result of a calcluation, such as d10-5, min 0?

Egonblaidd

If you wanted a d10 that went from 0 to 9, you could do 1d10-1.
Phillip Lloyd
<><

chance.thirteen

I want a die that reads: 0 0 0 0 0 1 2 3 4 5


Likewise a really nice function would be one of absolute value. EG |1d6-1d6|

4d6 take the highest 3d6 is my most desired