|
|
| Author |
Message |
Mickey science forum beginner
Joined: 18 May 2005
Posts: 14
|
Posted: Wed May 18, 2005 6:22 pm Post subject:
Please help me!
|
|
|
I am creating a simple adventure game and I need help with some math
formulas. I would truly appreciate any help.
In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:
If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%
Using the above data, I also need a formula to fairly determine whether
or not a monster strikes the player when they attack him.
Thank you for your help!
-Mickey |
|
| Back to top |
|
 |
T Rig science forum beginner
Joined: 06 May 2005
Posts: 13
|
Posted: Wed May 18, 2005 7:29 pm Post subject:
Re: Please help me!
|
|
|
| Quote: | If the player dexterity is equal to 10 and the monster type is equal to 1,
then the chances of striking the monster should be 50%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
|
C = 50 - ((50*Monster) / 2 ...with a little error near monster type 1 .
| Quote: | If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 100 and monster type is equal to 28, then
the chances of striking the monster should be 50%
|
C = 100 - ((50*Monster) / 2 ...with a little error near monster type 1 . |
|
| Back to top |
|
 |
Bill McCray science forum beginner
Joined: 18 May 2005
Posts: 44
|
Posted: Wed May 18, 2005 7:37 pm Post subject:
Re: Please help me!
|
|
|
On Wed, 18 May 2005 16:22:40 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:
| Quote: | I am creating a simple adventure game and I need help with some math
formulas. I would truly appreciate any help.
In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:
If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%
Using the above data, I also need a formula to fairly determine whether
or not a monster strikes the player when they attack him.
|
Since you've given four data points, I included a term with the
product of the Play and Monster values. It turns out to vanish. The
percent value is given by:
aP + bM + cPM + d
10a + b + 10c + d = 50
100a + b + 100c + d = 100
10a + 28b + 280c + d = 0
100a + 28b + 2800c + d = 50
90a + 90c = 50
90a + 2520c = 50
2430c = 0
c = 0
90a = 50
a = 5/9
50/9 + b + d = 50
50/9 + 28b + d = 0
-27b = 50
b = -50/27
150/27 - 50/27 + d = 50
100/27 + d = 50
d = 1350/27 - 100/27
d = 1250/27
(15/27)P - (50/27)M + 1250/27 =
(15P - 50M + 1250)/27 =
Checking:
P 10 100
15P 150 1500
M 1 28
50M 50 1400
P= 10, M= 1 (150 - 50 + 1250)/27 = 1350/27 = 50
P=100, M= 1 (1500 - 50 + 1250)/27 = 2700/27 = 100
P= 10, M=28 (150 - 1400 + 1250)/27 = 0/27 = 0
P=100, M=28 (1500 - 1400 + 1250)/27 = 1350/27 = 50
Bill
Swap first and last parts of username and ISP for address. |
|
| Back to top |
|
 |
Mickey science forum beginner
Joined: 18 May 2005
Posts: 14
|
Posted: Wed May 18, 2005 8:43 pm Post subject:
Re: Please help me!
|
|
|
Thank you very much, Bill, that is exactly what I was looking for and it
works GREAT! Could you please help me derive a similar formula for the
monster hitting the player?
Thanks again, I appreciate your help.
-Mickey
Bill McCray wrote:
| Quote: | On Wed, 18 May 2005 16:22:40 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:
I am creating a simple adventure game and I need help with some math
formulas. I would truly appreciate any help.
In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:
If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%
Using the above data, I also need a formula to fairly determine whether
or not a monster strikes the player when they attack him.
Since you've given four data points, I included a term with the
product of the Play and Monster values. It turns out to vanish. The
percent value is given by:
aP + bM + cPM + d
10a + b + 10c + d = 50
100a + b + 100c + d = 100
10a + 28b + 280c + d = 0
100a + 28b + 2800c + d = 50
90a + 90c = 50
90a + 2520c = 50
2430c = 0
c = 0
90a = 50
a = 5/9
50/9 + b + d = 50
50/9 + 28b + d = 0
-27b = 50
b = -50/27
150/27 - 50/27 + d = 50
100/27 + d = 50
d = 1350/27 - 100/27
d = 1250/27
(15/27)P - (50/27)M + 1250/27 =
(15P - 50M + 1250)/27 =
Checking:
P 10 100
15P 150 1500
M 1 28
50M 50 1400
P= 10, M= 1 (150 - 50 + 1250)/27 = 1350/27 = 50
P=100, M= 1 (1500 - 50 + 1250)/27 = 2700/27 = 100
P= 10, M=28 (150 - 1400 + 1250)/27 = 0/27 = 0
P=100, M=28 (1500 - 1400 + 1250)/27 = 1350/27 = 50
Bill
Swap first and last parts of username and ISP for address. |
|
|
| Back to top |
|
 |
Mickey science forum beginner
Joined: 18 May 2005
Posts: 14
|
Posted: Wed May 18, 2005 8:44 pm Post subject:
Re: Please help me!
|
|
|
T Rig wrote:
| Quote: | If the player dexterity is equal to 10 and the monster type is equal to 1,
then the chances of striking the monster should be 50%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
C = 50 - ((50*Monster) / 2 ...with a little error near monster type 1 .
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 100 and monster type is equal to 28, then
the chances of striking the monster should be 50%
C = 100 - ((50*Monster) / 2 ...with a little error near monster type 1 .
|
Thank you for your help, T Rig. |
|
| Back to top |
|
 |
Jim Spriggs science forum Guru
Joined: 24 Mar 2005
Posts: 761
|
Posted: Wed May 18, 2005 9:16 pm Post subject:
Re: Please help me!
|
|
|
Mickey wrote:
| Quote: |
I am multi-posting
|
See my reply in alt.math. |
|
| Back to top |
|
 |
Jim Spriggs science forum Guru
Joined: 24 Mar 2005
Posts: 761
|
Posted: Wed May 18, 2005 10:00 pm Post subject:
Re: Please help me!
|
|
|
T Rig wrote:
| Quote: |
If the player dexterity is equal to 10 and the monster type is equal to 1,
then the chances of striking the monster should be 50%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
C = 50 - ((50*Monster) / 2 ...with a little error near monster type 1 .
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 100 and monster type is equal to 28, then
the chances of striking the monster should be 50%
C = 100 - ((50*Monster) / 2 ...with a little error near monster type 1 .
|
I suspect that the op wants a formula that works for all monster types
and degrees of dexterity. I recommend a look-up table. |
|
| Back to top |
|
 |
Bill McCray science forum beginner
Joined: 18 May 2005
Posts: 44
|
Posted: Wed May 18, 2005 10:34 pm Post subject:
Re: Please help me!
|
|
|
On Wed, 18 May 2005 18:43:39 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:
| Quote: |
Thank you very much, Bill, that is exactly what I was looking for and it
works GREAT!
|
I'm happy that I could help.
| Quote: | Could you please help me derive a similar formula for the monster hitting
the player?
|
You'll have to specify the attributes you want in it.
| Quote: | Thanks again, I appreciate your help.
-Mickey
Bill McCray wrote:
On Wed, 18 May 2005 16:22:40 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:
I am creating a simple adventure game and I need help with some math
formulas. I would truly appreciate any help.
In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:
If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%
Using the above data, I also need a formula to fairly determine whether
or not a monster strikes the player when they attack him.
Since you've given four data points, I included a term with the
product of the Play and Monster values. It turns out to vanish. The
percent value is given by:
aP + bM + cPM + d
10a + b + 10c + d = 50
100a + b + 100c + d = 100
10a + 28b + 280c + d = 0
100a + 28b + 2800c + d = 50
90a + 90c = 50
90a + 2520c = 50
2430c = 0
c = 0
90a = 50
a = 5/9
50/9 + b + d = 50
50/9 + 28b + d = 0
-27b = 50
b = -50/27
150/27 - 50/27 + d = 50
100/27 + d = 50
d = 1350/27 - 100/27
d = 1250/27
(15/27)P - (50/27)M + 1250/27 =
(15P - 50M + 1250)/27 =
Checking:
P 10 100
15P 150 1500
M 1 28
50M 50 1400
P= 10, M= 1 (150 - 50 + 1250)/27 = 1350/27 = 50
P=100, M= 1 (1500 - 50 + 1250)/27 = 2700/27 = 100
P= 10, M=28 (150 - 1400 + 1250)/27 = 0/27 = 0
P=100, M=28 (1500 - 1400 + 1250)/27 = 1350/27 = 50
Bill
Swap first and last parts of username and ISP for address.
|
Swap first and last parts of username and ISP for address. |
|
| Back to top |
|
 |
Mike science forum Guru
Joined: 11 May 2005
Posts: 543
|
Posted: Thu May 19, 2005 12:16 am Post subject:
Re: Please help me!
|
|
|
In article <pJSdnfUt7MmHWBbfRVn-jg@speakeasy.net>,
REMOVETHISTEXT.portillas@hotmail.com says...
| Quote: |
Thank you very much, Bill, that is exactly what I was looking for and it
works GREAT! Could you please help me derive a similar formula for the
monster hitting the player?
Thanks again, I appreciate your help.
-Mickey
....(with snipping)..
Since you've given four data points, I included a term with the
product of the Play and Monster values. It turns out to vanish. The
percent value is given by:
Strike% = aP + bM + cPM + d
c = 0
a = 5/9
b = -50/27
d = 1250/27
|
....and you may want to add a check to ensure that Strike%
doesn't fall below zero if the player drops below 10.For
example:
% = Max(0,Strike%)
Mike |
|
| Back to top |
|
 |
T Rig science forum beginner
Joined: 06 May 2005
Posts: 13
|
Posted: Thu May 19, 2005 4:20 am Post subject:
Re: Please help me!
|
|
|
I recently implemented a parabolic curve fit including 3x3 matrix
elimination so I'll try a curve fit:
Level 10
| Quote: | C = 50 - ((50*Monster) / 2 ...with a little error near monster type 1 .
|
For an x,y of 1,50 , 14,25 , 28,0 that's
y = 50.90551 - 1.65062*x - 0.00687*x^2 .
Level 100
| Quote: | C = 100 - ((50*Monster) / 2 ...with a little error near monster type 1 .
|
For an x,y of 1,100 , 14,75 , 28,50 that's
y = 100.90551 - 1.650662*x - 0.00687*x^2 . |
|
| Back to top |
|
 |
Mickey science forum beginner
Joined: 18 May 2005
Posts: 14
|
Posted: Thu May 19, 2005 1:11 pm Post subject:
Re: Please help me!
|
|
|
Bill,
I tried the following, but my results are skewed by -5. Where did I go
wrong?
If the monster type is equal to 1 and the player dexterity is equal to
10, then the monster has a 50% chance of striking the player.
If the monster type is equal to 28 and the player dexterity is equal to
10, then the monster has a 100% chance of striking the player.
If the monster type is equal to 1 and the player dexterity is equal to
100, then the monster has a 0% chance of striking the player.
If the monster type is equal to 28 and the player dexterity is equal to
100, then the monster has a 50% chance of striking the player.
aP + bM + cPM + d
a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50
27a + 270c = 50
27a + 2600c = 50
2330c = 0
c = 0
27a = 50
a = 50/27
50/27 + 10b + d = 50
50/27 + 100b + d = 0
-90b = 50
b = -5/9
50/27 - 15/27 + d = 50
35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27
(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =
-Mickey |
|
| Back to top |
|
 |
Mickey science forum beginner
Joined: 18 May 2005
Posts: 14
|
Posted: Thu May 19, 2005 1:36 pm Post subject:
Re: Please help me!
|
|
|
I found one error, but it doesn't fix the result...
27a + 2600c = 50
2330c = 0
should be:
27a + 2700c = 50
2430c = 0
-Mickey |
|
| Back to top |
|
 |
John Bailey science forum addict
Joined: 05 May 2005
Posts: 72
|
Posted: Thu May 19, 2005 4:39 pm Post subject:
Re: Please help me!
|
|
|
On Wed, 18 May 2005 18:43:39 -0400, Mickey > wrote:
| Quote: | In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:
If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%
If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%
If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%
If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%
|
Not trying to be a WA, but I sought an answer that did not require 4
simultaneous equations. I think it allows reuse of the relations in
other situations.
If we invent two intermediate variables, call them q and r.
We can write a payoff equation directly from knowing the payoffs at
the four points you gave:
P = 0(1-q)(1-r)+50(1-q)r+50q(1-r)+100qr
Now make q= (d-10)/90 and r=(m-1)/27 where d is the dexterity of the
player and m is the strength of the monster. This just converts the
dexterity and strength values to values between 0 and 1.
Thats it!
Checking these results:
q has value 0 if d=10, q has value 1 if d=100
r has value 0 if m=1, r has value 1 if m=28
P has value 100 if both q and r are 1 (m=28,d=100)
P has value 50 if only 1 of q and r are 1, the other 0
P has value 0 if both q and r are 0 (m=1,d=10)
Obviously some algebra might reduce the number of terms in the
equation, but for a computer program, these steps may be as logical
and simple as anything.
The visualization concept that supports this view is treating the
Payoff as the payoff surface for a 2 player, zero sum game.
To see it go to http://tinyurl.com/96x6j
John Bailey
http://home.rochester.rr.com/jbxroads/mailto.html |
|
| Back to top |
|
 |
Bill McCray science forum beginner
Joined: 18 May 2005
Posts: 44
|
Posted: Thu May 19, 2005 4:54 pm Post subject:
Re: Please help me!
|
|
|
On Thu, 19 May 2005 11:11:47 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:
| Quote: |
Bill,
I tried the following, but my results are skewed by -5. Where did I go
wrong?
If the monster type is equal to 1 and the player dexterity is equal to
10, then the monster has a 50% chance of striking the player.
If the monster type is equal to 28 and the player dexterity is equal to
10, then the monster has a 100% chance of striking the player.
If the monster type is equal to 1 and the player dexterity is equal to
100, then the monster has a 0% chance of striking the player.
If the monster type is equal to 28 and the player dexterity is equal to
100, then the monster has a 50% chance of striking the player.
aP + bM + cPM + d
|
First thing is that you've put the player's dexterity in the monster
variable and the monster type in the player's variable, so let's
change the formula to aM + bP + cPM + d to match what you have below.
| Quote: | a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50
27a + 270c = 50
27a + 2600c = 50
2330c = 0
c = 0
27a = 50
a = 50/27
|
Okay so far.
| Quote: | 50/27 + 10b + d = 50
50/27 + 100b + d = 0
-90b = 50
b = -5/9
50/27 - 15/27 + d = 50
|
Here you should be substituting a and b into
a + 10b + d = 50
which you give you
50/27 - 150/27 + d = 50
Solving this for d gives
d - 100/27 = 50
d = 50 + 100/27
d = (1350 + 100)/27
d = 1450/27
| Quote: | 35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27
(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =
|
(50M - 15P + 1450)/27
Bill
Swap first and last parts of username and ISP for address. |
|
| Back to top |
|
 |
Mickey science forum beginner
Joined: 18 May 2005
Posts: 14
|
Posted: Thu May 19, 2005 5:13 pm Post subject:
thanks to all
|
|
|
I had noticed the player - dexterity swap error and also the error I had
in the calculation for c. I now see where I went wrong in calculating b,
forget to multiply by 10. Thanks very much Bill, your breakdown of
everything made it clear. Thanks to everyone who replied.
-Mickey
Bill McCray wrote:
| Quote: | On Thu, 19 May 2005 11:11:47 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:
Bill,
I tried the following, but my results are skewed by -5. Where did I go
wrong?
If the monster type is equal to 1 and the player dexterity is equal to
10, then the monster has a 50% chance of striking the player.
If the monster type is equal to 28 and the player dexterity is equal to
10, then the monster has a 100% chance of striking the player.
If the monster type is equal to 1 and the player dexterity is equal to
100, then the monster has a 0% chance of striking the player.
If the monster type is equal to 28 and the player dexterity is equal to
100, then the monster has a 50% chance of striking the player.
aP + bM + cPM + d
First thing is that you've put the player's dexterity in the monster
variable and the monster type in the player's variable, so let's
change the formula to aM + bP + cPM + d to match what you have below.
a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50
27a + 270c = 50
27a + 2600c = 50
2330c = 0
c = 0
27a = 50
a = 50/27
Okay so far.
50/27 + 10b + d = 50
50/27 + 100b + d = 0
-90b = 50
b = -5/9
50/27 - 15/27 + d = 50
Here you should be substituting a and b into
a + 10b + d = 50
which you give you
50/27 - 150/27 + d = 50
Solving this for d gives
d - 100/27 = 50
d = 50 + 100/27
d = (1350 + 100)/27
d = 1450/27
35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27
(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =
(50M - 15P + 1450)/27
-Mickey
Bill
Swap first and last parts of username and ISP for address. |
|
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 9:50 pm | All times are GMT
|
|
Myspace Layouts | Guitar Lessons | Facebook Proxy | Coupons | Duwayne Burnside
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
Other DeniX Solutions sites:
Electronics forum |
Medicine forum |
Unix/Linux blog |
Unix/Linux documentation |
Unix/Linux forums
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|