PDA

View Full Version : Creative Assembly Hand-to-hand combat formula



ralph_hplar
07-18-2002, 00:25
Here's the formula given at Shogun Academy for resolving hand-to-hand combat:

chance-to-kill = 0.19 x (1.2)^(combat factor)

The only problem is, any combat factor greater than 9 gives at least 100% chance to kill:

chance-to-kill = 0.19 x 1.2^10 = 117.642%

Also, this formula doesn't work for negative combat factor value. I suggest a new formula which works for all combat factor values:

Let cf = combat factor
Let ctk = chance to kill
Let x = ABS(cf)
Let y = ABS(cf+1)

ctk = 0.19 * ABS(y - x + 1 - 0.8^x)

This makes (y-x) equal to -1 for all negative combat factor values and +1 for all positive. A few examples to show the formula works:

Let cf = 2
x = ABS(2) = 2
y = ABS(2+1) = 3

ctk = 0.19 * ABS(3 - 2 + 1 - 0.8^2)
ctk = 0.19 * ABS(2 - 0.64)
ctk = 0.19 * 1.36 = 0.258

The 36% improvement is what we were looking for, so it works so far. Negative combat factor values should mean reduction by 20%, so cf=-2 should end up being 0.19 * (100%-36%) or 0.19 * 0.64:

Let cf = -2
x = ABS(-2) = 2
y = ABS(-2+1) = 1

ctk = 0.19 * ABS(1 - 2 + 1 - 0.8^2)
ctk = 0.19 * ABS(0 - 0.64)
ctk = 0.19 * ABS(-0.64)
ctk = 0.19 * 0.64 = 0.1216 (which is a 36% reduction)

We can try -10000 just to see what happens (it should still be greater than 0% chance):

Let cf=-10000
x = ABS(-10000) = 10000
y = ABS(-10000+1) = 9999

ctk = 0.19 * ABS(9999 - 10000 + 1 - 0.8^10000)
ctk = 0.19 * ABS(0 - 7.94 * 10^-970)
ctk = 0.19 * (7.94 * 10^-970)
ctk = 1.51 * 10^-970

which happens to be a very small number, very close to zero,
but there's *always* a chance to kill.

barocca
07-18-2002, 01:26
http://www.totalwar.org/ubb/smile.gif
the chance to kill is capped at a maximum,
if i remember correctly it is capped at 95%.
This was in a post by target back in the dark mists of time...


