alistairreilly / andors-trail

Automatically exported from code.google.com/p/andors-trail
1 stars 0 forks source link

Chance to hit monster should be nonlinear #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The current combat system works roughly as follows:

1) Determine X = (attacker's attack chance) - (target's block chance)
2) Roll a 100-sided dice.
3) If the dice value is less than X, the attack is a miss.
4) Otherwise, it's a hit. Determine damage.

This can lead to situations where neither the monster nor the player can hit 
each other, which is frustrating for the players. This is a purely linear 
function on AC (attacker's attack chance) and BC (target's block chance). 
Instead, we should consider some nonlinear function to determine hit/miss 
depending on AC and BC.

See issue #19 for one suggestion of an asymptotic function.

Original issue reported on code.google.com by oskar.wi...@gmail.com on 23 Nov 2010 at 10:18

GoogleCodeExporter commented 9 years ago
My suggestion is to use arctan(AC-BC) as nonlinear function. This way, we 
canmake it so that the chance to hit would near 0 if the target's block chance 
is much higher than the attacker's attack chance, and near 100 if it's the 
other way around.

My suggestion is the following formula: f(c)=chance to hit
f(c) = 50 * (1 + (2/pi) * ATAN( (c-n) / F ) )
where n=50 and F=40.
I've made a quick graph of this here:
https://spreadsheets.google.com/ccc?key=0AlzojXWckOcAdEhEVTZ1QnFNa1IzNDd4NW9oNjZ
WakE&hl=en&authkey=CIWm_84B

Please reply with your comments and suggestions.

Original comment by oskar.wi...@gmail.com on 23 Nov 2010 at 11:25

GoogleCodeExporter commented 9 years ago
This is now implemented in v0.6.6 . It will most likely be included in the 
updated version for Android Market.

Original comment by oskar.wi...@gmail.com on 24 Nov 2010 at 9:13

GoogleCodeExporter commented 9 years ago
It looks like a nice asymptotic function for this purpose. Well done.
I like that it is backward compatible to AC and BC, (My function did use only 
one armor value instead) and yours also supports negative numbers.

One remark: Could you please add a "chance booster"?
If both the hero and the monsters have very low f(c) value (like 5% or 10%) 
then boost it up by a factor B to 30% or even 50% chance that someone could do 
a hit in a round.

For a 30% chance to hit, B would be calculated like:
B = 0.3 / (f_hero(c) + f_monster_1(c) + ... +f_monster_n(c))

For a 50% chance to hit, B would be calculated like:
B = 0.5 / (f_hero(c) + f_monster_1(c) + ... +f_monster_n(c))

Assume the following situation then once in 10 turns something would happen. - 
very frustrating
f_hero(c) = 7%
f_monster(c) = 3%

After boosting the values once each 3 turns something would happen
B = 0.3 / (0.07 + 0.03) = 3
f_hero_boosted(c) = 21%
f_monster_boosted(c) = 9%

Motivation: I wanted to kill the ants in the crypt and got only a 5% chance to 
attack them. (they are far too strong for this early stage) But I was in an 
advantage because they had a 0% chance to attack me. :-)

Its frustrating to attack them around 40 times to kill them. Otherwise make 
sure a monster never has too much BC.

Original comment by SamuelPl...@gmail.com on 24 Nov 2010 at 11:49

GoogleCodeExporter commented 9 years ago
Good idea about the chance booster. However I think the implementation of it 
could be tricky. As an example, let's say the player fights a troll with hit 
chance f_monster(c)=30%, and has f_hero(c)=10% . B would then be = 0.3 / (0.1 + 
0.3) = 0.75 , which is a reduction in hit chance. Given the already low hit 
chances, lowering them even more would feel wrong.

Actually, I think the new combat system with the improved hit chance formula 
will remove the need for boosting the hit chance. Let's take the yellow cave 
ants as  example: the ant has AC=30, BC=80, and let's say the player has AC=70, 
BC=30. Then 
c_hero = 70-80 = -10
c_ant = 30-30 = 0
With the new hit chance formula, this will result in f(c_hero)=19 and 
f(c_ant)=21 . That's really an improvement from the previous formula, where 
both f(c) would be near 0.

