# Probabilities, RNGs and other statistics shenanigans.

Discussion in 'Game Mechanics Design' started by gstv87, Jan 13, 2019.

?

## How little is "too little"?

Poll closed Jan 27, 2019.

0 vote(s)
0.0%

0 vote(s)
0.0%

0 vote(s)
0.0%

0 vote(s)
0.0%

0 vote(s)
0.0%
6. ### 1 in 20

100.0%
Not open for further replies.
1. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
Planning on revising my combat system, I anticipate I'll have to fix the way skills and states land and fail.
There's a whole character stats table that isn't worth delving into ATM, but it all boils down to strength-vs-resistance.
How much is "too much" when it comes to landing or resisting a trait? How strong versus a given attack should a defense be in order for it to be fair?

Assuming a late game of abilities used by the dozen each turn, ... how little is "too little" of an effect from a simple attack against a visibly superior defense? How many high points should one single actor have, per turn, against an enemy or group of enemies? One highlight? One POTG? Game-carry MVP? Mary Sue character? Straight-up God?

2. ### MushroomCake28KAMO Studio

Messages:
1,442
2,644
Location:
First Language:
English
Primarily Uses:
RMMV
Honestly the correct answer is: it depends. Here's a list of stuff it depends on:
- The nature of your battle system.
- The skill itself.
- The skill target: AoE, or single target?
- The skill damage output, relative to other skills in the same tier bracket.
- The general purpose of the user.
- The effect of the state itself.

There are more, but you get my point. For example, it should be harder to inflict death than to inflict poison. Also, if it's a skill that already deals a fair amount of damage, having the same percentage than a skill that primary function is to inflict a state would be ridiculous.

Personally, in my game, inflicting states can only be done with abilities that are attached to skills. For example, one of my skill has an ability that gives it a chance to stun. When the skill ability is at level 0, it has 0% chance to stun, but when it's at level 10, it has 50% to stun (don't remember the exact numbers, but it should be around that).

lianderson likes this.
3. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
obviously.
duh.

but, in the case of handling a poison situation.... how likely would it be for "the toughest resistance against poison" to still fail against a poison attack?
same for stun, or bleed, or other derangements, for instance, how hard would it be for two heavyweight champions to KO one another?
one would think it would be 1 in 12, as per regulation.... but there are cases of tie-breaks by points, and KO's in the first minute.

assume AOE as multiple instances of single-target.
the submitted power level is always the same, there's no random variation.

damage is handled by straight subtraction, so, it's out of consideration.... there's no "chance" there.
the chance resides in *landing* that attack, which depends on each character's level or weapons, and there is no "resistance" to that.
as it is, there is a "resistance" to ailment attacks, which I'm aiming to transfer to each character's own status, so that the resistance system is relevant: characters with low native resistance may or may not require a buff, with the buff palette being limited.

4. ### MushroomCake28KAMO Studio

Messages:
1,442
2,644
Location:
First Language:
English
Primarily Uses:
RMMV
My point was that all those stuff influence the "balance" chance to inflict a state. It might 50% in some case, and 20% in another case. There's no way to give a single number and say "this is the correct percentage".

5. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
no, not "correct", but "fair"
throwing all in, what would be the chance of an otherwise 1/1 to still be significant to the gameplay?

I don't want to completely negate scenarios with added resistances, except when throwing in an actual "full invulnerability" state.

6. ### MushroomCake28KAMO Studio

Messages:
1,442
2,644
Location:
First Language:
English
Primarily Uses:
RMMV
Picture two skills:

- One that does 0 damage and has x% chance to inflict poison.
- One that does x2 a normal attack damage on all enemy, and has y% chance to poison.

Considering that the skill 1 and 2 are in the same tier, it would be unfair that X = Y. So there's no way to say "50% would be fair". What you have to say is "50% is fair in this particular scenario". You can't generalize a single number and say it's fair.

7. ### TheoAllenSelf-proclaimed jack of all trades