------------------
Clan Doragons Medieval Website
Mods, Unit Descriptions and more
DoragonBarocca of Clan Doragon (http://doragon.cjb.net)

ralph_hplar
07-18-2002, 01:43
If that were the case, Kensai should easily kill 95% of the time, but they don't. Even against ashigaru, they still take a few wacks.

ralph_hplar
07-18-2002, 01:48
Besides, using 1.2 as the base means you're getting more than 20% for each additional increase by 1 to the combat factor. Think of something having a 20% chance to occur. Doing it 100000000 times still doesn't guarantee it.

ralph_hplar
07-18-2002, 01:50
Which is basically what happens. Think of a 5 sided die being rolled combat_factor_value times, then it makes sense.

ralph_hplar
07-18-2002, 02:02
Let me state it another way: 19% is the base chance to kill (meaning no improvements or reductions). If we rolled an imaginary 5-sided die twice, what would be the chance of rolling a 1 at least once? 36%, not 44%, right? If we rolled it an infinite number of times, it would be 100%, not INF%. This ends up being the total improvement to the base chance to kill, so the best chance to kill is 38%. The chance to kill should also converge to zero as the combat factor approaches negative infinity: it should NOT be a negative chance to kill.

ralph_hplar
07-18-2002, 02:34
It probably still doesn't make sense. If combat factor = 1, then you're basically getting a 38% chance to kill 20% of the time, and 19% the other 80% of the time. If combat factor = 2, you have 2 chances to get the 38% instead of 19%. So you basically roll a 5 sided die twice. If you get a 1 at least once, you get a 38% chance to kill. If not, you only get 19%. So you have a 36% chance to get the 38% chance to kill. The other 64% of the time you get the regular 19%. If combat factor = infinity, you roll the die an infinite number of times. You're guaranteed to get a 1, so you're guaranteed a 38% chance to kill.

Papewaio
07-18-2002, 04:04
The couple of whacks for a kensai is because there are more animation cycles then combat cycles. In other words the check for a killing hit is done say every 5 seconds not every whack of the animation frame.

Also I think the formula has upper and lower boundaries. Don't know the caps either.

And I'm not 100% sure that is the correct formula.

Elrich of Gaul
07-18-2002, 06:08
Looks like someone's been watching "Good Will Hunting" one time too many....

Think you lost me at "here's the formula..."

------------------
"I will follow you anywhere my brother, my captain, my King"

Elrich

Papewaio
07-18-2002, 09:59
Ha that formula is easy. Try Schrodingers equation of the probable orbit of an electron around an atom including the permutation for magnetic fields splitting the orbits, thus creating multiple solutions to a triple integral.

Its been five years since I have touched the mathematics for Quantum Mechanics and I still can remember it was the concepts not the maths that is the mind bender.

Fast Death
07-18-2002, 10:13
Yea, I've heard of that one.

It has merit until... The Transactional Interpretation and the Formal Notation of QM is applied to other aspects of the QM formalism.

Elrich of Gaul
07-19-2002, 07:11
*head spinning*


someone call an ambulance.

------------------
"I will follow you anywhere my brother, my captain, my King"

Elrich

Papewaio
07-19-2002, 10:40
Paradigm city at the moment with Quantum Mechanics... not sure how long it will go on or is it a case of duality of Quantum Physics Interpretations not just the subject matter.
http://mist.npl.washington.edu/npl/int_rep/tiqm/TI_toc.html

Fast Death
07-19-2002, 10:48
Finally! One of the few.

Gothmog
07-19-2002, 20:12
ralph_hplar:

Your formular agrees at 2 combat factor (negative or positive), and that only.

Chances are, they might simply have different formula for positive and negative values, simple as that.

---
If CF >= 0 Then
Chance-to-kill = min(0.19 * (1.2^cf), 0.95)
Else
Chance-to-kill = max(0.19 * (0.8^cf), minKillChance)


the "minKillChance" value is just my speculation, but I think more likely than not, there is one.



------------------
Pain is weakness leaving the body.
http://www.grahamday.dial.pipex.com/rose-knight1.gif

ralph_hplar
07-19-2002, 22:41
Only works for +2/-2? Let's try 0 (should be 19%):

x = 0
y = 1
ctk = 0.19(1 - 0 + 1 - 1)
ctk = 0.19 * 1 = 0.19 = 19%

Let's try 1 (should be 0.19 * 120%)

x = 1
y = 2
ctk = 0.19(2 - 1 + 1 - 0.8)
ctk = 0.19 * 1.2 = 22.8%

Let's try 3 (should be 0.19 improved by the chance of rolling a 1 on an imaginary 5-sided die at least once, given 3 chances, or 48.8%)

x = 3
y = 4
ctk = 0.19(4 - 3 + 1 - 0.8^3)
ctk = 0.19(2 - .512)
ctk = 0.19 * 1.488 (48.8% improvement)

Wanna try -3? Should be 48.8% reduction...

cf = -3
x = 3
y = 2
ctk = 0.19 |2 - 3 + 1 - 0.8^3|
ctk = 0.19 |0 - 0.512|
ctk = 0.19 * 0.512 (which is 1 - 0.488)

This formula works only for positive and zero combat factor values:

ctk = 0.19(2 - 0.8^cf)

This one only for negative:

ctk = 0.19*0.8^-cf

It is the original formula which works only for combat factor 0 and 1. It's easy to think 1.2 is the base just because combat factor 1 gives a multiplier of 1.2.

ralph_hplar
07-19-2002, 22:47
For negative it should be

ctk = 0.19 |0.8^-cf|

lol

Gothmog
07-19-2002, 22:50
I think the 20% increase/reduction description by longjohn (or was that Target) is too vague and doesn't make sense. Or at least won't fit in one set formula.

I understand your point, but consider this:

Suppose I have a unit of soldiers who get +3 weapon bonus, but suffers -3 at the same time because of the fatigue.

The positive and negative effect should simply cancel each other.

The way you make it, won't bring it back to the "origin". Why? 0.512 * 1.488 is not 1! (of course you CAN'T simply average 0.512 and 1.488, for longjohn made it clear that the effect is multiplication cumulative)

Of course doesn't fit on my formulas either. Which brings us to the point that I made from the start:

The 20% increase/reduction description by longjohn (or was that Target) is too vague and doesn't make sense. Or at least won't fit in one set formula.

------------------
Pain is weakness leaving the body.
http://www.grahamday.dial.pipex.com/rose-knight1.gif

ralph_hplar
07-19-2002, 22:55
What are you talkin about? Combat modifiers are added first to determine combat factor. +3 and -3 gives 0 combat factor.

ralph_hplar
07-19-2002, 23:07
You are trying to say that

0.19(2 - 0.8^(x + y))

is the same as:

0.19(2 - 0.8^x) + 0.19(2 - 0.8^y)

which is simply NOT true...

Wavesword
07-20-2002, 00:02
Quote Originally posted by Fast Death:
Finally! One of the few.[/QUOTE]

A case of eyes meeting across a crowded forum

Papewaio
07-20-2002, 05:24
Quote Originally posted by Wavesword:
A case of eyes meeting across a crowded forum[/QUOTE]

*sniff*

Beautiful isn't it. What do you think was the probability of that happening.

----


Every Friday afternoon, a mathematician goes down to the bar, sits in the
second-to-last seat, turns to the last seat, which is empty, and asks a
girl who isn't there if he can buy her a drink.

The bartender, who is used to weird university types, always shrugs but
keeps quiet. But when Valentine's Day arrives, and the mathematician makes
a particularly heart-wrenching plea into empty space, curiosity gets the
better of the bartender, and he says, "I apologize for my stupid questions,
but surely you know there is NEVER a woman sitting in that last stool. Why
do you persist in asking out empty space?"