Let's try the new hit chance formula a bit first. If we feel that there are 
some monsters that are too hard to hit, we might consider boosting the hit 
chances like you describe. Meanwhile, let's try it this way.

Oh, and we haven't even begun discussing damage resistance :) That will also 
cause the monsters to be harder.

Original comment by oskar.wi...@gmail.com on 25 Nov 2010 at 8:42

GoogleCodeExporter commented 9 years ago
Of course the boost should only be applied for B > 1.0.
I also think the situation should be improved, but you never know, sooner or 
later it will happen again. (with stronger items / monsters)

Original comment by SamuelPl...@gmail.com on 25 Nov 2010 at 11:44

GoogleCodeExporter commented 9 years ago
It happened again with the beta version, you provided to me.
In the cave there were many long fights because of low chances.

Perhaps it should not only boost em up to 30% but even to 40% or 50%.

Original comment by SamuelPl...@gmail.com on 25 Nov 2010 at 6:58

GoogleCodeExporter commented 9 years ago
IMO an important point to always have interesting fights.

Original comment by SamuelPl...@gmail.com on 25 Nov 2010 at 6:59

GoogleCodeExporter commented 9 years ago
Kudos to a great game.  Maybe impliment a critical hit ratio?  Say rolling a 
100 sided die with a 1% critical chance, you would need to roll a 100.  Adding 
to critical chance would give you more leeway, 1 critical rating would let you 
need one less number.

Original comment by jetsroc...@gmail.com on 25 Nov 2010 at 7:25

GoogleCodeExporter commented 9 years ago
There actually already is a critical hit chance. No monsters or weapons in 
v0.6.4 have that ability yet though, so I guess it's not that apparent :) In 
the future when we add skills, one skill should be to increase critical hit 
chance, and another should be to increase critical hit multiplier.

With the new chance-to-hit formula, you will anyway never get 0% hit chance, it 
will most likely be near 10% or so, which IMO is a good thing.

Regarding the boost factor, that's something that we should consider for a 
future relase. It could also be that you are experiencing long fights because 
of some monsters damage resistance. One boss even has 5 DR.

Let's keep this issue open so we don't forget about the boost factor. 
Meanwhile, this new attack chance formula works great compared to the old one I 
think.

Original comment by oskar.wi...@gmail.com on 26 Nov 2010 at 1:43

GoogleCodeExporter commented 9 years ago
I just had a thought about the boost: Perhaps it would give advantage to the 
player as he is usually the first attacking. (if we will not change something 
for issue 30)

Then it would be an advantage for him as he has greater chances to kill the 
monster in the first turn. Then the monster would have no advantage of his 
boosted chances.

So either
1) change something for this issue and issue 30
2) ignore the advantage as it is the player ;-)
3) start the boost in the second attack turn or in a random attack turn from 
turn 1-3.

Original comment by SamuelPl...@gmail.com on 26 Nov 2010 at 11:17

GoogleCodeExporter commented 9 years ago
I'll prioritize the boost factor for 0.6.7 . I agree that it would make the 
game more fun.

Original comment by oskar.wi...@gmail.com on 3 Dec 2010 at 10:01

GoogleCodeExporter commented 9 years ago
re 10: 
4) start the boost at a random _combatant_. i.e. not necessarily at beginning 
of turn.
NB. it's not always the player who attacks first, but usually this is the case, 
indeed. maybe another issue, but are there discussions about 
- initiative / first strike / simultaneous strike? (similar to Heroes IV)
- critical threat instead of critical chance? (as in d20 games)

Original comment by surrano on 8 Dec 2010 at 11:20

