View previous topic :: View next topic |
Author |
Message |
DukeofDellot

Joined: 07 Feb 2003 Posts: 32
|
Posted: Wed Mar 05, 2008 3:47 pm Post subject: |
|
|
No, I'm not, in fact, I'm finished with the damage one (assuming the wiki page is correct)...
Though I know something on the "How is the attack dodge rate calculated?" page is wrong.
If nothing else, 16 + 12 = 28, not 38, but for some reason, the method itself seems to produce... well... unsatisfactory results... if I'm actually understanding what's going on. Since I'm probably not... then, yeah, I'm racking my brain on it, cause I'm getting different answers by performing manually (taking every possible outcome and counting how many attacks hit and how many miss).
Something... ungh... I wasn't going to ask for help, but here I am.
Can anyone good with math help me with a workable formula to counter this mess? ... I'm tired of thinking about it.
Edit: Here I uploaded the damage calculator thing... I guess I'm just irritable right now... I don't know why. It just bugs me when I find something... something mathematical... that I can't wrap my head around. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Wed Mar 05, 2008 4:29 pm Post subject: |
|
|
Okay, let me take a crack at it.
for Bad aim:
Code: | if rand(A*.25,A*1.75) >= D*1.75 then hit
else if rand(D*.25,D*1.75) < A*.25 then hit
else 50% |
More mathematically, it looks like this:
Code: | P(hit) = 1 -
((1 - P(rand(A*.25, A*1.75) >= D*1.75)) *
(1 - P(rand(D*.25, D*1.75) < A*.25))) *
50%) |
Those individual probabilities are -- please double-check this part --
Code: | P(rand(A*.25, A*1.75) >= D*1.75)
~= 1 - ((A*1.75 - D*1.75) / A*1.5)
(this formula doesn't account for the case when the two values are equal)
P(rand(D*.25, D*1.75) < A*.25)
~= (A*.25 - D*.25) / D*1.5
50% = .5 :) |
So your final formula looks like this:
Code: | 1 -
((A*1.75 - D*1.75) / A*1.5) *
(1 - (A*.25 - D*.25) / D*1.5))
* .5 |
For Poor or Normal aim, multiply A by 2 or 4, respectively.
Gah, my brain. This should seriously be double-checked by someone else with a math background. _________________
|
|
Back to top |
|
 |
DukeofDellot

