Results 1 to 3 of 3

Math Help - Dice Calculation for Tabletop RPG

  1. #1
    Newbie
    Joined
    Jul 2010
    Posts
    2

    Dice Calculation for Tabletop RPG

    Thanks for your time.

    I believe this would fit under the Calculus heading since it appears to be related to finding the maxima of a nonlinear function, though I'm not sure. I am not good at math. If I have posted in error please let me know.

    Here is my question:

    In the tabletop RPG Dungeons and Dragons 3.5 attacks are made using a 20-sided die compared to a target "armor class" value of the defender. If you meet or exceed the target you will hit. If you roll a 20 on the die, you will have the opportunity to hit again in which case you will deal extra damage. If you roll a 1 you automatically miss. A 20 is known as a threat, or threatening a critical.

    There is an ability in the game called Power Attack. When players attack targets they have an "attack bonus." Often early in the game this is roughly +5. This ability allows you to subtract a given quantity x from your attack bonus in order to gain either x (if using a 1 handed weapon) or 1.5x (if using a two-handed weapon) as a bonus to damage if your attack is successful. This 1.0x vs 1.5x coefficient is known as the handedness multiplier.

    I want to create a pocket excel spreadsheet that will auto-calculate optimal power attacks from the data I've given it about my character (it acts as my character's information sheet). It needs to take into account both the probability of a hit (or a confirmed critical after rolling a 20) as well as the damage on a hit, or a critical respectively.

    So far I have done the following calculation. Does this look right?

    +++++++++++++++++++++++

    GOAL: Find the maximum of a nonlinear equation such that y is the average damage output and x is the power attack input in amount of attack bonus points subtracted.

    ROUTE:

    the damage output will be based on the following:
    f(x)=
    chance that we will hit without threatening a critical * damage that will be done in this case
    +
    chance that we will threaten * damage that will be done in this case * ratio of rolls that will confirm this critical
    +
    chance that we will threaten * damage that will be done in this case * chance that we will fail to confirm this critical

    or

    f(x) =
    ratio of rolls that will hit * (average damage + x*handedness_multiplier)
    +
    ratio of rolls that will threaten * (average critical damage + x*handedness_multiplier*critical multiplier) * ratio of rolls that will confirm a critical
    +
    ratio of rolls that will threaten * (average damage + x*handedness_multiplier) * ratio of rolls that will fail to confirm

    rolls that will merely hit = 20 - target AC - all bonuses to hit -1 for critical misses - possibilities of threats

    ALGEBRA:

    // For anyone who is well-versed in D&D, I have simplified the equation to only count natural 20 threats, and natural 1 critical misses. Further exploration on threat ranges can come later for what I want.

    let MERE_HITS = 20 - ( TARGET_AC - 1_FOR_CRITICAL_MISS - (ATTACK BONUS-x) ) - 1_FOR_NAT_20

    f(x) =
    ( MERE_HITS / 20 ) * ( AVG_DAMAGE + x * HANDS_MULT )
    +
    ( 1 / 20 ) * ( AVG_DAMAGE * CRIT_MULT + x * HANDS_MULT * CRIT_MULT ) * ( ( MERE_HITS + 1 ) / 20 )
    +
    ( 1 / 20 ) * ( AVG_DAMAGE + x * HANDS_MULT ) * ( (20 - (MERE_HITS + 1)) / 20 )

    -------------------------------------

    I know this is a lot to digest, but I would greatly appreciate a more learned set of eyes. I am not a math whiz, and even if I was, I would want external input for something this complex.

    Thank you!
    Last edited by rpgaddict; July 26th 2010 at 02:22 PM. Reason: too much assumed knowledge in the original post
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member mfetch22's Avatar
    Joined
    Feb 2010
    From
    Columbus, Ohio, USA
    Posts
    168
    Quote Originally Posted by rpgaddict View Post
    Thanks for your time.

    I believe this would fit under the Calculus heading since it appears to be related to finding the maxima of a nonlinear function, though I'm not sure. I am not good at math. If I have posted in error please let me know.

    Here is my question:

    In the tabletop RPG Dungeons and Dragons 3.5 attacks are made using a 20-sided die compared to a target "armor class" value of the defender. If you meet or exceed the target you will hit. If you roll a 20 on the die, you will have the opportunity to hit again in which case you will deal extra damage. If you roll a 1 you automatically miss. A 20 is known as a threat, or threatening a critical.

    There is an ability in the game called Power Attack. When players attack targets they have an "attack bonus." Often early in the game this is roughly +5. This ability allows you to subtract a given quantity x from your attack bonus in order to gain either x (if using a 1 handed weapon) or 1.5x (if using a two-handed weapon) as a bonus to damage if your attack is successful. This 1.0x vs 1.5x coefficient is known as the handedness multiplier.

    I want to create a pocket excel spreadsheet that will auto-calculate optimal power attacks from the data I've given it about my character (it acts as my character's information sheet). It needs to take into account both the probability of a hit (or a confirmed critical after rolling a 20) as well as the damage on a hit, or a critical respectively.

    So far I have done the following calculation. Does this look right?

    +++++++++++++++++++++++

    GOAL: Find the maximum of a nonlinear equation such that y is the average damage output and x is the power attack input in amount of attack bonus points subtracted.

    ROUTE:

    the damage output will be based on the following:
    f(x)=
    chance that we will hit without threatening a critical * damage that will be done in this case
    +
    chance that we will threaten * damage that will be done in this case * ratio of rolls that will confirm this critical
    +
    chance that we will threaten * damage that will be done in this case * chance that we will fail to confirm this critical

    or

    f(x) =
    ratio of rolls that will hit * (average damage + x*handedness_multiplier)
    +
    ratio of rolls that will threaten * (average critical damage + x*handedness_multiplier*critical multiplier) * ratio of rolls that will confirm a critical
    +
    ratio of rolls that will threaten * (average damage + x*handedness_multiplier) * ratio of rolls that will fail to confirm

    rolls that will merely hit = 20 - target AC - all bonuses to hit -1 for critical misses - possibilities of threats

    ALGEBRA:

    // For anyone who is well-versed in D&D, I have simplified the equation to only count natural 20 threats, and natural 1 critical misses. Further exploration on threat ranges can come later for what I want.

    let MERE_HITS = 20 - ( TARGET_AC - 1_FOR_CRITICAL_MISS - (ATTACK BONUS-x) ) - 1_FOR_NAT_20

    f(x) =
    ( MERE_HITS / 20 ) * ( AVG_DAMAGE + x * HANDS_MULT )
    +
    ( 1 / 20 ) * ( AVG_DAMAGE * CRIT_MULT + x * HANDS_MULT * CRIT_MULT ) * ( ( MERE_HITS + 1 ) / 20 )
    +
    ( 1 / 20 ) * ( AVG_DAMAGE + x * HANDS_MULT ) * ( (20 - (MERE_HITS + 1)) / 20 )

    -------------------------------------

    I know this is a lot to digest, but I would greatly appreciate a more learned set of eyes. I am not a math whiz, and even if I was, I would want external input for something this complex.

    Thank you!
    First, I'm going to give all the values in the equaiton you gave their own variables, to make typing this out much simpler. Here is the assignments, the letters given to a particular value don't mean anything except that that was the letter I decided to use, they are aribitrary in choice:

    Target AC = a
    Attack Bonus = b
    Average Damage = c
    Hand Multiple = d
    Critical Multiple = p

    With the above definitions, and with combining only a few of the fractions and constants, I arrived at the follwoing:

    f(x) = \frac{(20+b-a-x)(c+dx)}{20} + \frac{(cp+dpx)(21+b-a-x)}{40} + \frac{(c+dx)(a+x-b+1)}{40}

    Now, my next step is to work out the multiplication and simplification of f(x), then I can differentiate and find the maximum or minimum of the funciton, but firstly I need to make sure I clarify the following things with you:

    [1] When you say 1_FOR_CRITICAL_MISS, do you mean for that value to simply be a 1 there, or is the whole "1_FOR_CRITICAL_MISS" one distinct value? I ask the same question for the phrase "1_FOR_NAT_20".

    [2] All the values that I assigned to variables, are they values that are "constants" in the game? What I mean is that not that they are actually neccesarily constant in the game, but that for any given turn they become real values, and that the x is the deciding variable. In other words, I can only help you if what your looking for is the minimum (or maximum, I can't remember which you were attempting to find) of the function, in terms of all the above variables. So for example, the minimum or maximum would be some expression containing some or all of the variables I assigned above.

    [3] The way you defined your question and f(x) itself was very confusing. Granted, maybe this wasn't actually due to the manner in which you defined f(x), but rather the complexity of the problem that seemed to manifest the confusion. Either way, in noting that I myself was alittle confused by the question and the definition for f(x), I ask you to take a second look at what I came up for f(x) and any comments I have made in this post and please tell me if you see any errors or mistakes in my understanding of your question.

    If you can clarify the above questions for me, I think I'll be able to hammer out the maximum (or minimum, I can't remember which one you were trying to find) of the function f(x), in terms of a, \; b, \; c, \; d, \;\;\; and/or \;\;\; p
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jul 2010
    Posts
    2
    Thanks for your attention and carefully thought out response, mfetch.

    The primary concern that comes to mind is that I don't know if the [i]process[i] by which I am attempting to calculate these odds and find the optimal amount to subtract from attack bonus (to gain extra damage bonus) is indeed the right process (if it will represent the real "best number to subtract"). That is my main question.

    Now in reply:

    [1] 1_FOR_CRITICAL_MISS and 1_FOR_NAT_20 are constants of the value 1. The problem used these values because initially I was attempting to handle a threat range greater than 1 (which means that numbers for instance 18, 19, and 20 might cause a critical, if and only if they hit). I later threw this out as it's not the core problem I'm trying to solve, and can be added back in later.

    [2] We know the following:
    + TARGET_AC (this is our best guess, and cannot be determined except in game)
    + ATTACK_BONUS (a constant)
    + AVG_DAMAGE (the rough amount of damage a given attack will do, as a constant)
    + HANDS_MULT (if we are 1 handed or 2 handed weilding our weapon)
    + CRIT_MULT (a constant based on the weapon type)
    We do not know:
    - What the best number to subtract from our attack bonus will be (this is what I want to find). f(x) should return this such that x is the subtracted amount. Once we can graph (or otherwise analyze) this function we can find the maximum (highest average damage given a certain number subtracted).

    [3] The function needs to take a number, x, which will be subtracted from our attack roll. It will return the best average damage taking into account both the likelihood that we will actually hit (that any damage will be done at all) and also the amount of damage that will be done (including critical hits, which do extra).
    Once that function is constructed and accurately mirrors reality, the maximum must be determined. The goal is to know exactly how much of our attack bonus to subtract in order to get the best damage payoff the majority of the time.

    I was also told the following, which I will be diving into more deeply when I get some free time:
    "I prefer to consider the chance of hitting times the average damage on a non-critical hit plus the chance the hit is also a critical hit times the difference between the average critical and non-critical damage."
    This sentence does not yet register logically in my head, but I will seek to understand it more fully.

    For reference take a look at the following, which is where I'm looking:
    How much power attack? - The Squid Zone
    D&D 3rd edition Power Attack damage estimator
    donjon; Power Attack Calculator
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Four dice.
    Posted in the Statistics Forum
    Replies: 1
    Last Post: September 20th 2010, 02:06 AM
  2. Dice
    Posted in the Statistics Forum
    Replies: 2
    Last Post: May 2nd 2010, 05:46 AM
  3. Replies: 0
    Last Post: December 29th 2009, 09:08 PM
  4. Dice Qn
    Posted in the Statistics Forum
    Replies: 3
    Last Post: December 16th 2008, 09:45 AM
  5. Dice
    Posted in the Advanced Statistics Forum
    Replies: 3
    Last Post: June 3rd 2008, 06:18 AM

Search Tags


/mathhelpforum @mathhelpforum