🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

The simplest but most effective and intuitive way to implement Accuracy and Dodge chance in an RPG?

Started by
13 comments, last by nullbear 7 years, 3 months ago

Don't present the values as percentage if the skill roll will be anything else than straight: Chance to hit = attack%, chance to avoid a hit = dodge% (so the chance to really hit becomes attack%*(100-dodge%). Otherwise, it makes things confusing.

You can still use a 0-100 scale even if you don't use percentages:

0 is the minimum for a human, and 100 the max, so the values don't seem entirely nonsensical, and attributes ans skills remain within a reasonable range.

Then you are free to use whatever formula best suits your need.

I have a soft spot for gaussians, because they are more predictable than raw %.

In my game, I went with:

Skills on a 0-10 scale,

roll as many 10 sided dice as stats, and keep the second highest (except if the skill is 0 or 1, then roll 4-skill and keep the lowest).

Attack vs dodge is an opposed roll.

I recommend you read the following articles:

Dice-Rolling Mechanisms in RPG by Torben Mogensen

Treatise on Different Dice-rolling Mechanics on wikidot

Advertisement
100% dodge vs 100% accuracy is the good old paradox what happens when the immovable object meets the unstoppable one?

Eh I'm not seeing it. 100% accuracy means, say, a sword goes exactly through the path the character intended to. If the enemy has 100% dodge, he could dodge the attack anyway.

So first check for accuracy, then for dodge. If you have low accuracy, the enemy might not even need to dodge anything. But if it does, then the enemy's dodge skill comes to play.

Still, that gives you an accuracy * enemy's dodge chance to hit, which might become really really low if your accuracy is kinda crappy and the enemy can dodge a bit. Thus you'd end fighting for 20 min not connecting any attack.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

I've always tended to shy away from representing to-hit and dodge as percentages. Since you can't really nail down a to-hit chance as a percentage like that.

Consider the real world case of swinging a sword. First, swing it at a barn. I bet you hit it, didn't you? Now, swing it at a button lying on the ground. Did you hit it? Probably not.

So, creature size has an effect. So you can't really say, character X has a Y% chance of hitting, when you don't know how big the target being struck is. Then, again, dodge chance. I do see the paradox being talked about ("I have a 100% chance to hit! You can't evade me!" "But I have a 100% chance to dodge! You can't hit me!")

Accuracy in making a weapon strike isn't just about making the weapon swing where you want it to go. It's also about anticipating enemy movements. A skilled swordsman watches where his opponent is going, and can often score a strike even against a dodger, where a less-accurate swordsman would miss. So, your accuracy does need to be able to counteract enemy dodge, since your greater skill can undo some of the enemy's ability to dodge.

In old D&D systems, they expressed to-hit chance as THAC0, meaning To Hit Armor Class 0. That means, the chance was expressed as a certain chance vs. a certain armor class. The chance would go up and down based on the target's AC. That's the kind of system (not necessarily that exact system, though) I prefer: show the to-hit chance as a chance against some baseline value, and not as a global, "this is your chance to hit any object in the world!" type of value.

Percentage is ratio, in this case - what is dodge % ?

Per logic it must be comparison of dodging ability vs standardized attack. What qualities should standardized attack pack? I guess it is -Area affected, time frame of execution (it is more difficult to evade quick attack right?), situational quality (good attacker will force you to struggle with your own momentum) and list could go on. That percentage can also pack state of defender ala fatigue.

Problem is that nowhere is presented what is that standardized attack. 25% can insane dodge when compared to final boss on steroids attack. Same thing for accuracy, so what is it compared to?

There are 3 common accuracy/dodge mechanics i often see in games, electronic, tabletop, or otherwise.

1. The simplest to understand from a laymans perspective:

Accuracy/Dodge %.


The percent chance to hit is equal to accuracy %. You roll a 'random' and then you either hit, or you miss.
Dodge is usually factored into this.The net/total accuracy is equal to a factor of base accuracy and target's dodge.
this can be either a sum: "90A - 10D = 80% chance" or a multiplication: "90A * 0.9(dodge coefficient is 10%) = 81% chance to hit."

In both instances there can be an issue of scaling. As in 0% chance to hit, ever. As in "my dodge chance is 100% so no matter how accurate you are you will never hit me". or "my accuracy is over 100% so no matter your dodge i will always hit you". Many games get around this by setting limits. But this limits player customizeation and specialization. IE. *i wanted a character really good at dodging, but the game limits my build". The limit can be a form of "maximum dodge % is 90%" or "there is always a minimum of 10% chance to hit, or 1% chance to dodge". In my experience, the latter is more enjoyable limit. Even assuming that you do not implement a limit, the limit is implicit, and will always be *anyone with more than X accuracy over you will always hit, and anyone with X dodge over you will always dodge*

An example of which is *critical hit/critical miss* rolls in a game, where even if you would normally have 0% chance to hit, if you score a critical hit, you are guaranteed to hit.

2. Simple to implement, but a little less user-friendly: DND style AC/to-hit.

Whether or not this system is easy for players to understand or not depends on the player.

How DnD handles armor, and accuracy, is You have a number that represents your ability to avoid being hit and taking damage: AC
This number is compared against the attacker's "to-hit" number, and a dice roll. Usually the attacker has a base to-hit, and then a random factor to it.

If your attacker has a base to-hit of 10, and you have an ac of 15, the attacker needs to roll a 5 or more in order to hit you. DnD uses a 20 sided die, and so increments in amounts of 5%. This means that if the attacker rolls between 1 and 5, they will *miss*, and if they roll between 5 and 20, they will *hit*. 1 being an automatic miss, 20 being grounds for a critical hit. In this system, it scales linearly. If your AC is equal or greater than 20 points higher than the attackers base-to-hit, they will miss 95% of the time. Any AC *above* this number is redundant. And on the contrary, any base to-hit above your target's AC, is redundant, as you will always hit anyways.

This system allows for reasonably fair linear scaling in a way that you do not become invincible, and higher stat characters have an advantage over lower ones, but they are still susceptable to being injured by higher-level enemies.

3. Infinitely Scaling Accuracy/Dodge.

In this system, your *chance to hit* is your "accuracy" divided by the target's dodge. (A/D) = H%

This system is intuitive, scaleable, and simple to implement. In this situation, if your accuracy is equal to or more than your target's dodge, you have a 100% chance to hit them. The higher your dodge is, the less likely you are to become hit, but unless the enemies accuracy is zero, there will *always* be a chance for them to hit, however small. If you have 40 dodge, and the attacker has 10 accuracy, they have a 25% chance to hit. If you have 100000 dodge, and they have a meager 1 accuracy, they still have a 1 in 100 thousand chance to hit you.

The problem with this design is that if an enemy has a high enough accuracy, they will *always* be able to hit you, and your dodge ability will be worthless. To remedy this a good method is to use a hybrid system with one or more of the above, or a critical hit/fail for dodging and hitting. My personal favourite is:

A/D = H% WITH A MIN and MAX OF: "0% + 1/(D-A)" and "100% - 1/(A-D)" (i think?)

so that even if you have 10000 dodge, and your enemy has 10000 accuracy, your investment into dodge is not wasted, and increasing your dodge / accuracy never becomes redundant, there are just diminishing returns.

The formulas i've provided are probably inefficient or nonsimplified etc. I know that, im just too lazy and my brain is too tired to fix it.

~Nullie

This topic is closed to new replies.

Advertisement