This is a site for discussing roleplaying games. Have fun doing so, but there is one major rule: do not discuss political issues that aren't directly and uniquely related to the subject of the thread and about gaming. While this site is dedicated to free speech, the following will not be tolerated: devolving a thread into unrelated political discussion, sockpuppeting (using multiple and/or bogus accounts), disrupting topics without contributing to them, and posting images that could get someone fired in the workplace (an external link is OK, but clearly mark it as Not Safe For Work, or NSFW). If you receive a warning, please take it seriously and either move on to another topic or steer the discussion back to its original RPG-related theme.

Statistical Modeling of Combat

Started by Daddy Warpig, October 28, 2012, 02:33:50 AM

Previous topic - Next topic

Daddy Warpig

After uncounted lengths of time, I'm moving towards my first Alpha Test.

What I need right now is some information on statistical modeling.

The game's combat mechanic is simple.

  • Attackers have an Attack Rating, based on skill and weapon damage.
  • Defenders have a Defense Rating, based on skill and Toughness.
  • You roll the dice to get an Attack Total, subtract the Defense Rating, and that's how many Wounds you do.
  • 11 Wounds = Defeated.
  • One attack from each side each round.
What I'd like to do is some statistical modeling. I'd like to create a spreadsheet where I can input arbitrary Attack and Defense Ratings, and see the mean length of time to do damage.

1 Wound takes X Rounds to achieve (on average)
2 Wounds Takes Y Rounds

And so forth.

Anyone have any information on the formulas I'd use to calculate this?
"To strive, to seek, to find, and not to yield."
"Ulysses" by Alfred, Lord Tennyson

Geek Gab:
Geek Gab

davidov

#1
There's usually no universal formula (or even an easy one) for calculating something like this. Each unique system requires its own solution. Making one in Excel may be quite difficult. Of course, it may be nearly impossible for more complicated systems.


I wrote a small anydice script as an example, hopefully I understood the mechanics used in your game right. I assumed from the example that doubles = 0, which probably isn't right. I also don't know what kind of numbers we're dealing with in the attack and defense ratings, so I just put something in. I also assumed that defense is static - the defender doesn't roll (doing otherwise resulted in a lot of weird results).

http://anydice.com/program/18c7 (edit: don't trust the fight-function, why does it skip some rounds?)

It's likely not perfect but hopefully it's of some help. Of course, this only calculates repeated attacks from one side against one defender (who does nothing). When there are two sides attacking each other, the fights will be a bit shorter I'd guess. If you have statistics that are modified during combat (like penalties from wounds) a different approach will have to be used where an actual duel is simulated, not just one where an attacker is attacking a defender.

Some practical tips:
You won't learn that much from this. "Real-world real-game" scenarios will be wildly different. Knowing how long your fights last purely statistically is nice, sure, but mainly you'll want to focus on:
  • How likely will a single attack hit?
  • How many wounds does a single attack usually deal?
  • How many wounds are required to win a fight? (and thus how many attacks?)
  • How do these statistics change in fights between different leveled guys?

The fourth is a tricky part. Even trickier is determining how things work out in fights where the sides aren't evenly numbered. The most difficult part is determining how groups with uneven numbers and skill fare against each other, like 4 weaker heroes vs 1 big baddie.

One thing I've noticed while simulating a similar system (wounds = attack -  defense) more exhaustively with Python is that the number of combatants doesn't increase the number of rounds much. Of course, the number of turns in a round is increased dramatically.

Bloody Stupid Johnson

#2
Hmm...
the normal (% to hit x damage) to calculate damage per round becomes a bit trickier since the hit roll modifies the damage here.
I think the formula to work out average damage would be:
[% chance of a hit] x [average attack margin assuming the attack succeeds] x [1 wound per point of margin]
 
Average attack margin is also tricky to calculate since you're using 2d10 though, on a d20 this would be trivial.
 
 
Trying it another way..I'm doing it in terms of 2d10 rather than hot/cold dice, since that should have the same distribution...
 
So if you need a 13+ to hit, you have a 36% to hit ( I think). Then
you would have a 1% chance of doing 7 damage, 2% chance of doing 6 damage, 3% chance of doing 5 damage, 4% chance of doing 4 damage, and so on.
 
