PDA

View Full Version : Math and Miss Chances

The Glyphstone
2010-12-27, 03:32 PM
So, I'm trying to work out a homebrew spell effect, that basically functions like a stacking mini-Displacement. When cast, it gives the target a 5% concealment-based miss chance against attacks, but for every hit that makes it through, the displacement increases by 5%. It resets whenever an attack is successfully dodged, but I'm having trouble figuring out what this sort of gradually increasing odds levels out to/averages on, so I can decide an appropriate level for the spell to be. Blur is a 20% miss flat at 2nd level, Displacement is a 50% miss chance at 3rd level.

Anyone well-versed enough in probability to run said numbers into an average effective miss chance?

eggynack
2010-12-27, 03:56 PM
I don't know much about the probability, however by the time your miss chance surpasses blur levels you've already taken 5 hits. At that time you've been missed about once from blur, and the growth from your spell has probably been reduced. Maybe if it had a short duration and didn't reduce it would be cool, but I see it as 2nd at best. Probably 1st.

The Glyphstone
2010-12-27, 04:10 PM
What if we upped the increment to 10% per hit?

weenie
2010-12-27, 05:03 PM
If you up both the increment and the base miss chance to 10% it's still worse than Blur. You need to get HIT for the miss chance to get higher, which is what you're trying to avoid. And the first time someone misses you it goes away(more or less). It will give you a very low miss chance against multiple weak opponents and it may have some chance of foiling the 4th(sucessful) strike of a strong opponent. By wich time as a caster, you should be dead. If you raise the miss chance to 10%, I'd make it a lvl1 spell. Also it creates tons of extra bookeeping, but that's an OOC problem.

The Glyphstone
2010-12-27, 05:18 PM
Would the duration factor in at all? Blur is 1 minute/level, and Displacement is 1 round/level. If it were a long-term/all-day buff - say, 1 hour/level or longer, would that improve its value to at least Blur-degree?

term1nally s1ck
2010-12-27, 05:34 PM
On a random attack within the fight, assuming it took long enough to stabilise, your expected miss chance is 27% for a 10% value. I'd say that would work as a 2nd level spell.

For interest, here's some values for other increments if you want to play with the numbers.

5% -> 18.8%
15% -> 34%
20% -> 39%
25% -> 45%
30% -> 49%
40% -> 58%
50% -> 2/3

The Glyphstone
2010-12-27, 05:36 PM
On a random attack within the fight, assuming it took long enough to stabilise, your expected miss chance is 27% for a 10% value. I'd say that would work as a 2nd level spell.

For interest, here's some values for other increments if you want to play with the numbers.

5% -> 18.8%
15% -> 34%
20% -> 39%
25% -> 45%
30% -> 49%
40% -> 58%
50% -> 2/3

Thanks, that's what I was looking for overall - the effect of a stacking miss chance as #of attacks approached infinity, with the reset on a hit. 10% stacking, 1 hour/level duration, 2nd-level Illusion spell, looking good.

GlueDuck
2010-12-27, 05:37 PM
Ok, I have no idea how balanced a spell like that would be, but I am able to run some numbers for you and this is the result I got. Basically I ran a couple oftests using the base value of 10% and increasing it by 10% for each hit. The values below shows how many percent of the misses that occured at the given percentage value.

10% - 9.0434%
20% - 17.2366%
30% - 21.3746%
40% - 20.4255%
50% - 15.6863%
60% - 9.5724%
70% - 4.5964%
80% - 1.6359%
90% - 3.796%
100% - 0.487%

Saph
2010-12-27, 05:38 PM
If it was 1 hour/level, it would be worth it. But it would be valuable mostly for the immunity from sneak attacks - remember that ANY concealment negates the Sneak Attack ability.

Having it at 10% + 10% per shot would make it stop a little more than 1 shot in 4 - so, something like a 30% miss chance if you averaged it out. However, that would be weighted towards the later shots, which would be a drawback when fighting more dangerous enemies who don't need more than one or two good hits to take you out of the battle.

It would also be a royal pain in the butt to keep track of, which is why I'd never use it - it would be far too much effort to remember exactly how many shots had hit since the last miss.

