[Request]Karma-ish luck system

General feedback and discussion of the game.

Moderator: Forum Moderators

Daedal
Posts: 26
Joined: March 25th, 2009, 7:37 pm

Re: [Request]Karma-ish luck system

Post by Daedal »

The system described in the first post does sound a bit complicated as the OP states. How about a system based on two counters: expected damage and actual damage. Expected damage is calculated by damage per hit x number of strikes x defender's tile defense. Actual damage is just a counter for actual damage dealt by the unit. Both accumulate for each unit during a campaign or scenario. The further off the two numbers are, the greater the chance that the next hit will hit or miss, depending on the ratio of the two numbers.

Addressing the issue of using up your charge attack after loading up with other attacks: it's still chance based and you'd still have to miss several other swings in a row to give your charge attack a significantly boosted chance of hitting. And if the charge does hit, it'll bring your ratio back in line (maybe even reversing it) real quick. No harm done to the system.

Addressing the issue of having people try to game the system: just give them the difference between the two counters. Why hide it? Giving them this info will have two positive effects - players can use it to plan their strategy ("Hrm, my archer's expected:actual damage ratio is 2.5. I bet the next strike is going to hit.") and it'll also quiet people who will still complain that there's too much randomness. If the ratio is near one, there isn't.

Addressing the issue of calculating hit chance: hit chance = (100 - defense bonus OR special modifier: marksman, magic) + expected:actual damage ratio x K, where K is some fudge factor you want to throw in there. High K forces a ratio closer to 1.
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: [Request]Karma-ish luck system

Post by Zachron »

Zarel wrote: One unintended consequence that can be caused by "luck affecting luck" is "swinging" (you hit lots of times, so the karma system makes you miss a lot of times, which will make the karma system make you hit a lot of times, which will make the karma system make you miss a lot of times) and can happen if done incorrectly...
Yeah it could happen if done in a way not resembling my idea what-so-ever. I bolded what you put in parentheses because what is written there clearly demonstrates that you either did not read my idea fully, or are intentionally skewing it in order to make it easier to refute. In fact you're statement of the inherent flaws in a Karma system was what I went by in order to come up with the one I put forth.

What I proposed was two separate Mechanics:
Hit Karma - Makes you hit if you miss several times consecutively (with a minimum hit prob of 40% to accumulate with) Cannot make you miss.
Dodge Karma - Causes the enemy to miss you if you are hit several times consecutively while on terrain with a defense rating of 50% or higher.(Must get hit while under favorable circumstances) Cannot make you get hit.

The Two interacting: Because Dodge Karma is set to zero whenever you successfully dodge and hit Karma is set to zero whenever you successfully hit, at the end of a given engagement either the Attacker would have Hit Karma, or the Defender would have Dodge Karma. Since hitting while defending has no bearing on Hit Karma, nor does dodging while defending have any bearing on Dodge Karma the units' luck while retaliating or avoiding retaliation has no bearing on the mechanics what-so-ever.