Messages:
4,053
4,478
Location:
Riftverse
First Language:
Indonesian
Primarily Uses:
RMVXA
"Fair" is when your player may think "Oh well, it didn't land, but it doesn't matter anyway" *shrugged, and moved on*
"Unfair" is when "If I managed to make this land, I may win the battle" or "I won't get much loss if that particular trait lands"

I don't want to throw numbers because it needs more context more than just that.

8. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
"fair" would be when you're allowed a certain maximum number of tries (MP cost) and it lands dealing an amount of damage comparable to using one certain-hit skill, compared to it's MP cost.
say, a DOT skill that deals 100 damage, (total, fixed, independent of defense), versus a skill that lands 100% of the time (but is defended against) at the cost of 100 MP, but costs half that.
would 50% chance balance it out? or should it be 30%?
if it would be 30% chance, the investment would potentially be 300MP against a skill that would potentially deal 100 damage against a set defense, or potentially 300 damage against less defense (which the player can only guess)
of course as the characters level up and the players discovers their mechanics, new skills will be added to be tested against new unknown enemies.
the one fixed factor is, similar enemies will have similar resistances, so a previous success will potentially result in success, in the same situation, even against a stronger enemy.
likewise, when receiving hits, a stronger attack will require a stronger resistance, but, how much should that resistance be so as to not be 100% invulnerable? (except when using defenses specifically designed for invulnerability)

in general, what odds (across the board) would appeal to the player to keep trying and not dismiss a tactic as "useless" or "dependable"?

common sense says that odds around 2 out of 3 are worth the shot, so that's what I'm taking as one of the extremes.
.....what would be the other? 1 in 4, 5, 10.... ?

Last edited: Jan 13, 2019
9. ### WavelengthPre-Merge Boot

Messages:
3,822
3,207
Location:
Florida, USA
First Language:
English
Primarily Uses:
RMVXA
Not necessarily. If the status inflicted at a 2-out-of-3 rate is worth just slightly more than the damage you'd inflict by using a "reliable" (100%) skill, and 1 out of 3 times that status-inflicting skill will do nothing, then it's not worth the shot. This is what I think the other responders in this thread were getting at - it's arbitrary to say "1 in 6" or "1 in 20" will be good/balanced, without a better sense of what the underlying mechanics are (like what statuses do), and the amount of control the player has over those mechanics (like resisting or playing around those statuses).

I suppose if we're talking a crippling status effect, and you insist on having the RNG play a factor, then I'd want the highest-level resistance effect to any given status to be at least 80% (meaning a 1-in-5 shot, or less, to not prevent the status). For Instant KO's, 100% resist is appropriate as a max. Honestly, I feel that 100% to inflict or 100% to resist would be good for all (or most) status effects - I heavily prefer deterministic effects over RNG-based ones in RPGs, but that's a personal preference rather than a hard-and-fast design rule.

kirbwarrior likes this.
10. ### kirbwarriorVeteran

Messages:
593
286
First Language:
English
Primarily Uses:
N/A
I think a big thing to remember about % chance of hitting is what it actually means; the chance of doing nothing. I'll give an example of the two games that taught me that <100% might as well mean "don't use";
In pokemon, you have one party member. If you use, say, Swift, you will do a certain amount of damage, no questions asked. It doesn't miss, and damage variance is small, so if it takes off over 1/4 of the enemy HP, you are guaranteed to kill them after four uses. Now let's look at Hyper Beam. It has a staggering power (even more so as many moves keep getting weaker), but comes at the cost of a turn. You are, in effect, dealing half as much damage every other turn except with the killing blow. If it does over half your opponent's HP in damage, you win on the third turn. Wait, it has a 10% chance of doing nothing. That's an entire turn that the opponent can very well do whatever it wants. Considering you were relying on Hyper Beam, the enemy might be incredibly strong and kill you now because your first turn missed. And that's entirely luck based; that situation has a 90% chance of winning and 10% chance of losing with no skill involved.
In FFT, it's the same principle, but you almost never get any attack with a 100% chance. So you have to rely on unreliable moves, or more accurately rely on the fact that any turn might be skipped, just because the game decides so. When you are staring down superior numbers or enemies, a single missed turn can mean a loss, and once again it's entirely luck-based.