Joined: 07 Feb 2003 Posts: 32
|
Posted: Wed Mar 05, 2008 6:33 pm Post subject: |
|
|
That final formula's parenthesis don't match... but after cutting the last one (maybe that's a bad move) it's... um... well, still no dice.
Entering attack stat and defensive stats at 20
Normal: 80 against 20 produced 112.30%
Poor: 40 against 20 produced 58.98%
Bad: 20 against 20 produced 100.00%
Magic: 20 against 25 produced 135.27%
80 * .25 = 20
20 * 1.75 = 25
So there should be some chance for a miss on normal math. Plus, Bad should give something around, though probably not exactly, 50%. |
|
Back to top |
|
 |
Chenzi User was banned for this post

Joined: 02 Aug 2003 Posts: 190 Location: Grand Rapids, MI
|
Posted: Thu Mar 06, 2008 8:21 am Post subject: |
|
|
My contribution:
0/0 = 1.
Why? Because every other number divided by itself is 1.
See, math isn't hard. _________________ Allow me to preemptively disclose that I probably hate the person posting below, including myself. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Thu Mar 06, 2008 8:54 am Post subject: |
|
|
Shoot. I'll take another pass at it later today. _________________
|
|
Back to top |
|
 |
DukeofDellot

Joined: 07 Feb 2003 Posts: 32
|
Posted: Thu Mar 06, 2008 12:23 pm Post subject: |
|
|
0/0 is what we call an indeterminate form. When zero is divided by something, it always equals zero, however, when something is divided by 0, it is both positive infinity and negative infinity, or put simply, it doesn't exist. When you see this, we have what is called the Lo'Hopital (sp?) rule to figure out what it equals. 0/0 sometimes equals 1... but this is all calc, and I'm sure I'm saying it all wrong.
So you know, I've put in a good dozen attempts, and it caused me a headache each time... sometimes there's a good month between attempts... so, I've come up with a new approach. I need to know who decided that this would be the aim math... I also need an address and a baseball bat...
I've already got the bat. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Thu Mar 06, 2008 1:09 pm Post subject: |
|
|
Take two.
Here's my mistake. It should look like this:
Code: | if P1 then hit // P1
else if P2 then hit // + (1-P1) * P2
else if 50% then hit // + (1-((1-P1)*P2) * .5
P1 + (1-P1)*P2 + (1-((1-P1)*P2) * .5 |
...right? Right.
Code: | P1:
(A*1.75 - D*1.75) / A*1.5
P2:
(A*.25 - D*.25) / D*1.5 |
So the formula should look like this:
Code: | P1 + (1-P1)*P2 + (1-((1-P1)*P2) * .5
(A*1.75 - D*1.75) / A*1.5 +
( 1 - (A*1.75 - D*1.75) / A*1.5 ) * (A*.25 - D*.25) / D*1.5 ) +
(1-( 1 - (A*1.75 - D*1.75) / A*1.5 ) * (A*.25 - D*.25) / D*1.5 )) *.5 |
Better? _________________
|
|
Back to top |
|
 |
DukeofDellot

Joined: 07 Feb 2003 Posts: 32
|
Posted: Thu Mar 06, 2008 5:05 pm Post subject: |
|
|
no dice... there is quite a bit of parenthesis mismatching going on...
80 vs 20 = 192.38%
40 vs 20 = 175.39%
20 vs 20 = 50.00%
20 vs 25 = -21.84%
Does it help for me to mention that I have no idea what you're doing? Actually, I was stumped on your first step. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Fri Mar 07, 2008 10:32 am Post subject: |
|
|
Grr.
Okay, let's go step by step. Does this make sense?
Code: | if P1 then hit // P1
else if P2 then hit // + (1-P1) * P2
else if 50% then hit // + (1-((1-P1)*P2) * .5
P1 + (1-P1)*P2 + (1-((1-P1)*P2) * .5 |
I think I got that right, but please let me know if that doesn't sound right.
Then there's P1: rand(A*.25,A*1.75) >= D*1.75
My formula: (A*1.75 - D*1.75) / A*1.5
How I got that:
- A*1.75 - D*1.75 is how much of the range is above D*1.75.
- A*1.5 represents the range of values between A*.25 and A*1.75.
**Possible problem: It should be capped at 0 and 1. This may be what's causing the overall formula to screw up.**
P2 is calculated in pretty much the same way.
rand(D*.25,D*1.75) < A*.25
(A*.25 - D*.25) / D*1.5
- A*.25 - D*.25 is the part of the range that is below A*.25
- D*1.5 is the range of values between D*.25 and D*1.75
Try capping P1 and P2 between 0 and 1 and see if that fixes things. Otherwise, let me know if you see a mistake or have any more questions. _________________
|
|
Back to top |
|
 |
DukeofDellot

Joined: 07 Feb 2003 Posts: 32
|
Posted: Fri Mar 07, 2008 11:14 am Post subject: |
|
|
You still lost me... um... ... I guess I'm just not quite sure what P1 or P2 is, that's kinda' what I mean by first step. And capping? The problem was that there should have been a chance to miss, but your formula was producing a result greater than 100%, capping wouldn't have helped... and...
If it makes any difference, I figured out part of a piecewise function for it... now I'm curious how that would be entered into Excel... maybe a lot of if commands... um...
For the range D*.25 < A*.25 < D*1.75,
((((A*0.25)-(D*0.25))*(A*1.5))+(((D*1.75)-(A*0.25))*(((D*1.75)-(A*0.25))/2+(A*1.75)-(D*1.75))))/(A*D*2.25)
L=.25
H=1.75
R=1.5
That last variable on the far right is a DH.
Which was based on the method of finding each possible outcome and comparing them together. The reason this doesn't work for the full range is that it relies on the concept that there are two parts to the problem. One part where Dodge is too low for there to be a possibility for the Acc to roll for missing, and a second where the Acc roll (which I accounted for second) did matter. I've tested it against the manual and it holds true as long as it stays within the range... but as soon as it strays all hell breaks loose. In reverse (maybe I try to figure out the reverse tomorrow... I need a nap) it might get the range for when Dog is greater than Acc but there's still a chance to hit.
Just to say, it took me a year to get this far... and all I've learned was that there actually is an application for piecewise functions: simplicity.
Sorry... I guess I had it in me the whole time. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Fri Mar 07, 2008 11:26 am Post subject: |
|
|
Oh, sorry, I was shorthanding some of the notation. The original expression was:
Code: | if rand(A*.25,A*1.75) >= D*1.75 then hit
else if rand(D*.25,D*1.75) < A*.25 then hit
else 50% |
I was replacing those lines with P1 and P2, respectively.
Sounds like you've gotten it, though, which is a relief. This is way more confusing than it should be. _________________
|
|
Back to top |
|
 |
DukeofDellot

Joined: 07 Feb 2003 Posts: 32
|
Posted: Fri Mar 07, 2008 2:29 pm Post subject: |
|
|
Alright, simply exchanging the positions of A and D give you the chance to miss as long as there is a chance to hit, a chance to miss, and D is greater than A. So I attached the 1- at the beginning and it gave you the chance to hit in that range.
Alright, for some reason it took me about eight months to get to this point, and I'm not going to stop here. I announce "OHRstat deluxe edition" which will include all of the projects together in the same file... and maybe make it a little easier on the user.
Sorry about the mess.
Edit: On second thought... maybe I should just stop there. Maybe at some point I'll throw them in together... but... well... I don't feel like doing it any more. So I'll just make the aim math one less of an eyesore and post it.
Edit again: here it is. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon Mar 17, 2008 3:27 am Post subject: |
|
|
Opps, looks like I made a mistake in that example on the wiki. I've fixed it (I still have no idea how accurate it actually is though, I ignored all the tripping points), and mentioned OHRaim. Cool.
Calculating the exact chance to hit is difficult because of all the rounding and stuff that takes place. FreeBASIC rounds in 3 different ways depending on how exactly the code is written, so it would really require a lot of attention (and experimentation).
Customisable percentage based hit chances would be nice... _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Arwym FooBAM! Games (Formerly PF Games)

Joined: 13 Sep 2008 Posts: 33 Location: Puerto Rico
|
Posted: Wed Oct 01, 2008 8:27 pm Post subject: |
|
|
Wonderful. This will be so helpful.
A million thanks!  _________________ Still around.  |
|
Back to top |
|
 |
The Drizzle Who is the Drizzle?

Joined: 12 Nov 2003 Posts: 432
|
Posted: Wed Oct 01, 2008 9:54 pm Post subject: |
|
|
Quote: | Customisable percentage based hit chances would be nice... |
I've always wondered why that wasn't an option. _________________ My name is...
The shake-zula, the mic rulah, the old schoola, you wanna trip? I'll bring it to yah... |
|
Back to top |
|
 |
|