term1nally s1ck
2010-12-27, 05:43 PM
IMO, it would work fine as an hour/level buff, but I'd say you should have it reset to the base value about a minute after the last attack, to eliminate a little bit of the bookkeeping.

The Glyphstone
2010-12-27, 05:46 PM
If it was 1 hour/level, it would be worth it. But it would be valuable mostly for the immunity from sneak attacks - remember that ANY concealment negates the Sneak Attack ability.

Having it at 10% + 10% per shot would make it stop a little more than 1 shot in 4 - so, something like a 30% miss chance if you averaged it out. However, that would be weighted towards the later shots, which would be a drawback when fighting more dangerous enemies who don't need more than one or two good hits to take you out of the battle.

It would also be a royal pain in the butt to keep track of, which is why I'd never use it - it would be far too much effort to remember exactly how many shots had hit since the last miss.

Would additional utility make the hassle worth it? Say, a free-action retributive strike effect dealing Xd6 or 2*Xd6 force damage on an opponent that misses due to the spell, with X depending on the number of hits taken? It'd be fairly easy to adjuncate with a charge system, counting hits as building up charges and discharging the lot when a miss occurred.

A fixed reset time is also a good idea, though 5 minutes (to fit with the 'end of encounter' time default) might work better.

Saph
2010-12-27, 06:19 PM
Would additional utility make the hassle worth it? Say, a free-action retributive strike effect dealing Xd6 or 2*Xd6 force damage on an opponent that misses due to the spell, with X depending on the number of hits taken? It'd be fairly easy to adjuncate with a charge system, counting hits as building up charges and discharging the lot when a miss occurred.