Now, those are pretty extreme (Pokemon is considered easy and FFT has very few battles that require that good of luck), but in a harder game it suddenly becomes frustrating. However, let's look at DQ8's Jessica. She has a passive she can learn very early on that has a chance of stunning the enemy each turn, with a 1/16 chance. There's no reason to rely on it. But note, that you don't have a 15/16 chance of losing a turn, it's entirely extra. It's good to get early since it's makes a long run (a dungeon) that much more survivable. Because of the number of collective enemy turns in a dungeon*, in practice it basically means your party takes 1/16 less damage, or saves you a critical amount of MP for boss battles to heal with.

Basically, if the rng doesn't matter in the short term (aka costing a turn) then it doesn't really have to matter. An attack that has a 10% side effect of a state is basically an attack that sometimes makes things better. However, if it does matter in the short term, it can entirely undo a strategy, such as even a 95% accuracy costing you a turn, or a whole round if only one party member can attack while the others are using set-up, protective, or reactive (healing) skills.

For me, I just plainly prefer 100% chance and having to deal with other effects, such as cost, correct targeting, or learning enemy ai. But then I also tend to prefer more puzzle-like gameplay and losing because it was my fault.

Now, mind, I do also like the option of trying <100% moves. For instance, in one old rm2k game, I realized that the warrior skipped a step of learning skills (everyone learned skills at ever 5th level, but that class just didn't have a lv15 skill). Since the game was already basically done and ready to go, there was no harm in adding an option there. So the warrior got a move with 80% accuracy. Just to come out even, that would have to do 25% more damage (4/5 acc * 5/4 dam = 1). I pushed it up to 40%. It can make that part of the game easier, but it was more reliable to not use it. The move was entirely explained and the math was chosen to make key battles last at least a turn less, so it was the players choice to not take a 100% move to win faster.

Now, not absolutely everything needs to be 100%. But, the worst offenders in my mind are;
State resist. If it's not 100%, then I basically ignore it.
Accuracy, especially of Attack. That basically makes random encounters last extra turns for no reason.
Party-use skills. Thracia 776 has a meme of "Staves can miss". No, I don't want to rely on a healing skill that can miss. Vivify (50% chance of resurrection) is basically unusable in battle, and if I were to make it myself, I'd have it be a res skill that has 100% chance but can't be used in battle (it's effectively already that).
Loot drops. Losing an entire turn is already bad, but the entire battle? Oof, no this is the one thing stopping FF9 from being the best.

Places that are much less problematic;
Side effects of otherwise 100% effects; Criticals, additional states, etc. are perfectly fine because games are basically balanced around the fact it never happens and it's effectively a breath of fresh air.
Effects where the worst outcome is good enough; Say you have a weapon that has a chance of using a stronger skill instead of or in addition to Attack. You're relying on the damage from Attack but 5% chance of Meteor can just be hilariously fun.

If it doesn't cost a turn, then it's much less frustrating. Let's say I have an instant death spell; sure, most games keep this with low accuracy, but if it ends up being 30% death or 70% damage, then it at least does something. Or it could only have that 30% chance of success, but if it misses you can still use physical attacks (say, because you tried magic but it didn't work but you still have time to attack). And as said above, passives additions that aren't ever relied on.

This doesn't exactly answer your question but rule of thumb I see a lot is;
Random encounters are two turns
Bosses are eight turns
Mid bosses are usually trying to do a specific gimmick or explain a feature without it feeling like a tutorial, so there's no general rule.

Now, assuming those two heavyweights are similar in stats, then it depends on things like difficulty and feel, but it also depends on what kind of fight it is. If it's a midboss gimmick fight where one party member fights a rival, then four turns is enough to make it dangerous and not get to the point of boring. That would mean it would roughly be three hits (assuming either side is willing to use skills to manipulate the battle and not just slug it out, hoping your fast enough to win first).

*Let's take a mid-game dungeon. That's roughly 50 random encounters. There's an average of 3 enemies per battle. Random encounters in it (and most rpgs) last two turns, but unless the enemy is fast the second turn largely lacks damage. So, 50 * 3 = 150 potential attacks. Jessica's passive protects you from 9-10 of them. And that's all assuming this is merely damage you're worried about, those could also carry states, enemy summons that make the battle longer, or in the reverse let Metal Slimes run and deny you exp.

