1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Question About Dice Rolls

Discussion in 'BG2: Shadows of Amn (Classic)' started by Splunge, Apr 12, 2004.

  1. Splunge

    Splunge Bhaal’s financial advisor Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!)

    Joined:
    Jun 7, 2003
    Messages:
    6,815
    Media:
    6
    Likes Received:
    336
    [​IMG] This is a rather pointless question, but I was wondering how BG2 treats dice rolls where multiple dice are involved.

    Take a 10d6 fireball, for example. Theoretically, the damage can be anywhere from 10 to 60 (I’ll ignore saves). Does the game just randomly pick a number from 10-60? Or does it properly “roll” a number from 1-6 10 times, and add them together?

    If it’s the first one, then each number from 10 to 60 presumably has an equal chance of being selected.

    If it’s the second one, however, then numbers closer to the average damage of 35 have a much better chance of occurring than those at the extremes. In fact, with 10 rolls of a 6-sided die, there are 60,466,176 possible outcomes, providing results anywhere from 10-60. However, for example, only one of those 60 million outcomes is a 60 (10 6’s); similarly, only one is a 10. Only 10 outcomes would be 59 (9 6’s and a 5), and another 10 would be 11. If you were to plot the occurrences on a graph, with 10-60 on the x-axis, and the number of occurrences on the y-axis, I think you would have a fairly steep bell curve. (But it’s been awhile since I took statistics, so I don’t recall how to calculate the probabilities at each level.) So basically, you could count on your fireball consistently doing around 35 damage (+/- maybe 5), but don’t hold your breath waiting for anything above, say, 55.

    Like I said, it’s a stupid question, but I’m curious. Anybody know whether it’s the first or the second? And if it’s the second, just to make this question even more nerdy, how do you calculate the probabilities for each amount of damage (assuming it’s not too complicated)?
     
  2. CamDawg

    CamDawg The gaze of the Wolf reaches into our soul Veteran

    Joined:
    Jun 10, 2003
    Messages:
    1,116
    Likes Received:
    11
    I can not answer your question.

    However, the few times I have seen someone try to run BG2's random number generator through actual statistical testing, the conclusion they inevitably reach is that it is FUBAR.
     
  3. Tronak el Karbaro Gems: 6/31
    Latest gem: Jasper


    Joined:
    Dec 17, 2002
    Messages:
    169
    Likes Received:
    0
    I think it's randomly rolled from 10-60 but I have gotten some dice results under the minimum, so it could possibly be from 1-60, I'm afraid.
     
  4. Gothmog

    Gothmog Man, a curious beast indeed! ★ SPS Account Holder Veteran

    Joined:
    Jun 30, 2002
    Messages:
    1,829
    Likes Received:
    6
    Now, i dont really know, but IMO there are seperate dices.
    I've been programming a bit, and seperate dices are really easy to make in C++, so i'd think its done that way. That's guessing though :)
     
  5. konny666 Gems: 4/31
    Latest gem: Sunstone


    Joined:
    Apr 9, 2004
    Messages:
    90
    Likes Received:
    0
    a problem common to all BioWare games, it seems to me, is a poor implementation of random number generation. generally speaking, it's already difficult enough to implement a "random-appearing" random # generator in any sort of computer application, but biowares' generation routines seem to be worse than most.
     
  6. david w Gems: 19/31
    Latest gem: Aquamarine


    Joined:
    Nov 22, 2003
    Messages:
    1,183
    Likes Received:
    0
    I've never had a 10d6 fireball hit for more than 40 points of damage, and it seldom hits for less than 30. So as far as "random" goes, I think the game engine does a pretty poor job.

    I've also noticed that when someone wields a weapon like Crom Faeyr, the damage it does is pretty much the same every time.
     
  7. Splunge

    Splunge Bhaal’s financial advisor Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!)

    Joined:
    Jun 7, 2003
    Messages:
    6,815
    Media:
    6
    Likes Received:
    336
    @ david w - to be honest, I've never really paid a lot of attention to damage when I cast fireball, but your experience would suggest to me that the game is working the way it should, and is properly rolling a number from 1-6 10 times, and adding them together. In this situation, damages closer to the average of 35 would have a much higher probability of occurring than values in the upper or lower ranges. At 10d6, you would only have a 1 in 60 million chance of doing the minimum 10 damage, and the same of doing the maximum 60; those odds increase as you get closer to the average of 35.

    Actually, the reason I was wondering about this in the first place is that, in my current game, my solo Blade has Vampiric Touch as an innate. Normally, I don't use this spell, but this time I thought I'd try it. It does damage (and healing) of 6d6 - a range of 6 to 36, with an average of 21. I've used it several times, and have always had results in the high teens to mid-20's, so I suspect it's doing it properly rather than just selecting a number at random from 6 to 36.

    With respect to Crom, because it is 2d4, the same would apply - base range is 2-8, average 5, but 2 and 8 damage only have a 1 in 16 chance each of occurring; 3 and 7 have 2 in 16 each; 4 and 6 have 3 in 16 each; and 5 has a 4 in 16 chance. (With more than 2 die, the increase in odds is not as linear).

    [ April 13, 2004, 15:39: Message edited by: Splunge ]
     
  8. Aldeth the Foppish Idiot

    Aldeth the Foppish Idiot Armed with My Mallet O' Thinking Veteran

    Joined:
    May 15, 2003
    Messages:
    12,434
    Media:
    46
    Likes Received:
    250
    Gender:
    Male
    I think the experiment you described is an example of a Binomial Probability Distribution. The Binomial Probability Distribution can be applied when the following 4 conditions are satisfied:

    1. The experiment consists of a sequence of n trials, where n is fixed in advance of the experiment.
    2. Each trial is identical and results in only one of two possible outcomes. (This works because even though there are 6 possible outcomes, you either get the desired outcome (1 in 6 chance or an undesired outcome 5 in 6 chance.)
    3. Each trial is independent. The outcome of one trial does not affect the outcome of any other trial.
    4. The probability of the two possible outcomes remains constant from trial to trial.

    P(r) = [N! / r!(N-r)!] * p^r * (1-p)^(N-r)

    where

    P(r) is the probability of exactly r number of occurances of a particular result N is the number of dice rolled
    p is the probability of getting the particular result on any one trial.

    This is extremely cumbersome, and I'm going to try to find a source that simplifies it a bit. For example I'm not sure what the value of r is in that formula, as the value (N! - r!) should be a positive number, and it doesn't appear to be in this case. Let me get back to you on this after some research. If anyone else cares to look, search for Probability Distributions and you should get some examples.
     
  9. konny666 Gems: 4/31
    Latest gem: Sunstone


    Joined:
    Apr 9, 2004
    Messages:
    90
    Likes Received:
    0
    a big difference i'm finding with taking a wizard through BG2 versus NWN, is that heavy Magic Missile reliance in BG2 is much more sensible. I tend to do "5" points of damage over 50% of the time. while in NWN, the Magic Missile damages tend to be evenly distributed amongst the four possible values (2,3,4,5).

    well, i won't complain since throwing MM's is what my BG2 wizard does all day long... :)
     
  10. Faraaz Gems: 26/31
    Latest gem: Diamond


    Joined:
    Sep 26, 2003
    Messages:
    2,403
    Likes Received:
    0
    They're separate dices.
     
  11. Aldeth the Foppish Idiot

    Aldeth the Foppish Idiot Armed with My Mallet O' Thinking Veteran

    Joined:
    May 15, 2003
    Messages:
    12,434
    Media:
    46
    Likes Received:
    250
    Gender:
    Male
    I still don't have a solution, but I may be able to simplify the problem. After rolling 5 dice, you will have a total between 5-30. Regardless of what the total is, it is still possible to get a total of 35, although the possibilities are obviously greater if you were somewhere more than 5 or somewhere less than 30. It may be easier to view this as two trials of 5, rather than 1 trial of 10. It doesn't sound like much, but it greatly decreases the number of outcomes, as 2*6^5 is much, much less than 6^10.

    EDIT: Wait a second - therein lies the answer to the problem - it's going to take some work, but let's work backwards.

    In order to get a 35 total, then after 9 dice are rolled, we must have a result between 29-34. Regardless of what the number is, we have a statistical chance of getting exactly 35 1/6 of the time. Going back to the 8th dice, we must have a total between 23-33 to get to 35, the 7th dice 17-32, the 6th dice 11-31. Once we hit the 5th dice, we must have a total of 6-30, where is a guaranteed outcome (100%). The same is true for the first four. So, the equation we need is:

    P(35) = (P1)*(P2)*(P3)*(P4)*(P5)*(P6)*(P7)*(P8)*(P9)*(P10)

    However, P1, P2, P3, P4, and P5 all have a probability of unity (100% = 1), so the equation simplifies to:

    P(35) = (P6)*(P7)*(P8)*(P9)*(P10)

    We already know that (P10) = 0.1666, and this further simplifies the problem to:

    P(35) = (P6)*(P7)*(P8)*(P9)*0.1666.

    And this is solvable. I'll have an answer in a couple of hours, provided I'm not interrupted.

    This same formula can be extrapolated to calcualte all of the other numbers as well, and it actually gets easier at the extremes (to the point you can do them in your head). We have to count down however, to make the calculations simple. For example, logically, the chance of rolling a 34 is the same as rolling a 36, but it's easier to calculate the 34 rather than the 36. So there are actually 25 calculations to perform, with only the calculation for P(35) being unique.

    Edit #2:

    Solution to P(6):

    OK, if we roll 6 6-sided dice, we have 46,656 possible combinations of rolls. That seems like a lot of work, but keep in mind that we know the roll totals of 11-31 could get us to the total of 35, whereas rolls of 6-10 and 32-36 cannot. Obviously, there are a whole lot more combinations of ways to get 11-31 than there are other rolls, so it's easier to calculate the number of ways you CAN'T get 11-31.

    So let's see, with 6 dice, you could roll:

    6 (1 way) = 1 total
    7 (one 2 and five 1's) (6 ways) = 6 total
    8 (one 3 and five 1's) (6 ways)
    OR (two 2's and four 1's) (15 ways)
    = 21 total
    9 (one 4 and five 1's) (6 ways)
    OR (one 3, one 2, and four 1's) (25 ways)
    OR (three 2's and three 1's) (20 ways)
    = 51 total
    10 (one 5 and five 1's) (6 ways)
    OR (one 4, one 2, and three 1's) (25 ways)
    OR (one 3, two 2's and three 1's) (60 ways)
    OR (four 2's and two 1's) (15 ways)
    = 106 total

    Grand total = 185 ways

    However, the ways of getting 6 are equal to the ways of getting 36, 7 with 35, 8 with 34, 9 with 33, and 10 with 32. So we don't have to do redo the calculations for the 32-36 group, we just double the first set.

    So now we have 370 out of 46,656 rolls that you CAN'T get an outcome of 35. That's a measly 0.79% chance, or in other words the chance of getting through 6 dice with the possibility of rolling a total of 35 is 99.21%.

    Therefore P(6) = 0.9921

    [ April 14, 2004, 19:46: Message edited by: Aldeth the Foppish Idiot ]
     
  12. Splunge

    Splunge Bhaal’s financial advisor Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!)

    Joined:
    Jun 7, 2003
    Messages:
    6,815
    Media:
    6
    Likes Received:
    336
    I think I'm in over my head here. I've done a bit of research, and everything I've seen refers to standard deviations and other terms I recognise from my university days, but I don't recall how to use them. I'm not sure if Aldeth's approach will work, but on the other hand, I don't know that it won't. I'm curious to see what he comes up with.
     
  13. Aldeth the Foppish Idiot

    Aldeth the Foppish Idiot Armed with My Mallet O' Thinking Veteran

    Joined:
    May 15, 2003
    Messages:
    12,434
    Media:
    46
    Likes Received:
    250
    Gender:
    Male
    The calculation for P(7) is getting ugly - we're talking 279,936 possibilities, with far more options that will work than with P(6). I have to refer back to my calculus book, because the pen and paper way is going to take days, but it is possible. Splunge, my method will work, but this is starting to look like a regression problem, so there may be a quick formula for calculating these numbers.
     
  14. khaavern Gems: 14/31
    Latest gem: Chrysoberyl


    Joined:
    Feb 7, 2004
    Messages:
    675
    Likes Received:
    0
    @Aldeth : you mean that the probability of getting 35 with 6 dices is 99%? That doesn't look quite right :)

    Actually, the easiest way to look at this problem is to use gaussians (normal distributions).
    The reason is a statistics theorem (central limit) which says that if we have a number of variables (x, y.. -> each might represent the result we get from one dice) the distribution of the sum will be a gaussian with mean equal to the sum of individual means and the variance sum of individual variances. Most interesting is that this holds even if the individual variables do not have a gaussian distribution! (as is obviusly the case for a singe dice throw).

    So let's take a single variable x: one dice throw. The mean <x> is 3.5.
    The variance is defined as sigma^2 = sum( x_i^2/N - <x>^2 ) = approx 5
    (x_i is the result we get at each try :1,2,3,4,5,6; N =6 number of tries).

    Now if you take 10 dice throws : the mean result will be 3.5*10 = 35 while the variance sigma^2 = 10*5 =50. Then the standard deviation will be sigma = 7. Why is this relevant?
    We know that the probability of getting a result one standard deviation from the mean is about 70%. So if you throw 10 6D, you have about 70%probability of getting a result between 28 and 42.

    Also, you can look into tables (or integrate numerically - the gaussian distribution looks like exp(-(x-<x>)^2/(2 sigma^2)) ) for any more info you want. So let's say I integrate the above function from 33.5 to 36.5 : I get about 17%. Obviously this would be the probability of obtaining 34, 35 or 36.
    Since the probability for each these results are more or less equal, I would say that probability for obtaining 35 by throwing 10 6D is about 6-7%. (for those interested in doing their own computations, google "normal distribution calculator").

    Have fun :)
     
  15. Splunge

    Splunge Bhaal’s financial advisor Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!)

    Joined:
    Jun 7, 2003
    Messages:
    6,815
    Media:
    6
    Likes Received:
    336
    [​IMG] Now I know I'm in over my head. I'm almost sorry I asked. :xx: :p

    I guess calculating the odds each time I want to do sometime involving multiple dice is out of the question. :D
     
  16. khaavern Gems: 14/31
    Latest gem: Chrysoberyl


    Joined:
    Feb 7, 2004
    Messages:
    675
    Likes Received:
    0
    Heh :) . As people have pointed out, the damage you get is something between 30 and 40. So just eyeballing it works pretty good :)

    A more interesting question I have: If you cast luck on your mage before casting fireball, will you get +10 to damage (since luck increases all your rolls by one)? and if you also cast some of the priest spells (like bless or chant) you get an extra + 10? That would make a pretty potent fireball, almost doubling the damage.

    Or better yet, do this trick with Holy Smite. Then you'd get 20d4 + 20 (+20) !!!

    I though about this some time ago, but I never got around to test if it works.
     
  17. konny666 Gems: 4/31
    Latest gem: Sunstone


    Joined:
    Apr 9, 2004
    Messages:
    90
    Likes Received:
    0
    err... why would Bless/Chant affect dice rolls, and those of the Fireball spell in particular?
     
  18. omnigodly Gems: 17/31
    Latest gem: Star Diopside


    Veteran

    Joined:
    Jan 1, 2004
    Messages:
    944
    Likes Received:
    2
    Spell description says they increase attack/damage/saves by 1. When rolling damage for a fireball... since you're rolling damage... it gets +1 to every roll... get it now? :eek:

    You should try it and come back to us :D
     
  19. Aldeth the Foppish Idiot

    Aldeth the Foppish Idiot Armed with My Mallet O' Thinking Veteran

    Joined:
    May 15, 2003
    Messages:
    12,434
    Media:
    46
    Likes Received:
    250
    Gender:
    Male
    @khaavern

    No, the odds of rolling a 35 with 6 dice aren't very good at all. I'm saying is if you roll the dice individually, and count up the total, 99.21% of all trials will still have the theoretical possibility of totaling 35 following the 6th dice, meaning 99.21% will have a value somwhere between 11-31. That percentage will drop on the 7th roll, again on the 8th and 9th roll, and on the 10th roll, it will be only 16.66%. Then when you multiply all of those percentages together, you'll end up with a very small final percentage, as they are all less than 1. That having been said, your way appears to be better.

    I decided to go back to the beginning, analyzing considering only the even-numbered total dice, because it gives an exact, rollable average. With all of these experiments, I assume you roll one die at a time, and then take the total. Since die rolls are independent of one another, it makes no difference whether you roll the dice simultaneously, or individually.

    With 2 dice, the average roll would be 7. That means that after 1 roll, you would need a total of 1-6 to still have the possibility of getting 7 total. This occurs 100% of the time. Regardless of what you rolled on your first dice, you have a 1 in 6 chance (16.66%) of getting the roll that would add to a total of 7 on the seecond dice. Therefore, the probability of a 7 with 2 dice is (R signifies total rolls to that point):

    P(7) = (R1)*(R2)
    P(7) = 1.00 * 0.1666 = 0.1666

    Then, I decided that I'd try it out for 6 or 8 (same value for both). I decided on doing 8. In this scenario, you need a total between 2-7 on your first roll to get to 8. However, it is possible for your first roll to be a 1. Therefore, only 83.33% of first rolls generate a number where you can still get to 8. So:

    P(8) = (R1)*(R2)
    P(8) = 0.8333*0.1666= 0.1388

    So the chance of rolling between 6 and 8 is 44.44% (13.88% * 2) + 16.66%.

    Then I said what about 4 dice? With 4 dice, the average roll is 14. So you would need a total of 8-13 after 3 dice to get the average, a total of 2-12 after 2 dice, and a total of 11 or fewer after a single dice. Again, the chances on the first two dice are 100%, so we're left to calculate the third and 4th dice. Again, the 4th dice chance is 16.66%. So, I asked what combinations could give me totals after 3 dice of fewer than 8 and more than 13?

    Here's what I came up with as possibilities (and here is where people should start checking my work):

    3: three 1's (1 way)
    4: one 2 and two 1's (3 ways)
    5: one 3 and two 1's (3 ways)
    OR: two 2's and one 1 (3 ways)
    TOTAL: 6 ways
    6: three 2's (1 way)
    OR: one 3, one 2, one 1 (6 ways)
    OR: one 4 and two 1's (3 ways)
    TOTAL: 10 ways
    7: one 5 and two 1's (3 ways)
    OR: one 4, one 2, one 1 (6 ways)
    OR: two 3's and one 1 (3 ways)
    OR: one 3 and two 2's (3 ways)
    TOTAL: 15 ways

    Now, the chance of rolling a 3-7 are the same as rolling a 14-18. 3 is the same as 18, 4 is the same as 17, 5 is the same as 16, etc. So I doubled my total, and came up with 70 possible combinations out of 216 that would prevent you from possibly having a 14 at the end. Meaning that 67.60% of all combinations after 3 rolls give you the possibility of getting 14. Therefore:

    P(14) = (R1)*(R2)*(R3)*(R4)
    P(14) = 1.00*1.00*0.6760*0.1666= 11.26%

    Again, I asked, what about a 13 or 15? This time I decided to do 13. With 13, you need a total of 7-12 after three dice, 1-11 after two dice, and 10 or fewer after 1 die. After one die, it's still 100%. However, after the second dice, there is a possibility of rolling a 12, so only 97.22% of all totals after the second dice can still work out to 13. So for the third dice, I asked what combinations of fewer than 7 but more than 12 exist? Most of my work was already done. From the above calculations, I already had my possibilities for 3, 4, 5, 6, 14, 15, 16, 17 and 18. All that was left was to calculate 13:

    13: two 6's and one 1 (3 ways)
    OR: one 6, one 5, one 2 (6 ways)
    OR: one 6, one 4, one 3 (6 ways)
    OR: two 5's and one 3 (3 ways)
    OR: one 5 and two 4's (3 ways)
    TOTAL: 21 ways.

    Add everything up, and you get 76 out of 216 possibilities eliminated, or 64.81% that still work out. So our equation is:

    P(13) = (R1)*(R2)*(R3)*(R4)
    P(13) = 1.00*0.9722*0.6481*0.1666 = 10.50%

    So the possibility of rolling 13-15 with 4 dice is (10.50% * 2) + 11.26% = 32.26%.

    I went on to 6 and hit a snag. I worked out all the calculations again, but this time, a seemingly impossible result. The chance of rolling a 21 (the average with 6 dice) is 14.86%, and the chances of rolling a 20-22 are 43.90%. Given the 4 dice example, I expected the totals to go down. But the opposite happened. If anyone wants to do this method to check what I did, let me just give you the totals: I got 140 total ways out of 1296 to get a total of less than 9 and more than 19, which is required after 4 dice to still have a possibility of getting a total of 21.

    EDIT #2: I redid the calculations and actually found out that there are only 128, not 140 possibilities eliminated. This makes the percentage even greater. My thinking is I miscounted or omitted some combination that should be a bigger contributor.

    [ April 15, 2004, 19:46: Message edited by: Aldeth the Foppish Idiot ]
     
  20. konny666 Gems: 4/31
    Latest gem: Sunstone


    Joined:
    Apr 9, 2004
    Messages:
    90
    Likes Received:
    0
    omnigodly,

    I really don't think that's how Bless/Chant are supposed to work. Feel free to prove me wrong though. ;)

    BTW, according to the 2E PHB, Bless only increases attack dice rolls (and saving throws vs. fear). And I'm pretty sure they meant melee/ranged weapon damage as far as Chant goes.
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.