Mechanically and balance-wise, I think it'd be okay as a 2nd-level spell with 1 minute/level duration and no extra bonuses. As TS already figured out, it's a greater average bonus than Blur, which is enough to make up for the lower initial value. (Should have guessed he'd do the math. Though I think I did pretty well ballparking it at 30% without actually running the numbers. :smallbiggrin:) If you want to boost it you could put it to 10 minutes/level or 1 hour/level, but I'd recommend increasing the spell level if you do, since IMO it's better than Blur already.

The main drawback is the extra bookkeeping, especially if several people in a fight had the spell up at once. I usually try to cut record-keeping down to a minimum on the grounds that 3.5 has more than enough already, but if that's not an issue for you, I think it's fine.

The Glyphstone
2010-12-27, 06:29 PM
Maybe a lesser and greater version, then, cause the more I think about it, the more I like the idea of the spell 'storing up' energy from hits to discharge. Of course, that might just be from reading Dresden Files all the way through yesterday.

Starbuck_II
2010-12-27, 06:47 PM
You could also make it a 2nd level, 1 min/lv but immediate action cast (so when attacked).

Gralamin
2010-12-27, 07:36 PM
5% -> 18.8%
10% -> 27%
15% -> 34%
20% -> 39%
25% -> 45%
30% -> 49%
40% -> 58%
50% -> 2/3

Not sure if these were generated mathematically (which I couldn't remember how to do), or algorithmically, but I'm getting about the same off a quick program using a million trials:

5% -> 18.891%
10% -> 27.328%
15% -> 34.034%
20% -> 39.825%
25% -> 45.060%
30% -> 50.076%
35% -> 54.718%
40% -> 59.558%
45% -> 63.534%
50% -> 66.652%

Over engineered C++ program in the spoiler if anyone wants it :smalltongue:

AbstractMissView.h

#pragma once

// used to ensure inheritance.
class AbstractMissView
{
public:
virtual void print(int base, int increase, int trials, double value) = 0;
virtual ~AbstractMissView() {};
};

MissModel.h

#pragma once
#include <boost/random.hpp>

const int DEFAULT_TRIALS = 1000000;

class MissModel
{
public:
MissModel(int base, int increase);
MissModel(int base, int increase, int trials);
double getMissValue();
int getBase() { return base;}
int getIncrease() { return increase;}
int getTrials() {return trials;}
private:
int base;
int increase;
int current;
int trials;
long int sum;
void attackMe();
MissModel();
};

MissModel.cpp

#include "MissModel.h"

boost::mt19937 gen;

MissModel::MissModel(int base, int increase): base(base), increase(increase)
{
current = base;
trials = DEFAULT_TRIALS;
sum = 0;
}

MissModel::MissModel(int base, int increase, int trials): base(base), increase(increase), trials(trials)
{
current = base;
sum = 0;
}

double MissModel::getMissValue()
{
for (int i = 0; i < trials; i++) {
sum += current;
attackMe();
}
return ( (double) sum / (double) trials);
}

void MissModel::attackMe()
{
boost::uniform_int<> dist(1, 100);
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist);
int value = die();

if (value > current)
{
//Hit
current += increase;
}
else
{
//Miss
current = base;
}
}

TextView.h

#pragma once
#include "AbstractMissView.h"

class TextView: public AbstractMissView
{
public:
virtual void print(int base, int increase, int trials, double value);
~TextView();
private:
;
};

TextView.cpp

#include "TextView.h"
#include <iostream>

using namespace std;

void TextView::print(int base, int increase, int trials, double value)
{
cout << "===========================\n";
cout << "|| " << base << "% + " << increase << "% per hit\n";
cout << "|| " << trials << " trials" << "\n";
cout.setf(ios::fixed,ios::floatfield); // floatfield set to fixe
cout.precision(10);
cout << "++ " << (value) << "% On average.\n";
cin.ignore();
}

TextView::~TextView()
{
}

Main.cpp

#include "MissModel.h"
#include "TextView.h"

int main()
{
AbstractMissView *view = new TextView();
MissModel *model;

for (int i = 1; i <= 10; i++)
{
model = new MissModel(5*i, 5*i);
view->print(model->getBase(), model->getIncrease(), model->getTrials(), model->getMissValue());
delete model;
}

delete view;
}

term1nally s1ck
2010-12-27, 07:51 PM
Well, I figured out how step X+1 is generated from step X, checked that the situation does indeed converge, then got the actual probabilities of the miss chance being Y% as n-> infinity by solving for X+1 == X

I did do it in Excel, as my computer is failing at life atm, and it's only set to display 3 d.p. which may have messed with my rounding errors.

Couldn't find a general formula for it though. I solved it in different ways for the different values.

The Glyphstone
2010-12-27, 07:59 PM
And this what ranks in Knowledge: Math are good for.:smalltongue::smallbiggrin:

Gralamin
2010-12-27, 08:04 PM
And this what ranks in Knowledge: Math are good for.:smalltongue::smallbiggrin:

Well, I had started to approach it using Bernoulli random variables and infinite sums. Then I got lazy, didn't look stuff up, and did some easy coding instead. Did you know Knowledge(Computers) can emulate Knowledge(Math)? :smallwink:

Zigg'rrauglurr
2010-12-27, 08:25 PM
Well, I had started to approach it using Bernoulli random variables and infinite sums. Then I got lazy, didn't look stuff up, and did some easy coding instead. Did you know Knowledge(Computers) can emulate Knowledge(Math)? :smallwink:

Ack! I'm studying this for a final tomorrow! And also got ninja-ed before posting the results. Basically the numbers seem correct

term1nally s1ck
2010-12-27, 08:37 PM
D&D is the ONLY game I know where when something is proposed, at least 3-4 people pop up with a full mathematical analysis of how effective it would be.

Jallorn
2010-12-27, 10:09 PM
I only read the first few posts, but as I see it, rather than, "You get missed it goes back to 5%," it should be "You get missed, it goes down X increment."

term1nally s1ck
2010-12-27, 10:26 PM
That would tend towards an average of 50% over time, with a random distribution around that.

Fizban
2010-12-27, 10:27 PM
Just chiming in on the spell idea, I have to say that I'd never use it either. It just seems too unintuitive that right when you get the bonus up and the spell starts protecting you is when it would drop back down. Now, a spell that started out at a higher miss chance and went down every time it stopped an attack, would make sense and get used by me.

The Glyphstone
2010-12-27, 10:29 PM
Just chiming in on the spell idea, I have to say that I'd never use it either. It just seems too unintuitive that right when you get the bonus up and the spell starts protecting you is when it would drop back down. Now, a spell that started out at a higher miss chance and went down every time it stopped an attack, would make sense and get used by me.

That's one of the reasons I'm adding in the retributive blast portion - it helps the intuitiveness slightly if the magic is somehow storing up some of the energy it fails to avoid, building in potency until it discharges and starts back at the beginning.