mauvebutterfly and Eschaton like this.
11. ### Black PaganVeteran

Messages:
59
17
Location:
India
First Language:
English
Primarily Uses:
RMMV
Well, I believe it all comes down to how often is more fun for the player to perform the affliction effect. When it comes to games, Fun > LogicOnce you have this figured out, Resists on Enemies is way easier.

These are the "% Chance to Afflict" values I used in one of my games :

100% -> Guaranteed, Ex : Stun Shot, A Ranger Skill that Always Stuns, Average damage
85% -> Very Reliable, Ex : Lion's Roar, A Warrior Skill that Breaks Armor of All Enemies. Obviously, Some Enemies are often left out, No Damage.
65% -> Reliable, Ex : Shadow Slash, An Assassin Skill that can Reduce MaxHP by 15%, Permanently for 3 Random Enemies, High Damage
45% -> Not Reliable, Ex : Stunning Slash, A Warrior Skill with Chance to Stun and can Penetrate Armor, Average Damage
33% -> Noticeable, Ex : Miasma, A Necromancer Skill that summons a Dark Fog, Confusing a Few Enemies and make them attack their Allies, Damage over Time.
25% -> Somewhat Noticeable, Ex : Fireball, A Mage Skill that has Low Chance to afflict 30% Reduced Damage on 1 Enemy, Permanently. High Damage.
15% - > Rare, Ex : Toxic Fang, An Assassin Passive ability that afflicts a 7% MaxHP Poison on Hit on an Enemy, Till they die. Normal Damage.
3% -> Super Rare, Ex : Execute, An Assassin Strike that has 400% Damage and Low Chance to Kill the Target Instantly Very High Damage.

From my experience, Afflictions that have 15% or Below Chance don't even trigger every Battle. So it fits Passives and Death States in most Conditions. (Of course, This is just my opinion. I am aware that every Game is built differently).

As far as Resists are concerned, I know it tends to get a lot more complicated. So I just keep it simple :
- I make bosses immune to 2 Afflictions which aren't repeated
- If my game has 20 Monsters, I pick Half of them, i.e 10 Monsters and make them each immune to 1 Affliction and the other 10 Monsters being stupidly easy to kill.
- I try not to repeat the same Affliction resistances on many enemies
- I make the Bosses immune to that Particular Affliction if I feel the Player really has an Unfair advantage against that Boss. Ex : You could just let the Mage burn down a Boss if the Damage over time is something below 7%, No point in making that Boss immune to it.

Last edited: Jan 14, 2019
12. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
oh, for high-level characters that very much is the case.
if you use a level 1 Poison, as a level 20 character, in a level 1 enemy, it'll very much land.
what I'm going for is, what should be the cap for when a level 20 enemy uses a level 20 skill on a level 20 character, with that character buffed up with all possible level 20 resists? I don't want *that* mechanic to be 100% effective, otherwise the players would strive to always use *it* instead of anything else.

if a general odd of 66%, or 50%, or 45% seems fair, then I can build the entire system around that, with each individual calculation aiming for that.
then, the player's own strategy would multiply that up or down, depending on how they stack buffs and resists.

my idea was to come up with a collection of stats (which I already have, but needs tweaking) or a basic formula to deal with most of the work of balancing the enemies.
then, if I decide at test time that an enemy might be too weak, I can simply increase their HP, which has a much simpler control than going to the code and changing a formula that might throw off the entire balance for the rest of the game.

I don't have such extremes as insta-something, except on skills conditioned to only certain classes.
like, there's a critical hit of Elders against Demons, but only below certain HP, which the players can't see; or a pain-based attack for Necromancers that hits harder inversely to the caster's HP, but the player's can't possibly calculate the final damage based on the knowledge of the caster's HP alone (which they *can* see)

Last edited: Jan 14, 2019
13. ### Aoi NinamiVeteran