GoogleCodeExporter commented 9 years ago
By the way there are three basic approaches to incredibly high and low att/def 
differences.
- Earthdawn: "open" rolls (i.e. if you roll max, reroll and add to previous. 
Repeat if max again...) You can succeed in anything, with exponentially eroding 
chance of success.
- d20 and predecessors: "fatality" (max always hits. min always misses.)
- d20 variant: Roll d20. 20 means 30. 1 means -10.
In the latter case, the explanation is the encounter of a lowly kobold (att 5, 
def 15) with an ancient dragon (att 40, def 40).
- the kobold will never even scratch the hard scales of a dragon with his 
mundane spear (smaller than a toothpick in dragon aspects)
- the dragon will never miss the kobold with her huge talons, tail, or bite.

This model is maybe closest to Earthdawn; I wonder if there is a version more 
"environmentally friendly" than using a trigonometry function (dunno, maybe 
atomic cpu instruction in most Android-capable phones.

Original comment by balazs....@gmail.com on 21 Dec 2010 at 10:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@comment 14:
I disagree. I calculated the real attack chances used by the game in your fight:
https://spreadsheets.google.com/ccc?key=0AlzojXWckOcAdEhEVTZ1QnFNa1IzNDd4NW9oNjZ
WakE&hl=en&authkey=CIWm_84B#gid=0

You had: 80% (13 HP - AD 10-14 - DR +1 - AP 4)
The snake had: 76% (8 HP - AD 2 - AP 5 - CC 10% - CM 2)

An average young snake would deal around 1 HP damage (8% of your HP in this 
situation) to you until it gets killed. It would be boring if it was like that. 
So we need chance.

I assume you killed many snakes without being hurt by them. Now comes revenge 
;-). You should have tried to flee after the snake dealt 8 damage.

To make a long story short: If you could kill any monster that is 10-15 times 
weaker then you, then you could actually kill a thousands of them or 6 at a 
time. And that would be unrealistic.

PS: You should definitely spend some money for defense. (BC)

Original comment by SamuelPl...@gmail.com on 25 Dec 2010 at 10:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Did not wanted to offense you. Sorry. Feedback is welcome.

Quote:
> The point I was trying to get across is, in my experience playing,
> there is a large difference between what my hit percentage should
> be and what it actually is in practice.

I checked the code. The chance calculating seems to be correctly implemented.
*I think* its a matter of perception. You know murphys law? In average you will 
hit 80% of the time. You will sometimes hit 90% or 100% and sometimes 75%, 50% 
or even 10% of the time. You will not mention to get hits 20 times in a row. 
But you will mention if there are 4 misses in a row.

Get a dice and roll for a 6. Sometimes you will roll 3 times a 6 in a row. 
Sometimes you will have to wait for it for 20 or even 40 trys.

One important question: Do you think its a matter of perception or do you think 
the game has a bug? Could you prove or reproduce it? IMO on *average* the 
chances are correct.

*IMO* good and bad luck would be better then:
hit, hit, hit, hit, miss, hit, hit, hit, hit, miss,
hit, hit, hit, hit, miss, hit, hit, hit, hit, miss,
hit, hit, hit, hit, miss, hit, hit, hit, hit, miss,
hit, hit, hit, hit, miss, hit, hit, hit, hit, miss

PS: There are harder snakes with better stats. When I was in level 7 I usually 
got to the mid of the snake cave. Then I had to return to heal in bed or use 
many potions.

Original comment by SamuelPl...@gmail.com on 26 Dec 2010 at 1:49

GoogleCodeExporter commented 9 years ago

Original comment by oskar.wi...@gmail.com on 10 Feb 2011 at 6:45

GoogleCodeExporter commented 9 years ago
I think this one could be closed. No chance booster needed in level 50 anymore. 
;-)

A chance booster would also have the disadvantage that it would be confusing 
towards the player.

What do you think?

Original comment by SamuelPl...@gmail.com on 9 Jul 2011 at 6:23

GoogleCodeExporter commented 9 years ago
Closing. Main issue fixed in v0.6.6 . Sub issues will not be implemented.

Original comment by oskar.wi...@gmail.com on 13 Jul 2011 at 8:29