Because the reservoirs are deep(Minimum of 3 for Hit, 3 for Dodge), and because they get completely emptied whenever anything disrupts the accumulation(Set to zero upon success) The odds of running into a situation where prospects are bad are pretty low. (In fact if you face a situation where the enemies all have full reservoirs, then you have a lead on them that they won't be able to recover from. The AI is not going to think to attack your leader only with the Horsemen that have their hit karma reserves full, and while a player would, any controlled exploit of the mechanic would only cost the player employing it any success in any other possible strategy, and most a player would be able to hold one strike in reserve.

As for the cumulative effects of the mechanic cascading, this is part of what the deep reservoirs are for. True each attack is not statistically independent all the time; nonetheless, the odds of the mechanic throwing the hit probability off are low. (With 12.96 being the maximum efficacy of the Hit Karma mechanic, and 34.3% being the maximum efficacy of the Doge Karma mechanic the cascade of one probability into the next is all of 4.44% in a maximized case) A complicated hit probability calculation need not be made on every attack(in fact the orders of magnitude in which the probability of the mechanic executing would come into play would be incredibly small in any accurate formula). Instead it would be far simpler to calculate the hit probability, and the odds of the mechanic being executed separately, and posting the odds separately. While understanding higher math would be necessary to put the hit probability display together, it would not be necessary to read it or play the game. There are worse things than not having a mathematically perfect strategy.

The idea of a Karma system does fundementally require luck-affecting luck, but the idea is for luck to mitigate luck, rather than for luck to create more luck. Which was part of my proposed minimum damage alternative as well. Both algorithms ulimately consist of two elements. First detect luck, then mitigate it. In the case of the Hit/Dodge Karma proposition, once a certain amount of luck is detected, a mitigation of lesser magnitude than the luck itself counters it. In the situation of my version of Minimum damage, once a certain amount of luck is detected, a mitigation of lesser magnitude than the luck itself counters it. And if you further define luck as the extent by which the actual statistical norm diverges from mean probability, you have luck affecting luck regardless, and probability affecting luck most definitely. Luck changes probabilities in both situations, the difference between minimum damage and karma in that regard, is one is effectual in a deterministic manner, while the other is effectual in a random manner. (My minimum damage proposition is a bit better in that it would derive minimum damage from the hit probability, causing the hit probability of the strike to be the determinant of how effectual the attack is rather than the number of strikes in the attack or total amount of damage of the attack(depending on whether the minimum damage scheme was per strike or per attack.), making the mechanic itself less random. I stand by halving minimum damage on single strike attacks... a nested if statement is hardly UNKISS)
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
User avatar
Zarel
Posts: 700
Joined: July 15th, 2009, 8:24 am
Location: Minnesota, USA
Contact:

Re: [Request]Karma-ish luck system

Post by Zarel »

Yogibear wrote:I dare to contest this. What is the measure of luck? To me it is the deviation of the damage in game in relation to the Expected Value (EV), like it is displayed in the statistics. If we take action (by whatever means) to keep this deviation smaller, it means we are taking luck away, not introducing more of it.
Luck is luck, and standard deviation is standard deviation. Whether or not you are taking luck away in some convoluted definition or not, the fact remains that strategic gameplay relies on being able to easily determine hit probabilities. Binomial, triangle, and uniform distributions are best for that effect, and statistical independence (i.e. the lack of luck affecting luck) is essential for it. Standard deviation, however, is nothing. You exploit high standard deviation when you have more to win than you have to lose and low standard deviation otherwise - it is the essence of strategy to have both. Removing high standard deviation will skew that strategy, and it's quite fortunate that MDE manages to achieve the desired effect without any of the drawbacks mentioned here.
Yogibear wrote:Generally, i would like to keep a constructive attitude upon things. If you think you have detected a flaw it is of course ok to tell about that. But instead of telling that ideas are bad because of said flaws, i would want to think of ways to improve them instead. And if people like having luck controlled by luck and if that leads to less strategy (i am not convinced of that but lets assume it for the moment) - so be it. For me that is not a reason to discard the whole idea.
I have proposed a simple solution for which no improvements have been posted, since it already does everything we require with no drawbacks [and thus no need for improvement].

Instead, you wish to look into implementing an idea so flawed that many post "improvements" (hi Daedal!) attempting to alleviate those; blind to the problem that, at its essence, two of its flaws are diametrically opposed, and attempting to alleviate one will only make the other worse.
Zachron wrote:Yeah it could happen if done in a way not resembling my idea what-so-ever.
Well, if you'd stop being so vague, I could custom-write a response.
Zachron wrote:Because the reservoirs are deep(Minimum of 3 for Hit, 3 for Dodge)
3 is hardly "deep".

Please stop being vague and pick a number, so I may produce non-vague calculations showing the flaws of your proposal.

For now, let N = reservoir size, (and let H = the number of hits the unit has, and D = the damage of each hit, and let P = the nominal hit probability).

Obvious flaw #1: A player gets a bunch of units, and one of them misses N-H+1 times in a row. Suddenly, he has a guaranteed hit, which he can spend in situations where he would otherwise be at risk!

Obvious flaw #2: A player gets a unit. Instead of having it do an average of H*D*P damage, when the last N-D hits have been the same, he instead has to calculate depending on current hit karma each hit individually to obtain a precise result.

Obvious flaw #3: If a unit hits N times and gets its guaranteed miss, that unit is 1/(1-P) (which will be approximately 2x on standard terrain, and can be as high as 10x on favorable terrain) times more likely to subsequently miss N times in a row. This is the "swing effect" in action, and it is guaranteed no matter what you set N to be.

[Possible] obvious flaw #4: Assuming N>10, the unit is more likely (see flaw #3) to miss 10 times in a row. Furthermore, far more annoying is, out of, say, 15 straight attacks, only hitting once, which hit karma will do little to prevent (so little, in fact, that it increases the probability more than it decreases it).

I notice you denied the swing effect, and now I have produced calculations to illustrate its effect. I think the mere fact that I know more about your proposal than you do should illustrate who is more likely to be correct.
Last edited by Zarel on May 6th, 2010, 2:37 am, edited 1 time in total.
Proud creator of the :whistle: smiley | I prefer the CC-0 license.
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: [Request]Karma-ish luck system

Post by Zachron »

Daedal wrote:The system described in the first post does sound a bit complicated as the OP states. How about a system based on two counters: expected damage and actual damage. Expected damage is calculated by damage per hit x number of strikes x defender's tile defense. Actual damage is just a counter for actual damage dealt by the unit. Both accumulate for each unit during a campaign or scenario. The further off the two numbers are, the greater the chance that the next hit will hit or miss, depending on the ratio of the two numbers.

Addressing the issue of using up your charge attack after loading up with other attacks: it's still chance based and you'd still have to miss several other swings in a row to give your charge attack a significantly boosted chance of hitting. And if the charge does hit, it'll bring your ratio back in line (maybe even reversing it) real quick. No harm done to the system.

Addressing the issue of having people try to game the system: just give them the difference between the two counters. Why hide it? Giving them this info will have two positive effects - players can use it to plan their strategy ("Hrm, my archer's expected:actual damage ratio is 2.5. I bet the next strike is going to hit.") and it'll also quiet people who will still complain that there's too much randomness. If the ratio is near one, there isn't.

Addressing the issue of calculating hit chance: hit chance = (100 - defense bonus OR special modifier: marksman, magic) + expected:actual damage ratio x K, where K is some fudge factor you want to throw in there. High K forces a ratio closer to 1.
This I address separately... I don't quite get what you are proposing, perhaps you need to state it more explicitly...

If I read correctly your system would simply be add the damage ratio to hit prob? I'm Not quite sure you have the dependency correct for what you desire to do.

I would call this method Karmic Rational Analysis. The luck factor is a very real statistic. The Game engine with any given game keeps track of this statistic by keeping track of three numbers for any given side (while additionally keeping track of them globally if I am not mistaken) These numbers are Total Damage, Maximum Possible Damage, and Total Expected Damage. The way these numbers are calculated are as follows. Total Damage goes up for a side whenever a strike from a unit on that side hits(unit inflicts damage, Total Damage goes up by said amount). Maximum Possible Damage goes up whenever a strike is throne by a unit from that side(unit can inflict damage, Maximum Possible Damage goes up by said amount whether the attack hits or misses). Total Expected Damage(Or is it Expected Damage Total) goes up each swing because every swing has a probability of hitting(so for every swing thrown, Expected Damage Total goes up by the damage the strike would inflict multiplied by the hit probability). From these values, various ratios can be construed.

Now There are two ways(which would have any real effect without being too overbearing)
One would be to take the ratio of Expected Total Damage to Actual Total Damage. (Expected Total/Actual Total) and Multiply all Hit Probabilities by this amount. Since I think these statistics are accumulated per attack rather than per strike, each strike of each attack will be statistically independent, but each attack will operate on a slightly different ratio. Hit prob would look like this...
[section]Hit Prob = (100% - defense rating) * (Expected Total Damage / Actual Total Damage)
[make the function that gets hit prob return a 1 for the ratio if Actual Total Damage is 0][/section]

The other way to go about it would be a to take a few more ratios, but it would involve simple addition or subtraction in the final evaluation. Divide Total Damage by Maximum Total Damage and multiply by 100. This gets you the Total Damage%. Next Divide Expected Total Damage by Maximum Total Damage and multiply by 100. This gets you Expected Damage%. Subtract Total Damage% from Expected Damage% and you will get your hit modifier. Hit probability would look like this...
[section]Hit Prob = (100% - defense rating) + (Expected Damage% - Total Damage%)[/section]

As you could see, it would be a simpler algorithm, but it's efficacy becomes far more random. If The difference between Expected Damage Total and Actual Damage Total get's great, it could become impossible to hit at low hit probs or impossible to miss at high hit probs. The problem in this case is, I'd find that fluctuations in luck would be to wild.

In either case, I think Expected Damage needs to be based solely off the base hit prob (100% - defense rating) so that probabilities return to the norm faster. This means runs of bad luck will be refunded in less good luck, and runs in good luck will be hit with less bad luck. It also means that luck has to be extraordinary before it starts messing with probabilities too much.
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: [Request]Karma-ish luck system

Post by Yogibear »

Zarel wrote:
Yogibear wrote:I dare to contest this. What is the measure of luck? To me it is the deviation of the damage in game in relation to the Expected Value (EV), like it is displayed in the statistics. If we take action (by whatever means) to keep this deviation smaller, it means we are taking luck away, not introducing more of it.
Luck is luck, and standard deviation is standard deviation. Whether or not you are taking luck away in some convoluted definition or not, the fact remains that strategic gameplay relies on being able to easily determine hit probabilities. Binomial, triangle, and uniform distributions are best for that effect, and statistical independence (i.e. the lack of luck affecting luck) is essential for it. Standard deviation, however, is nothing. You exploit high standard deviation when you have more to win than you have to lose and low standard deviation otherwise - it is the essence of strategy to have both. Removing high standard deviation will skew that strategy, and it's quite fortunate that MDE manages to achieve the desired effect without any of the drawbacks mentioned here.
Sorry, i don't understand you. Maybe you can give me a simple example to illustrate your point that does not need such a deep mathematical background?
Zarel wrote:
Yogibear wrote:Generally, i would like to keep a constructive attitude upon things. If you think you have detected a flaw it is of course ok to tell about that. But instead of telling that ideas are bad because of said flaws, i would want to think of ways to improve them instead. And if people like having luck controlled by luck and if that leads to less strategy (i am not convinced of that but lets assume it for the moment) - so be it. For me that is not a reason to discard the whole idea.
I have proposed a simple solution for which no improvements have been posted, since it already does everything we require with no drawbacks [and thus no need for improvement].

Instead, you wish to look into implementing an idea so flawed that many post "improvements" (hi Daedal!) attempting to alleviate those; blind to the problem that, at its essence, two of its flaws are diametrically opposed, and attempting to alleviate one will only make the other worse.
This is not a race in the sense that only the best solution will get implemented. So there is nothing wrong in proposing another solution and talk about its strengths and weaknesses. If you think it's a waste of time and other's don't, what's wrong about that?
Zarel wrote:For now, let N = reservoir size, (and let H = the number of hits the unit has, and D = the damage of each hit, and let P = the nominal hit probability).

Obvious flaw #1: A player gets a bunch of units, and one of them misses N-H+1 times in a row. Suddenly, he has a guaranteed hit, which he can spend in situations where he would otherwise be at risk!
Let's elaborate on that a bit. You are orcs vs loys and it's night. You attack a village held by a strong resilient spearman with 3 grunts from grass. Your first grunt misses both hits and gets retaliated 2/3 which equals to 10 damage. Your second grunt misses the first swing and hits the second: The spearman receives 12 damage, the grunt 10. The third grunt attacks, misses both swings, the spearman retalitates one swing. Overall, you would say that the attack went pretty bad for the Orcs.
- The spearman hit 5/9 which equals to 56%, pretty close to the expected 60%. Fair enough.
- Note that the second grunt made use of Karma, as the spearman dodged 3 hits. Fair enough to me as well.
- Loys received 12 damage (of which 8 will be healed away on their turn), Orcs received 25 damage.
- One grunt has no karma, two grunts have 2 Hit-Karma (3 are needed for a guaranteed hit). The spearman has 2 Dodge-Karma.

So, what happened? Orcs are more or less in trouble. Two grunts have accumulated Karma, but two are also 10 hitpoints down already. They are subject to counterattack and if you keep attacking with them there is a considerable risk of losing them. If on the other hand you retreat them at this point, you can hardly increase their Hit-Karma for a full day-night cycle without considerable risk, which is normally the next 6 turns (remember, they don't get Hit-Karma while retaliating on defense). I know there is the possibility to attack with them if you are defending but you have to heal them first. So, until after about 6 turns you get to the point to actually use your Hit-Karma you will have to take all the disadvantages at first: Either risk to lose units or diminished defending capabilities because they have to heal. Note also that if the grunt with 2-Hit-Karma attacks while defending your front at night to accumulate more Karma, no matter what happens he will have one hit guaranteed and lose his Hit-Karma (either half of it or everything, depending on the order of hits and misses).
I admit, this is a set up example. But even if you modify it (for example you attack the spearman ranged with archers, or you have 3 swing melee fighters), the point remains: To get a guaranteed hit, you will have to pay more or less badly - and you will have to pay in advance. I can't see that as a flaw, it rather seems to make things more fair to me.
Zarel wrote:Obvious flaw #2: A player gets a unit. Instead of having it do an average of H*D*P damage, when the last N-D hits have been the same, he instead has to calculate depending on current hit karma each hit individually to obtain a precise result.
I don't understand the reasoning in subtracting damage from the reservoir number (N-D), which is a hit counter. I assume you wanted to say "the last N hits" instead. If so, agreed on that one. Maybe we can find a way to lessen the players inconvenience?
Zarel wrote:Obvious flaw #3: If a unit hits N times and gets its guaranteed miss, that unit is 1/(1-P) (which will be approximately 2x on standard terrain, and can be as high as 10x on favorable terrain) times more likely to subsequently miss N times in a row. This is the "swing effect" in action, and it is guaranteed no matter what you set N to be.
Hmm, i can't follow your math. The attack goes hit / hit / hit / miss. After that, the attacker has 1 Hit-Karma and the defender has 0 Dodge-Karma. Unless i am missing something, the chances to miss the next 3 strikes without Karma are 12.5% and with Karma they are non-existent (the third swing can't miss as the defender has 3 Dodge-Karma at that point). No swing effect at all.
Zarel wrote:[Possible] obvious flaw #4: Assuming N>10, the unit is more likely (see flaw #3) to miss 10 times in a row. Furthermore, far more annoying is, out of, say, 15 straight attacks, only hitting once, which hit karma will do little to prevent (so little, in fact, that it increases the probability more than it decreases it).
I think the original poster was talking about N = 3, not N > 10. Let's stick to the proposal, not some fictitious scenarios that don't apply.
Zarel wrote:I notice you denied the swing effect, and now I have produced calculations to illustrate its effect. I think the mere fact that I know more about your proposal than you do should illustrate who is more likely to be correct.
<moderate mode>
I appreciate your efforts (i really do), but please note that statements like these are not helpful. Again, this is not a tournament about who has the best idea, who knows most or who is correct. Please stick to the topic, make your point, and leave it to the original poster what he makes out of it. It is his idea and his time he invested in it. That deserves respect, no matter if it is a feasible idea or not (and i am still not convinced that it isn't feasible).
</moderate mode>
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
krotop
2009 Map Contest Winner
Posts: 433
Joined: June 8th, 2006, 3:05 pm
Location: Bordeaux, France

Re: [Request]Karma-ish luck system

Post by krotop »

Zachron wrote:*The "Karma Limit" for "Hit Karma" is 3 by default, but becomes the number of strikes of the weapon used if said strikes are greater than 3. (if "Hit Karma" is 0 it will always be possible to miss every strike) "Karma Limit" gets reset whenever Karma is reset.
YogiBear wrote:The first question to be asked here is: What do we really want?

You might say: "I want to get rid of extreme luck." But that's not concrete enough. Is 0/4 on a 70% defense elusive foot extreme or not? When exactly would i want Karma to kick in? Let's make such an example first and use that as a base for discussion.
I think the goal should not be to shorten the length of streaks based around the amount of misses. As YogiBear pointed, it is not the same matter if you miss 4 times with a 30% chance to hit or with 70% cth. You anticipated that, Zachron, by excluding karma accumulation when the chance was not high enough, but I think it doesn't go far enough. Indeed it is still annoying to miss 10+ times a unit you have 30% chance to hit.
In my opinion, we should have as a goal : "I want to get rid of situation that have less than X% chance to happen" where that X can be set by the player. And to fulfill that goal, we should not only take into account the misses (and in my opinion also the hits, but let's forget the idea for now), but also weight how lucky/unlucky those misses are depending on how likely they are to happen.

What I suggest is to set the karma at 1 and then multiply the karma with (1-cth) for each strike missed, and grant a hit once the karma goes below 0.05 if we want to get rid of situations that have less than 5% chance to happen.

With a concrete example, if we want to exclude less than 5% chance-to-happen situations, it'll mean that on his next strike a unit could be granted an auto-hit after:
- 2 misses if it has 70% cth, because 1-cth = 0.3 and 0.3^3 < 0.05
- 4 misses if it has 50% cth, because 1-cth = 0.5 and 0.5^5 < 0.05
- 8 misses if it has 30% cth, because 1-cth = 0.7 and 0.7^9 < 0.05
- 2 misses on 50% cth, and 1 miss on 60% cth, because 0.5^2*0.4 = 0.1, and if the next strike is done with 60% cth,
0.1*0.4 < 0.05



For the recall, I used another concrete example that uses the same process except that the karma can go both ways, not just in favor of the player. The other difference is that the scale is not 0 to 1, but -30 to +30, I don't know for sure what's the most interesting to read, but anyway the '30' number in itself doesn't matter alone, what only needs to be kept in mind is that +30 is the 5% limit in favor of the player and -30 is the 5% limit against the player.
krotop wrote:I'll use your example of the elvish fighter battling a 1HP burner with a 60% cth.

With a karma range set from -30 to 30, which corresponds to situations with less than 5% chance to happen, the kill is guaranteed if the attack-karma at the beginning of the fight is at -6 or above, the survival chance is the same as standard wesnoth if the karma is between -7 and -27 (2.56%), and higher if the attack is at -28 or lower (6.40%).
I would like to come back to that "luck affect luck" expression. It will probably sound inflamatory, so apologizes in advance (edit: because it's not my prupose to put oil on the fire, but I don't know how to remain clear without being blunt). The expression doesn't mean much on its own, it's just a rhetorical trick to persuade that the influence of luck is increased when the events aren't independant with each other. But this is a false assumption, there's just a RNG as an input, and success or failures as output, and whether the events are independant or not is not relevant to answer if the influence of the RNG has been lessened, only the output in relation to the input can answer that.
Don't trust me, I'm just average player.
***
Game feedback for the Nightmares of Meloen
Art feedback by mystic x the unknown
Daedal
Posts: 26
Joined: March 25th, 2009, 7:37 pm

Re: [Request]Karma-ish luck system

Post by Daedal »

Zachron wrote:Hit Prob = (100% - defense rating) * (Expected Total Damage / Actual Total Damage)
I think we're both getting at the same thing and this formula is fine by me. I was adding the effect of the ratio multiplied by some fudge factor while you're multiplying by the ratio. The end result is more or less the same. I'd still throw in a fudge factor to make it easier to balance by tweaking that factor, but that's a minor point.
Zarel wrote:Luck is luck, and standard deviation is standard deviation. Whether or not you are taking luck away in some convoluted definition or not, the fact remains that strategic gameplay relies on being able to easily determine hit probabilities.
This luck system actually has a lot of potential to improve gameplay. Possibly more so than the other RNG thread going on in this forum at the same time because this system doesn't have the "thunderer can't beat a goblin on a town" issue. But anyway, the way I really see this system working is similar to the phenomenon of rubber band opponents in racing games. If you get really good at the game and are miles ahead of your opponents they get a speed boost to compensate and the same is true vice versa. This way you're always playing in a competitive atmosphere. It doesn't overly complicate the game, it just alters your opponents maximum velocity by "my position on the map" divided by "their position on the map." Now replace the idea of "I'm so good at this map that I can beat my opponents blindfolded" with "RNG just gave me 10 oddball hits in a row and now I've won/lost this scenario because of it." If this explanation doesn't make sense, maybe somebody else can express it better or offer a better analogy.
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: [Request]Karma-ish luck system

Post by Zachron »

Zarel wrote:
Zachron wrote:Yeah it could happen if done in a way not resembling my idea what-so-ever.
Well, if you'd stop being so vague, I could custom-write a response.
I've already laid the entire algorithm out and put forward the math on it.
Zarel wrote:
Zachron wrote:Because the reservoirs are deep(Minimum of 3 for Hit, 3 for Dodge)
3 is hardly "deep".

Please stop being vague and pick a number, so I may produce non-vague calculations showing the flaws of your proposal.

For now, let N = reservoir size, (and let H = the number of hits the unit has, and D = the damage of each hit, and let P = the nominal hit probability).

Obvious flaw #1: A player gets a bunch of units, and one of them misses N-H+1 times in a row. Suddenly, he has a guaranteed hit, which he can spend in situations where he would otherwise be at risk!

Obvious flaw #2: A player gets a unit. Instead of having it do an average of H*D*P damage, when the last N-D hits have been the same, he instead has to calculate depending on current hit karma each hit individually to obtain a precise result.

Obvious flaw #3: If a unit hits N times and gets its guaranteed miss, that unit is 1/(1-P) (which will be approximately 2x on standard terrain, and can be as high as 10x on favorable terrain) times more likely to subsequently miss N times in a row. This is the "swing effect" in action, and it is guaranteed no matter what you set N to be.

[Possible] obvious flaw #4: Assuming N>10, the unit is more likely (see flaw #3) to miss 10 times in a row. Furthermore, far more annoying is, out of, say, 15 straight attacks, only hitting once, which hit karma will do little to prevent (so little, in fact, that it increases the probability more than it decreases it).

I notice you denied the swing effect, and now I have produced calculations to illustrate its effect. I think the mere fact that I know more about your proposal than you do should illustrate who is more likely to be correct.
I do not believe you have really read into your math on it. Looking at the Swing effect full circle, it would only occur between one-on-one combatants. Any third party gets into the mix,(i.e. the fight becomes anything other than a duel)and your calculations become bogus. Furthermore, the cumulative effects of the Swing are diminished on each application. Say N = 3 and the highest liklihood of the hit mechanic executing is 21.6%, and the highest likelihood of the dodge mechanic being triggered by the the contribution the aforementioned hit mechanic is 6.3504%(which is the highest probability of the hit dodge mechanic activating upon N-1 consecutive dodges multiplied by the 12.96% chance of the hit mechanic executing in the first place.) The odds of such a swing happening, either between two units, or passed around the whole cluster%^&#, is all of 0.406...%. Now to objectively look at the swing effect we get the probability of the Hit mechanic executing at that moment and add the preceding probabilities, but each preceding probability added is a whole order of magnitude smaller, until after a few of the hypothetical "swings" influence gets smaller and smaller and smaller. So while the probability of a swing happening gets larger... the amount said probability increases gets exponentially[\b] smaller. We're talking hundredths of a percent by the 4th execution here. The probable influence of the first application continuously decreases until it may as well not exist, then the second application's influence decreases to that same level upon the next application to the extent it may as well not exist. Until the odds of the mechanic executing becomes 21.6%+6.3504%+0.406...%+0.02....% We're looking at a likelihood of roughly 28%... never increasing beyond it... The full power of the Swing effect at N = 3, the ultimate efficacy of the mechanic, in a worst case scenario, and the odds of a given "swing set" reaching that crisis is all of 0.4%. That is the 10x more likely scenario you brought up. I could guarantee you the mechanic will not start executing 28% of the time. The only thing that really increases the odds of the mechanic executing is the number of units in the field. More units would mean more reservoirs to fill and more Karma definitely being accumulated, but at the same time there would be more places for it to go. Every time one Karma increments by one, the other Karma of the opponent will reset to zero. Several of these "swings" will constantly be started and stopped just the same. Doing the calculus on that probability will require a slightly better simulation. (But I think we'll be hitting another situation where the increase in probability is diminished each time)
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
User avatar
Zarel
Posts: 700
Joined: July 15th, 2009, 8:24 am
Location: Minnesota, USA
Contact:

Re: [Request]Karma-ish luck system

Post by Zarel »

Yogibear wrote:Sorry, i don't understand you. Maybe you can give me a simple example to illustrate your point that does not need such a deep mathematical background?
My point, put simply, is that determining the probability of hitting an enemy should not require a deep mathematical background.

In statistics, the standard deviation is an expression of how large you should expect the difference between the result you get, and the average result, to be (i.e. the deviation). It is loosely correlated with the concept of "how random" something is: Something that usually gets around 30, 31, or 32 will have low standard deviation, while something that could be anywhere from 1 to 50 with simliar probabilities of each will have a high standard deviation.

In general, when we feel that the influence of luck is too powerful and we seek to decrease its influence, what we are seeking is to decrease the standard deviation. I do not dispute the fact that all the proposals so far do just that.

A binomial distribution is what you get when you have a hit/miss system, and each attack as the same probability of hitting. It allows for simple intuitive probability reckoning: The probability of hitting/missing N times in a row is P^N, where P is the hit/miss probability, respectively. Wesnoth damage is currently a binomial distribution, and my proposals preserve that. A karma system would replace that distribution with something significantly harder to calculate.

One other unintended consequence of this "significantly harder to calculate" is that it would also slow down the AI immensely.

The flaw with a strong karma system is that, in addition to decreasing the standard deviation, it makes hit probabilities nondeterministic and extremely difficult to calculate and anticipate. In addition, it decreases standard deviation too much, partially negating the point the idea that attacking is taking a risk.

The flaw with a weak karma system is that it decreases the standard deviation so little as to be unnoticeable, and still makes hit probabilities nondeterministic and difficult to calculate.

My proposal, as mentioned earlier, has neither of these flaws. I admit to bias, so I encourage others to point out the flaws of my own proposal, but so far it seems it has effectively none, except for a concern that guaranteeing minimum damage goes against the game philosophy which I acknowledge to a minor extent.
Yogibear wrote:This is not a race in the sense that only the best solution will get implemented. So there is nothing wrong in proposing another solution and talk about its strengths and weaknesses. If you think it's a waste of time and other's don't, what's wrong about that?
I apologize; my earlier statement was somewhat inflammatory. I just get frustrated sometimes when it seems people are blind to what I perceive are obvious flaws.
Yogibear wrote:
Zarel wrote:Obvious flaw #1: A player gets a bunch of units, and one of them misses N-H+1 times in a row. Suddenly, he has a guaranteed hit, which he can spend in situations where he would otherwise be at risk!
Let's elaborate on that a bit. You are orcs vs loys and it's night. You attack a village held by a strong resilient spearman with 3 grunts from grass. Your first grunt misses both hits and gets retaliated 2/3 which equals to 10 damage. Your second grunt misses the first swing and hits the second: The spearman receives 12 damage, the grunt 10. The third grunt attacks, misses both swings, the spearman retalitates one swing. Overall, you would say that the attack went pretty bad for the Orcs.
Erm, the flaw I was talking about is that you can take advantage of this. Obviously, if you don't try to take advantage of this, you won't see the flaw.

Now, what if the orcs have been making less-risky hits during the day, and retreating only when getting desirable karma. Say he's collected two grunts with 2-3 hit karma, and one grunt that simply hasn't gotten unlucky enough during the process. He attacks the spearman, and is now guaranteed at least 20 damage, and potentially far more, and giving himself significantly higher average damage than he should be getting in the situation.
Yogibear wrote:
Zarel wrote:Obvious flaw #2: A player gets a unit. Instead of having it do an average of H*D*P damage, when the last N-D hits have been the same, he instead has to calculate depending on current hit karma each hit individually to obtain a precise result.
I don't understand the reasoning in subtracting damage from the reservoir number (N-D), which is a hit counter. I assume you wanted to say "the last N hits" instead. If so, agreed on that one. Maybe we can find a way to lessen the players inconvenience?
Erm, sorry, I meant N-H. I have a method to lessen the player's inconvenience, it's called MDE. ;)
Yogibear wrote:
Zarel wrote:Obvious flaw #3: If a unit hits N times and gets its guaranteed miss, that unit is 1/(1-P) (which will be approximately 2x on standard terrain, and can be as high as 10x on favorable terrain) times more likely to subsequently miss N times in a row. This is the "swing effect" in action, and it is guaranteed no matter what you set N to be.
Hmm, i can't follow your math. The attack goes hit / hit / hit / miss. After that, the attacker has 1 Hit-Karma and the defender has 0 Dodge-Karma. Unless i am missing something, the chances to miss the next 3 strikes without Karma are 12.5% and with Karma they are non-existent (the third swing can't miss as the defender has 3 Dodge-Karma at that point). No swing effect at all.
The attack goes hit / hit / hit / miss. For the attacker to miss three times in a row, they only need to to miss twice more, so the probability is 25%.

On the other hand, the chances of hitting three times in a row normally is 12.5%, so hit karma makes the 3-in-a-row miss twice as likely.
Yogibear wrote:
Zarel wrote:[Possible] obvious flaw #4: Assuming N>10, the unit is more likely (see flaw #3) to miss 10 times in a row. Furthermore, far more annoying is, out of, say, 15 straight attacks, only hitting once, which hit karma will do little to prevent (so little, in fact, that it increases the probability more than it decreases it).
I think the original poster was talking about N = 3, not N > 10. Let's stick to the proposal, not some fictitious scenarios that don't apply.
Zachron's exact words were "minimum of 3" and "high", so I interpreted that as "N is significantly higher than 3" - 10 seemed like a reasonable estimate. If my estimate was wrong, well, that's why I said "possible".
Proud creator of the :whistle: smiley | I prefer the CC-0 license.
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: [Request]Karma-ish luck system

Post by Zachron »

I must concede that I mostly agree with what Zarel has said in this last post... I decided '3' was the minimum because it's the smallest number that would not be totally ridiculous and close to the largest number that would actually have any efficacy. If N was equal to 4, then the mechanic would have less efficacy but it would also incur less disruption. The idea is to maximize efficacy and minimize disruption... when the two are pretty close to one in the same (or are one in the same) then this becomes a more difficult optimization to judge.

For the sake of initial experimentation, 3 would be the value assigned to N.

On another note, one more change I would like to make (a somewhat simple one, but one that would fundamentally alter the algorithm) Base the Accumulation of Hit Karma and Dodge Karma solely on the actual hit probabilities of the strike. Hit Karma would be gained on no hit probability less than 40%, and dodge Karma would be gained against no hit probability greater than 50%. How this would affect the filter... well since the automatic hit would have a hit probability of 100% for that attack, no Dodge Karma would be gained by the defender. Since the automatic miss would have a hit probability of 0% no Hit Karma would be gained by the attacker.

The hit probability algorithm should have the capacity to take the mechanic into consideration... It's able to take abilities like Drain and Berserk just fine. It would simply make the projected results somewhat more complex...(although add berserk to the mix, and projected results would get exponentially more complex) Whatever the case, this should prevent the mechanic from cascading into increasing efficacy. That automatic hit will not become the first hit in a chain of hits leading to an automatic miss which becomes the first in a chain of misses leading to an automatic hit... This will also reduce the odds of a situation whereby all the units in the field have Hit Karma or Dodge Karma reserves that are close to full, causing a cascade of deterministic hits and misses.

Since I am confident that I have addressed every flaw that is not fundamental to the very concept, I think I'm ready to submit the GNA request... Expect to see it in the next few days, time permitting. IRL things are somewhat hectic at the moment, else I would have already submitted one by now.
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
User avatar
Zarel
Posts: 700
Joined: July 15th, 2009, 8:24 am
Location: Minnesota, USA
Contact:

Re: [Request]Karma-ish luck system

Post by Zarel »

I concede that if you really wanted a karma system that extended between attacks, this one is probably as good as it gets. However, I emphasize one last time that that doesn't mean that this proposal is good; merely that all karma systems are bad and should be disregarded entirely, and MDE should be used instead.

I will not submit my own proposal, since I don't actually think the luck system needs to be changed at all. My MDE suggestion is nothing more than what I perceive as a sane alternative to a karma system.
Proud creator of the :whistle: smiley | I prefer the CC-0 license.
User avatar
krotop
2009 Map Contest Winner
Posts: 433
Joined: June 8th, 2006, 3:05 pm
Location: Bordeaux, France

Re: [Request]Karma-ish luck system

Post by krotop »

Taking the risk to repeat myself, the karma system you propose, Zachron, doesn't prevent long streaks of dodging to happen for units with a high defense, such as footpads, fencers and the other elusive foot, or even units with a defense going around 50-60% (the majority of units in the game). Missing 10+ times in a row a unit with 60% or 70% defense is a frustrating experience that can be avoided with improvements on the karma system, and I think we can actually be satisfied by a karma system only once it is able to prevent such situation to occur.
Don't trust me, I'm just average player.
***
Game feedback for the Nightmares of Meloen
Art feedback by mystic x the unknown
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: [Request]Karma-ish luck system

Post by Zachron »

However missing 10 times in a row against such units is a frustration that the developers wished for us to endure. Missing 10 times in a row and hitting 6 times in a row just happens. (If you look closely at the conditions, A defense rating of 60% will have a hit probability of 40% and will activate the mechanic, but 70% will not.) Zarel hits the nail on the head with the word's "sane alternative." But I prefer a little insanity. lol.

The aim is not to get rid of luck at all, but to mitigate it. Nor is the aim to disrupt the actual path of the probability (which is what will happen if the engine was triggered by failures in disfavorable circumstances)
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
User avatar
krotop
2009 Map Contest Winner
Posts: 433
Joined: June 8th, 2006, 3:05 pm
Location: Bordeaux, France

Re: [Request]Karma-ish luck system

Post by krotop »

Zachron wrote:However missing 10 times in a row against such units is a frustration that the developers wished for us to endure.
I wholeheartedly disagree with this assumption. For the recall, missing 10 times in a row at 30% cth is about as likely to happen as missing 3 times in a row at 70% cth (~2.8% for the former and 2.7% for the latter).

Also, I must have misunderstood something, because the following explanations sound contradictory to me:
Zachron wrote:A defense rating of 60% will have a hit probability of 40% and will activate the mechanic
Zachron wrote:Hit Karma would be gained on no hit probability less than 40% (EDIT by krotop: that is to say, on hit probability greater than 60%)

EDIT:
Zachron wrote:Nor is the aim to disrupt the actual path of the probability
Of course it is our very precise aim to alter probabilities, and fortunately this is what the system you propose is already doing. Or am I missing something ?
Don't trust me, I'm just average player.
***
Game feedback for the Nightmares of Meloen
Art feedback by mystic x the unknown
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: [Request]Karma-ish luck system

Post by Zachron »

No hit probability less than 40% is in most cases the same as no defense rating greater than 60%.

The Dodge mechanic is based on a Defense rating of 50% or better, which means it would be gained against attacks with 50% hit probability or less. There is meant to be overlap in that regard.

If the mechanic extended to all hit probabilities then it would undercut the very premise of my proposition.
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
Post Reply