Basically you have a series where results go
0*1 (you hit only on a 20, 1% of the time, for 0 damage)
1 (you hit on a 19 2% of the time for 0 damage, and a 20 1% of the time for 1 damage)
2+2 (you hit on a 20 1% of the time with margin 2, and a 19 2% of the time with margin 1.
3+4+3
4+6+6+4
5+8+9+8+5
So its a series that is sum of n +2(n-1) +3(n-2) +4(n-3)...etc.
i.e. sum of a series for n(n-k)
I imagine there's a mathematical way to calculate the sum of series, but I'm not sure of the shortcut. You'd also need to use a second equation after the midpoint of the chart (n=10) when the cumulative probability on 2d10 starts going back down, too. Not to mention any exploding the system uses.
 
That probably doesn't help at all, but good luck!

Daddy Warpig

#3
Quote from: davidov;595582I wrote a small anydice script as an example,
Thanks for the work. It's unexpected, but appreciated.

Quote from: davidov;595582I assumed from the example that doubles = 0, which probably isn't right.
That's exactly right. The probability curve matches 1d10-1d10, so doubles are 0.

In other words, one dice roll generates a bonus number between -9 and +9.

And defense is static. (Unless the defender uses their action to defend, not attack.)

Quote from: davidov;595582I also don't know what kind of numbers we're dealing with in the attack and defense ratings

It doesn't matter. 10 v 5 is exactly the same, probability wise, as 15 vs. 10 or 105 vs. 100.

So long as the absolute difference between Attack and Defense is the same, the system scales indefinitely. (Making it usable for human scale, legendary scale, superhuman scale, and cosmic scale entities.)

Quote from: davidov;595582If you have statistics that are modified during combat (like penalties from wounds) a different approach will have to be used where an actual duel is simulated, not just one where an attacker is attacking a defender.

At 6 wounds, a -2 penalty is applied. Defeat occurs at 11 wounds.

Quote from: davidov;595582How likely will a single attack hit?
1d10-1d10. If the Attack (Attack + rolled Bonus) exactly equals the Defense, it deals 0 wounds. So, to wound you need at least 1 point of Result.

Assuming equally matched opponents:

0 wounds (glancing blow) occurs 55% of the time. 1 or more Wounds occurs 45% of the time. 2+ wounds occurs 36%, 3+ wounds 28%, 4+ wounds 21%, 5+ wounds 15%, 6+ wounds 10%, 7+ wounds 6%, 8+ Wounds 3%, 9 wounds 1%.

The dice never roll higher than a +9, so equally matched opponents will never defeat each other in one blow (without some intervening factor, like Action Points, Destiny Cards, conditions, etc.)

Quote from: davidov;595582How many wounds does a single attack usually deal?
That depends entirely on the relative Rating difference between attacker and defender.

The mode, in this case, is 0 wounds. 55% of the time, when the attacker and defender are equally matched, Attacks deal 0 wounds.

45% of the time they deal 1 or more wounds. It takes an average of 2.22 rounds to deal 1 Wound of damage (or so a computer scientist friend of mine assures me.)

Quote from: davidov;595582How many wounds are required to win a fight? (and thus how many attacks?)
Effectively 11.

Quote from: davidov;595582How do these statistics change in fights between different leveled guys?

The probabilities shift up or down, based on the difference in Rating. An Attacker with a 5 point advantage will deal:

0 or less wounds 10% of the time
1+ 85%
2+ 79%
3+ 72%
4+ 64%
5+ 55%
6+ 45%
7+ 36%
8+ 28%
9+ 21%
10+ 15%
11+ 10%
12+ 6%
13+ 3%
14 1%

Let me know if that's enough info to point me in the general direction of a formula.
"To strive, to seek, to find, and not to yield."
"Ulysses" by Alfred, Lord Tennyson

Geek Gab:
Geek Gab

davidov

#4
I have no idea how to come up with a formula, making such a formula for any system is hard, and I don't know if it's a viable option even in this case. It's theoretically possible..


The questions I gave were mainly meant for yourself - know the answers to those, and you're doing well.

Here are just some observations that might be useful

Regarding wound penalties
I've simulated systems without and with penalties, the main result in terms of pure statistics is that combat takes a bit longer. The effects on gameplay are worth more thought.

I personally like having wound penalties, it's realistic and creates interesting situations. Players are encouraged to seek alternatives to combat - poison a big baddie beforehand and suddenly he's easy to beat.


Average wounds dealt per attack (or round)
http://anydice.com/program/18c5
Using that (click Summary) we can see that the average wounds per attack is actually 1.65 for a situation where the skills are equal, and increases or decreases by roughly 0.5 per point of difference. It would take 2.2 rounds to deal 1 wound, if you could only deal 1 wound at most, but in your system it's possible to do more than that, hence you deal 1 wound for every 0.6 rounds :)

Then we can calculate that to deal 11 wounds against equal skill it takes an average of 11*0.6 or 11/1.65 = 6.6 rounds.


On maximum wounds
You probably know this, but mainly it controls the length of combat. There's a lot more to think about too though, but it's mostly fluff and easy to modify even at a late point of development: Could some character stat add to the wounds you can take? Could another stat modify how and when you get wound penalties? Could wounds work like in FATE with different levels? Eg. to gain an injury with penalties you need 3 minor wounds. So if you can take 4 injuries before dying, you could actually take 3*4 = 12 wounds. Lots of potentially fun stuff you can do with the wound system.

As a side note, I don't think that it's worth writing certain death into the rules, and if I understand right you've avoided this. So "If a character has 11 wounds he is defeated, and may die if not treated" vs. "If a character has 11 wounds he dies".

Daddy Warpig

#5
Thanks so much for the anydice simulation. It's been very helpful.

So, if I understood correctly:

With 11 Wounds, two evenly matched characters take an average of 6.6 rounds for one of them to be defeated.

Each additional point of difference in Attack vs. Defense adds .5 to the average Wounds per round. So, with a 1 point advantage, it takes 5.1 rounds to defeat the opponent. With a 2 point advantage, it takes 4 rounds.

In table form:

11 Wounds
Equal match: 6.6 rounds
1 Point: 5.1 rounds
2 Point: 4 rounds
3 Point: 3.4 rounds
4 Point: 3 rounds
5 Point: 2.7 rounds

If we increase the wounds to 16, this becomes:

16 Wounds
Equal Match: 9.7 rounds.
1 Point: 7.4 rounds
2 Point: 6 rounds
3 Point: 5 rounds
4 Point: 4.4 rounds
5 Point: 3.9 rounds

Have I applied the math correctly?
"To strive, to seek, to find, and not to yield."
"Ulysses" by Alfred, Lord Tennyson

Geek Gab:
Geek Gab

StormBringer

Quote from: davidov;595582http://anydice.com/program/18c7 (edit: don't trust the fight-function, why does it skip some rounds?)
I would assume it doesn't 'skip' those rounds, it may just be that "rounds until +5 attack has dealt 11 wounds against 5 defense" doesn't occur in those rounds.  The earliest it could occur is round 3, which is the first round we see (5 on round one, 5 on round two, then any result in round three = at least 11 damage).   What ever the quirk with the math is, it appears it is not possible to get 11pts of damage in exactly round 6 or rounds 8 through 11 either.

I didn't work the math out by hand or anything, but that is how I understand the missing rounds from how the website works.
If you read the above post, you owe me $20 for tutoring fees

\'Let them call me rebel, and welcome, I have no concern for it, but I should suffer the misery of devils, were I to make a whore of my soul.\'
- Thomas Paine
\'Everything doesn\'t need

davidov

Quote from: Daddy Warpig;595689Each additional point of difference in Attack vs. Defense adds .5 to the average Wounds per round. So, with a 1 point advantage, it takes 5.1 rounds to defeat the opponent. With a 2 point advantage, it takes 4 rounds.

Have I applied the math correctly?

Yes, except that my 0.5 estimation is a bit rough

Here's a more accurate simulation with 20 different levels

http://anydice.com/program/18cd (click Table and Summary, look at the mean, this is avg wounds per attack)

looks like +1 adds closer to +1 average wounds per round, or exactly +1 once you get over the magic limit of +9 difference.


Quote from: StormBringer;595705I would assume it doesn't 'skip' those rounds, it may just be that "rounds until +5 attack has dealt 11 wounds against 5 defense" doesn't occur in those rounds.  The earliest it could occur is round 3, which is the first round we see (5 on round one, 5 on round two, then any result in round three = at least 11 damage).   What ever the quirk with the math is, it appears it is not possible to get 11pts of damage in exactly round 6 or rounds 8 through 11 either.

I didn't work the math out by hand or anything, but that is how I understand the missing rounds from how the website works.
I thought something like that as well, but it should show 0 as the probability in those cases, plus it's definitely mathematically possible that it takes 6 rounds to deal 11 wounds in this system. I'd say that either I programmed something horribly wrong or it's simply too much for anydice to handle :p

StormBringer

Quote from: davidov;595741I thought something like that as well, but it should show 0 as the probability in those cases, plus it's definitely mathematically possible that it takes 6 rounds to deal 11 wounds in this system. I'd say that either I programmed something horribly wrong or it's simply too much for anydice to handle :p
Probably the last one more than the former, although I don't know how it works on the back end.  There is a possibility that 11 points of damage does not occur in round 6, but that would be five rounds of one point of damage, and exactly five points of damage in round 6.

Also, if you go to the 'Roll' section with the formulas you have and use the 'rounds until 11 damage' one, you will see it never comes up with 1, 2, 6, and a couple of other numbers.  I am not sure how it calculates the numbers, so I couldn't even begin to guess what it is doing exactly.
If you read the above post, you owe me $20 for tutoring fees

\'Let them call me rebel, and welcome, I have no concern for it, but I should suffer the misery of devils, were I to make a whore of my soul.\'
- Thomas Paine
\'Everything doesn\'t need