The mathematician replies, "Well, according to quantum physics, empty space
is never truly empty. Virtual particles come into existence and vanish all
the time. You never know when the proper wave function will collapse and a
girl might suddenly appear there."

The bartender raises his eyebrows. "Really? Interesting. But couldn't you
just ask one of the girls who comes here every Friday if you could buy HER
a drink? Never know... she might say yes."

The mathematician laughs. "Yeah, right -- how f......... likely is THAT to
happen?"

Fast Death
07-20-2002, 05:50
Nice. Haven't heard that since Cornell.

Elrich of Gaul
07-20-2002, 06:40
*elrich falls to ground*

*paramedics pick up elrich*

*elrich is put into ambulance*

*wwooooo....eeeeeee....wwwwww...eeeeee....*

NARF
07-23-2002, 06:14
uh oh, Ive gone crosseyed

Vanya
07-25-2002, 23:13
LOL

Puzz3D
07-26-2002, 01:16
ralph_hplar,

chance-to-kill = 0.19 x (1.2)^(df)
df = melee - defend + bonus

This formula does work for positive and negative values of df (difference factor). If the exponent is negative, the notation means take the inverse of the positive exponential. For example 19% x 1.2^(-1) = 19% x .83 = 15.8%. For the range -9 < df < +9, the chance to kill ranges from 3.7% to 98%. This chance to kill is the probability of killing a man on an individual combat cycle. It does seem like some other factor comes in at the extremes of the range.

LittleGrizzly
07-26-2002, 05:39
ummm how about something more simple like 2x2 ahh much easier

JeRrYgArCiA
07-26-2002, 10:14
I've been completely lost since i saw first numbers....

Puzz3D
07-26-2002, 19:30
Hi Jerry,

I'll try to explain it. When your men fight, they take turns attacking and defending. That's called a combat cycle. Each time a man strikes at another man a difference factor (df) is calculated using the melee and defend unit stats and situational combat modifiers (bonus) such as: charge, height, fatigue, yari vs cav, trees, flank, rear, formation, etc. df = attacking man's melee - defending man's defend + situational bonus. The df is plugged into the 19% x 1.2^(df) formula to come up with a probability that a man will kill another man when he strikes at him. That probability is compared to a random number in the range 0.0 to 1.0 which is being generated for each individual attack. It's important that the random number generator be coded properly so that it produces a uniform distrubution of numbers. There is uncertaintly in a system like this, and, when units are closely matched in chance to kill, you cannot predict which unit will win. There is also a bit of 'chaos' involved because, if your unit gets off to a good start and gains a numerical advantage in men, you get the additional advantage of double and triple attacks on the men in the enemy unit.

Wavesword
07-27-2002, 01:20
Do weather conditions affect hth beyond fatigue levels?

Puzz3D
07-27-2002, 01:56
Wavesword,

I don't believe weather has any direct effect on hth combat. Rain and snow cause increased fatigue on units based on their armor level which in turn lowers combat effectiveness and morale. The accuracy of archers is reduced, arqs can't fire and musk reload is longer and they misfire more.

Gothmog
07-27-2002, 07:18
Do rain and snow reduce the reload speed of other missle units, such as SA and Crossbow Asigaru as well?

Also, you said that the fatigue level was based on armor level. Does that mean that those who wear legendary armor tire faster as well?

NARF
07-27-2002, 11:07
put that in terms people without brain cells can understand

Puzz3D
07-27-2002, 19:34
The tests I did a while back indicated that the armor level that each unit carries into battle does alter the fatigue rate. I don't think SA reload is affected by weather. I never checked crossbows.

Wavesword
07-27-2002, 23:07
Thanks your oracleship, another question I just thought of is that yari samurai and ashigaru cancel Charge Bonuses, do the spears carried by yari cav have the same effect on their attackers?

longjohn2
07-28-2002, 02:50
I think I must have given you the combat formula originally. Anyway, I was looking over the code again while doing some stuff for the MTW strat guide, and noticed that the correct base kill chance is 0.019 not 0.19. The formula makes more sense that way, as it doesn't give 100% kill chance at factor 10 and beyond. Actually the maximum factor is capped at 20 which gives a max kill chance of around 72%, and -20 at the other end of the scale.

Sorry for the misleading info, but I only post here from home, so I have to rely on memeory instead of checking the code.

Papewaio
07-28-2002, 04:25
Thanks LongJohn2!!!!!!!!!!!

Puzz3D
07-28-2002, 06:03
Thanks longjohn. TosaInu had made tests during the v102 beta with kensai and said the kill rate continued to increase up to a combat difference factor of about 20. We could never reconcile that with the 0.19 based formula, but now it fits perfectly.

Puzz

[This message has been edited by Puzz3D (edited 07-28-2002).]

Puzz3D
07-28-2002, 20:38
Wavesword,

The YA and YS cancel the cavalry charge if frontally assaulted. The YC do appear to get their +4 yari bonus when fighting cav, but the YC does not cancel the charge of enemy cavalry.