Messages:
394
470
First Language:
English
Primarily Uses:
RMVXA
I believe you're coming at this from the wrong angle. Firstly, there are no "shoulds" here, it's down to personal preference and the needs of the individual game.

However, my own preference is that chance of success should not depend on the actor and enemy's relative levels, but rather on skills and resistances, so you might get an "attack with 25% chance of status" early in the game, and "100% chance of status" later, but some enemies would be able to resist or counteract negative statuses.

Suppose your Level 20 player is up against a difficult, level-appropriate boss. You've said you don't want the player to have 100% chance of landing poison, because they'd always use that instead of anything else. But... if poison is effective against the boss and you give the player a 33% chance of landing it, they'll keep trying until it lands, and the outcome is the same, the battle is just prolonged a couple of turns.

Negative statuses tend to be heavily debilitating (otherwise they wouldn't affect gameplay when landed on the player), but this means that landing them on bosses (if allowed) is nearly always going to be a dominant strategy. That's why so many games go down the route of bosses being straight-up immune to negative statuses (which ends up meaning that status-inflicting spells are never worthwhile).

There's a few ways round this problem. One is to give types of enemy status immunity; e.g. in my game, golems are immune to Stun. So when you face a golem boss, the player expects it to share the same immunity, and it doesn't feel cheap. Mechanical enemies could be immune to Poison, bats could be immune to Darkness, and so on. Another is to give (some) bosses the ability to remove negative statuses.

kirbwarrior likes this.
14. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
not when the sustainability of each character is limited, and the available skills for each character have reuse delays.
you can't just spam skills.
the point would be, in the case of an advantage, what that landing chance should be so as to appear "worth the shot" in case the first attempt fails?
there will be no display of chances anywhere for the player to read, but the players might pick up on common tropes such as "water trumps fire" and build a strategy around that.

done and done.
all enemies are classified.
still, those resistances are open to modification.

Last edited: Jan 14, 2019
15. ### EschatonHack Fraud

Messages:
2,014
504
Location:
Kansas City, Missouri
First Language:
English
Primarily Uses:
N/A
I like what @kirbwarrior said about "chance to succeed" really amounting to "chance of wasting a turn." That kind of negative feedback loop creates the mentality that status-affecting skills aren't worth using.

State-affecting skills need to work. Period. The player casts it, it works. The only reason why they shouldn't work is if the enemy is immune to it. And immunity should not be abused by the developer. Sure, an enemy here and there to throw the player a curve ball...

And as far as I'm concerned, contractual boss immunity is overrated.

Probability can make the player feel helpless. At least make it clear to the player that they can swing probabilities in their favor through build choices.

Players hate missing. Players hate failing. Especially when it wasn't their fault. Keep RNG to a minimum.

16. ### bgillispGlobal Moderators

Messages:
11,324
11,255
Location:
USA
First Language:
English
Primarily Uses:
RMVXA
One thing to keep in mind is studies have shown that humans cannot perceive randomness correctly anyways. So any number you pick unless it is 100% or 0% is going to occasionally seem unfair and/or skewed. Apple had problems with this on their first IPOD as people called in to complain that the shuffle algorithm was not random as it repeated the same song sometimes. Well, except, under definition of random it SHOULD be able to repeat the song, as any truly random choice included the choice of select same action again.

Apple eventually gave up and programmed the shuffle algorithm to no longer be random as they got tired of trying to explain to people how random numbers worked.

So any number you pick that isn't it works all the time, be prepared to have to defend it no matter what. But in my experience, it varies based on the following.

-The % you choose
-How you handle the LUK modifier
-How often the party can use the skills. Skills that are once per battle or with high cooldowns should probably inflict the ailment more often than those that can be used every turn, else the player will see the skill as useless most likely. And it doesn't matter what % you pick, if it is below 100%, if they use it and it misses 3x in a row due to bad RNG they will probably give up on the skill for the rest of the game.
-How often the enemy can use the skills.
-The attack pattern you give the enemies.

All of those are variables which will change the answer.

17. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
fairness dictates it should start at 50%, but that's the point being debated.

non existent.

depends on the character, but several characters have similar masteries, and similar skills.
overall, all skills can be used several times per battle, most of them only once per turn.

once per turn, very rarely several times per battle, as per AI.

varied across enemies: zombies and animals are very basic and predictable, humanoids or demons are bordering unfair.

18. ### bgillispGlobal Moderators

Messages:
11,324
11,255
Location:
USA
First Language:
English
Primarily Uses:
RMVXA
The problem is then this: If you use 50% the RNG can go miss miss miss miss miss miss miss. Or it can go hit, hit, hit, hit, hit, hit. All of those are low probability but it will happen on average 1 in 64 times. If a player gets that 1 in 64 chance of all misses they will think your status ailments are broken and never use them again.

But that is true of any % that isn't 0 or 100.

As for LUK, did you go into the code and remove the LUK modifier completely? If you didn't its still there even if you renamed the stat.

Personally I think it depends on what the status ailment does too. Skills like stun which cause you to miss a turn are more devastating than skills like Silence that let you still act but you can't cast, and both are more devastating than poison which lets you act but you are losing HP. So it needs to be balanced around that too.

Eschaton likes this.
19. ### gstv87Veteran

Messages:
1,629
662
First Language:
Spanish
Primarily Uses:
RMVXA
yes, I went to the actual formula and changed the check for LUK.... it was one of the first things I changed, back in 2015.

I have 4 ailment states: Poison, Bleed, Sink and Decay.... Decay can't be cured, it must be controlled. Sink drains MP, and can't be cured, but can be offset by Regeneration or MP potions. Bleed drains HP, can be cured, but can also be managed by a character's own HP regeneration (high CON characters may not even worry about it). Poison stops HP regeneration and drains HP, so it must be cured or healed.
Decay is very rare, only humanoid wizards and some zombies have it, but it has no fixed chance yet (TBD). Sink is also rare, but since the MP pool of most characters is small, it's devastating if used against the correct target. Poison and Bleed are fairly common, but also not that dangerous.
Poison and Bleed have several intensities, Decay only has one.
other states like Stun, Blindness, Binding, Weakness, Paralysis, etc only have one setting as well.... either they land, or they don't, but that's what I want to tie to the character stats system, so that the player may guesstimate a character's chance of facing an enemy before applying buffs to the equation.

20. ### bgillispGlobal Moderators

Messages:
11,324
11,255
Location:
USA
First Language:
English
Primarily Uses:
RMVXA
Well if it helps, I'll tell you how I did the three status ailments that I have that are the same as yours:

Stun: 100% chance to land, one target, no resistance unless you are immune. However only 2 skills can land it and they can only be used once a battle. It's meant for stalling a boss while you recover, or canceling out a powerful spell that might wipe out the party. Enemies can use it to make one of your party members miss a turn too, though like you it is a one time deal for them. Also it has 2000 action speed so it is going to go first in battle.

Blind: Possible with all Fire spells. I have three tiers, Hurt Eyes which lowers To hit by 20%, Blind which lowers it by 66%, and Darkness which lowers it by 95% (basically forget hitting when this in place). Most Fire spells have a 25% chance to inflict Hurt Eyes, though they do have a spell called Blinding Flash which is 50% chance to blind all enemies, can use every turn (no cooldown). I've left it at that since my game most things revolve around magic few enemies are exclusively physical attackers by the time you get that spell, and the few that are, this is your spell to handle them with.

Edit: My Fire spells are also the damage dealing spells, so mainly the player uses them for the damage, not the status ailment. The ailment is a bonus if it lands here so I feel a lower % is fine in this case.

Paralysis: I actually did this one differently in that the player is first infected with a poison that lasts 3 turns. If they cure the poison no harm. But if they forget or can't cure it, at the end of turn 3 they are paralyzed. Paralysis wears off with damage though, but your DEF is lowered by 99% so it might be a really devastating hit. And while the poison is present your ATK and MAT are lowered by 50%. Kinda hard to swing a sword if your muscles are threatening to freeze up on you.

Rest I don't use the same as you so no suggestions. But this is what has worked for me at least.

Last edited: Jan 14, 2019
Black Pagan likes this.