# Manipulating the outcome of the variance

#### TheoAllen

##### Self-proclaimed jack of all trades
I'm currently on the point where agility and luck are not used in the design I'm working on.
Generally, I dislike agility being the one that determines the turn order. And luck that is affecting the state success rate.
So I removed both.

However, I did think about how about using them to affect the skill variance. Change the luck into something like dexterity.
The concept is, the higher is the attacker's dexterity, the higher chance you hit the upper cap of the skill variance.
And the higher is defender's agility, the higher chance that they will get the lower cap of the skill variance.
Both are nullifying each other, just like ATK and DEF. However, I can't seem to come up with a smart idea of the formula.

For a sake of argument. Let's say:
> A skill deals damage around 80 ~ 120 (Base damage 100, variance 20)
> Both attacker's DEX and defender's AGI is 50

There're two approaches:
> Option 1: Make the chance of dealing damage from 80 ~ 120 equally the same
> Option 2: It will most likely hit 100 damage, and less chance to hit the lower/upper cap.
> Option 3: See the implementation idea I wrote below.

Then another case if the attacker's DEX and defender's AGI is not the same
Let's assume the attacker's DEX is 75 and the defender's AGI is 25

Personally, I'm not even sure how option 1 will play out in this case.
Option 2 will likely play out as it will have a higher chance to deal 110 damage.
(The keyword here is "chance")

--------------------
On top of that, I'm not even sure how the workflow looks like to implement option 1 and 2.
The simplest thing I can think at the moment is to sum both of the stats then use a roulette selection.

Basically, if both stats sum are 100 (DEX: 75, and AGI: 25), means
> There is a 75% chance it will roll the damage on the upper half of the variance (100 ~ 120), and
> There is a 25% chance it will roll the damage on the lower half of the variance (80 ~ 100)

If it isn't good enough, I might continue the second roulette roll. If we assume we rolled in the upper half of the variance, then:
> There is a 75% chance it will roll the damage on the upper half of the variance (110 ~ 120), and
> There is a 25% chance it will roll the damage on the lower half of the variance (100 ~ 110)

Any of you have a better idea of how these two stats interact with each other?

Disclaimer: This is not project-specific feedback.

#### MushroomCake28

##### KAMO Studio
Interesting idea. To shift the variance curve, I would use a gaussian function to determine the distribution of variance and use agi and luk as parameters to manipulate the gaussian curve.

https://en.wikipedia.org/wiki/Gaussian_function#/media/File:Normal_Distribution_PDF.svg

#### TheoAllen

##### Self-proclaimed jack of all trades
Interesting idea. To shift the variance curve, I would use a gaussian function to determine the distribution of variance and use agi and luk as parameters to manipulate the gaussian curve.

https://en.wikipedia.org/wiki/Gaussian_function#/media/File:Normal_Distribution_PDF.svg
Lol this is exactly what I'm looking for, but I didn't know the name. Whether if this design feels good or not is subject to find out.

Edit: Gaussian function is more complex than I thought. This needs time to decipher the entire function (and I'm not sure if it's worth it). So I tried to run my original formula and test it a lot of times. And I saw these numbers.

Apparently using 75% chance to roll on the upper variance means roughly 55% chance to roll on last quarter (the highest possible damage)

Last edited:

#### Rinobi

##### Veteran
I actually had a very similar idea a few months back, but decided it didn't have enough impact to justify its implementation. Its probably fine as a secondary effect, but those stats would need to do a little more to be useful/appealing to players.

That aside, this may be a little easier to work with:
[[(a.luk / b.agi.to_f) * (0.8+rand(0.4)), 0.8].max, 1.2].min * (damage)

#### TheoAllen

##### Self-proclaimed jack of all trades
@Rinobi the plan is to make AGI and DEX (luk) is somewhat controllable. i.e, they don't increase along the level up. They stayed the same from level 1 to 99. You have to find a way to increase it let it be from stat distribution, equipment, or another way. Frankly, this kind of design may not applicable in linear JRPG type of game, but may be applicable in a game that has customization.

Also regarding your formula, I'm not sure if I get that right. I tried some values in AGI and LUK and it seems either always yield 0.8 or 1.2 when the division of luk and agi is too low/high. Or do you really want it to be that way?

Edit:
I come up with another formula, it's basically
Code:
``````base = rand # <-- Base rate
mod = ((dex - agi)/(dex+agi)) * 2.0 * rand # <-- Additional rate
final_rate = base + mod``````
If the dex and agi is equal, it's nullifying each other. But if the other one is higher, there's a chance to hit the upper/lower cap of the damage.

Edit2:
This one looks like a Gaussian function.

Last edited:

#### Roguedeus

##### It's never too late to procrastinate...
In my experience mechanics that manage to limit or eliminate damage variance tend to be more engaging.

It may ultimately boil down to how much agency the mechanic forces on the player for their lack of perfect knowledge.

#### Wavelength

##### MSD Strong
I have an idea about how to work the numbers and formulas, which I'll explain in a moment, but first off I feel the need to mention that I dislike the idea in general. Applying stats (DEX, AGI) as a bias to variance in damage dealt by a formula comprised of other stats (ATK, DEF) means that they are directly influencing the same result (damage dealt), which means you have added complexity without adding a lot of depth. While there are probably fringe cases where the "multiplier" effect of DEX/AGI on top of the other stats could be desirable, I generally consider this to be bad design (for the same reason that I consider random critical hits that only influence damage dealt to generally be bad design). Among the drawbacks of implementing such a system in your design:
• The stats can be mathematically compared to their counterparts ATK and DEF to determine which one is "mathematically" correct to build at a given time - incomparables (such as ATK, MP, and a SPD stat that affects turn order) create much more interesting decisions than stats you can directly compare
• The stats are difficult to explain - good luck trying to explain the mechanics of variance to a player, and if you want to simplify it to something like "Higher DEX gives you a higher chance to deal more damage", the player will likely not understand the difference between DEX and ATK ("Higher ATK means you will deal more damage")
• Extreme differences in these stats can only change damage by amounts up to the (percentage) level of Variance allowed, whereas their counterparts ATK and DEF can change damage dealt with no limit
• These stats would affect both Physical and Magic damage dealt, whereas there are two sets of damage-formula stats (ATK/DEF and MAG/MDF) which each affect only one type of damage dealt; this will make it very hard for you to figure out the correct "value" of a point of DEX between characters that primarily use only one type of attack, versus characters that use both types frequently
• As a character's stats grow, you have two numbers with multiplicative effect on each other both growing (for example DEF and AGI); this is hard to balance and will likely create gigantic swings in battle balance/outcome based on a couple levels' worth of growth - in other words, you're making your game harder to balance well
• Some of your techniques frequently hit the "maximum" or "minimum" variance values, which will look weird when (for example) 40% of a high-DEX character's attacks are dealing EXACTLY 120 damage, and the rest are dealing randomish values between 100 and 119.
So if you still want to use stats to bias the Variance calculation (which I would strongly advise against in most designs), the way I'd recommend doing it is similar to how RPG Maker currently does it. From a non-technical perspective, I believe that RPG Maker starts with a multiplier of 1.00, draws a random number from negative one-fourth to positive one-fourth of the Variance (e.g. a number from -0.05 to +0.05 if the Variance is 20) to add to the multiplier, does that four times (e.g. if it picked 0.03, 0.05, -0.03, and 0.01, then the total is 1.06), and then multiplies the damage from the formula by the total result (e.g. if the formula has you doing 100 damage, variance on this attempt changed it to 106 damage).

To adapt that to a system which uses a DEX vs AGI comparison to bias these calculations, I would do either one of these two things:
• Change the endpoints of the random draws based on DEX and AGI. If the attacker's DEX is zero, the stat pull would be from zero to positive one-half of the Variance (four times). If the defender's AGI is zero, the stat pull would be from negative one-half of the Variance to zero (four times). If DEX and AGI are equal, it's the exact same pull as current RPG Maker behavior. If DEX is two times AGI, the DEX "endpoint" is two times the AGI "endpoint", meaning the pull would be from negative one-third of the Variance to positive two-thirds of the Variance (-0.033 to +0.066).
• Instead of the drawing on a negative-positive scale each time, have a number of "negative" variance draws (which, for example, draw between negative one-fourth of the Variance and zero) and a number of "positive" variance draws (which, for example, draw between zero and positive one-fourth of the Variance) - and have the number of each type of draw depend on the comparison between the stats. For example, if there are a total of 8 draws, and the defender's AGI is zero, all 8 draws should be positive variance draws. If the attacker's DEX is only one-third that of the defender's AGI (for example 20 DEX vs. 60 AGI), then two draws will be positive variance draws and six draws will be negative variance draws.
Both of these systems create a nice spread of numbers that centers around a mean, while still allowing for significant bias based on the stats being passed in.

#### TheoAllen

##### Self-proclaimed jack of all trades
A very interesting insight as always @Wavelength I always love your contribution. Let me try to respond to some of your points. However, I would have to admit that the design pretty much not applicable in the game I'm currently designing as it's already survived well without this system and was never designed to include this. But I still believe this concept may survive in another type of design. Let it be in RPG or non-RPG (maybe, tactical or some sort, or still RPG but with a very specific design).

The stats can be mathematically compared to their counterparts ATK and DEF to determine which one is "mathematically" correct to build at a given time - incomparables (such as ATK, MP, and a SPD stat that affects turn order) create much more interesting decisions than stats you can directly compare
As a disclaimer, I'd like to say AGI and DEX probably are not a really significant stat for you to pay attention. I will explain it in the next point. In a game where speed/turn order is completely irrelevant, it's hard to "represent" that a character is agile. For example, in FTB (Free Turn Battle) or similar. You could argue that adding more action would represent it, but it actually breaks the game, but it's a topic for another thread.

The stats are difficult to explain - good luck trying to explain the mechanics of variance to a player, and if you want to simplify it to something like "Higher DEX gives you a higher chance to deal more damage", the player will likely not understand the difference between DEX and ATK ("Higher ATK means you will deal more damage")
I partially agree with this, and I also might have trouble constructing the sentence to explain. However, if I already show the damage range of a skill that it goes like 80 ~ 120 in the skill UI, I believe half of the job is already done. I only need to explain that the dex helps you to reach the maximum range more often. Your sentence is indeed too vague/misleading without a context.

Extreme differences in these stats can only change damage by amounts up to the (percentage) level of Variance allowed, whereas their counterparts ATK and DEF can change damage dealt with no limit
For some skill that has a small window of variance, this is true. If a skill deals damage around 95 ~ 105, it's no use to pay attention to these stats.

However, for a skill that has large variance, buffing the DEX stat or reducing the enemy AGI becomes more crucial. Say, a skill that deals 10 ~ 190, you have a skill to completely immobilize the target so that they have zero AGI, so whatever the attacker's DEX, they will guarantee to hit at maximum range, and that is not counting element modifier and maybe more. In another hand, if the target has higher AGI, it might be better to attack it with a lower skill variance.

These stats would affect both Physical and Magic damage dealt, whereas there are two sets of damage-formula stats (ATK/DEF and MAG/MDF) which each affect only one type of damage dealt; this will make it very hard for you to figure out the correct "value" of a point of DEX between characters that primarily use only one type of attack, versus characters that use both types frequently
This is an interesting point that I never consider. Mainly because I have no physical/magical attack/defense stat split into a two different stat. I cram up together in a single stat. So this may only work if you have a single type of stats.

As a character's stats grow, you have two numbers with multiplicative effect on each other both growing (for example DEF and AGI); this is hard to balance and will likely create gigantic swings in battle balance/outcome based on a couple levels' worth of growth - in other words, you're making your game harder to balance well
I personally recommend the stat growth is to be something like this.

Aka, yes, it's FLAT. You control the character DEX/AGI manually through the game, so you don't need to balance out the numbers at a different level. As I said in the first point, these stats probably are not worth to pay attention when they are at the "standard number". i.e, you have 20 DEX and enemy has 20 AGI, both cancel out, and they variance played out like in vanilla.

However, maybe you have a state that boosts the DEX point by a lot, say 200 for several turns, then you may start to notice that the damage start to hit the higher number in the variance. And since these stats are not worth for your attention, applying the buff shouldn't feel like a waste of a turn either. Maybe while applying the buff, the skill is actually also do something else. Same goes to AGI buff.

The end goal of this concept is ultimately trying to control/minimize the variance. And have the player an access to do so when they want (like I said, applying buff/debuff)

Some of your techniques frequently hit the "maximum" or "minimum" variance values, which will look weird when (for example) 40% of a high-DEX character's attacks are dealing EXACTLY 120 damage, and the rest are dealing randomish values between 100 and 119.
Which is why I was still not satisfied with the formula. The latest formula I come up with seems fair in my eyes, and can only guarantee hit the maximum variance if the target AGI is zero (immobilized). Other formulas are not worth it, to be honest.

====================
So let's talk about the technical department.
Change the endpoints of the random draws based on DEX and AGI.
This is basically what my latest formula goes.
Code:
``````agi = 10
dex = 10
total = agi + dex
middle = dex / total.to_f
var = 0.5 - (0.5 - middle).abs
variance_rate = middle + rand*var - rand*var``````
If both stats have the same value, it cancels out and the rate goes like vanilla
Mid-point = 0.5 (exactly in the middle, 80 ~ 120, means it's 100)
Range window = 0.5 (So it means the end rate could be 0.0 to 1.0)
1.0 = maximum damage = 120
0.0 = minimum damage = 80

If the AGI is 25 and DEX is 75, so the mid-point is 0.75
The range window goes 0.25
So the variance window is getting smaller as well so that the rate will be 0.5 ~ 1.0

If the AGI is 10 and DEX is 90, so it creates a 1:9 ratio, the mid-point is 0.9
And the range window goes 0.1
So the variance window is getting smaller as well so that the rate will be 0.8 ~ 1.0

The more the mid-point shift towards the other side, the smaller the range window as well.

If the attacker's DEX is zero, the stat pull would be from zero to positive one-half of the Variance (four times). If the defender's AGI is zero, the stat pull would be from negative one-half of the Variance to zero (four times). If DEX and AGI are equal, it's the exact same pull as current RPG Maker behavior. If DEX is two times AGI, the DEX "endpoint" is two times the AGI "endpoint", meaning the pull would be from negative one-third of the Variance to positive two-thirds of the Variance (-0.033 to +0.066).
If I understand this correctly, theoretically, if the variance of a skill is 80 ~ 120, and both of the stats are equal, it means it behaves like default, but if the DEX is higher, then the variance is shifted like the maximum range is not 120, but (without putting the actual number of DEX and AGI), it can be 130?

Instead of the drawing on a negative-positive scale each time, have a number of "negative" variance draws (which, for example, draw between negative one-fourth of the Variance and zero) and a number of "positive" variance draws (which, for example, draw between zero and positive one-fourth of the Variance) - and have the number of each type of draw depend on the comparison between the stats. For example, if there are a total of 8 draws, and the defender's AGI is zero, all 8 draws should be positive variance draws. If the attacker's DEX is only one-third that of the defender's AGI (for example 20 DEX vs. 60 AGI), then two draws will be positive variance draws and six draws will be negative variance draws.
Frankly, I don't quite understand this example. Are you referring to my roulette selection formula?

===============
EDIT: To clarify further, raw stat may not the only one that is affecting the DEX, I'm thinking that some of the skill may have bonus DEX on its own. Can be additive or multiplicative, but I more into additive.

For example, your DEX is 20, skill has bonus DEX by 10, so the total skill DEX is 30.

Last edited:

#### Wavelength

##### MSD Strong
First of all let me say how much I admire your graciousness and openness to constructive criticism. I always get a little nervous when I post criticism that leans negative, and the kind words you had for me (in addition to the thoughtful responses) made me feel great.

One interesting way to look at the mechanic (I skirted around this in my last post, but failed to express it fully) is to look at the effects of choosing one stat over another - in this case, raising your ATK but keeping your DEX lower (than the opponent's AGI), versus raising your DEX but keeping your ATK at a smaller value. Just making up some numbers out of the blue:
• Raise ATK: You now do 120 damage instead of 100 as a base value, but your lower DEX will cause the variance to be -20% to -0%, meaning in practice you're doing 96 to 120 damage.
• Raise DEX: You still do 100 damage as a base value, but your higher DEX will cause the variance to be 0% to 20%, meaning in practice you're doing 100 to 120 damage.
One stat was marginally better in this example (and the player needed to understand the entire variance bias system and do the math to figure out which one), but essentially, the choice isn't that interesting because whether you're raising the damage on the "formula" side of the equation or the "variance" side of the equation, in the end you're doing the same thing (raising damage dealt with any given attack/skill).

As a disclaimer, I'd like to say AGI and DEX probably are not a really significant stat for you to pay attention.

I always like to look at stats as a way of saying: "How good is a character at doing certain things?" The clearer the relationship between the stat and those things, the better. And that's part of why I feel that all stats should be significant and worth paying attention to.
• If the stat isn't significant to pay attention to because it doesn't do anything worth the player's attention (like RPG Maker's default LUK as used in state application), the stat should be discarded.
• If the stat isn't significant to pay attention to because it often will be equal to other battlers' stats (I believe this is your case based on what you said later in your post), and only a few equips/states/etc. will change it, then I usually like to move the effects from stats into Passives. In this case, you could have passives like "Gives your abilities a higher chance for positive variance" (to replace something that gives you higher DEX) or "Gives incoming hostile abilities a higher chance for negative variance" (replace something that raises your AGI).
In a game where speed/turn order is completely irrelevant, it's hard to "represent" that a character is agile. For example, in FTB (Free Turn Battle) or similar. You could argue that adding more action would represent it, but it actually breaks the game, but it's a topic for another thread.

I'm a big fan of trying to sell the dream of Agility, too.

A couple of the older Final Fantasy games gave most attacks/skills multiple hits (for example a Sword Flurry type of attack might attack anywhere from 3 to 7 times), and the actual number of hits would be based on character stats. This is sort of like variance, and I think it's a good way to represent the concept in a slightly simpler, more satisfying way.

Ultimately, games that allow characters to move around a physical battlefield are going to be able to represent Agility in the most satisfying ways (but are so hard to get right in other ways), and among games that don't, the ATB system is probably the next-best thing for representing Agility.

For some skill that has a small window of variance, this is true. If a skill deals damage around 95 ~ 105, it's no use to pay attention to these stats. However, for a skill that has large variance, buffing the DEX stat or reducing the enemy AGI becomes more crucial. Say, a skill that deals 10 ~ 190, you have a skill to completely immobilize the target so that they have zero AGI, so whatever the attacker's DEX, they will guarantee to hit at maximum range, and that is not counting element modifier and maybe more.

I assume that 90% base variance (10-190), which means a wild 19x actual variance in outcome from worst to best (10 damage vs. 190 damage), is meant as an intentionally extreme example that you wouldn't ever actually put in your game... but even in this extreme example, I think my concern still stands. As long as a character's DEX is high enough not to hit the low end of the range, the most they'll ever get by increasing their DEX to dizzying heights is x1.90 damage, whereas by increasing their ATK to dizzying heights they might achieve x5.00 or x10.00 damage.

I'll admit there's a reasonable argument to be made that the question of whether to increase ATK (to slam low-AGI enemies) or whether to increase DEX (to not hit really low numbers against high-AGI enemies with high-variance skills) can be interesting, but it's a very opaque calculation (you don't know what enemy AGI will look like in advance when you're choosing which stat to build) and ultimately there are still other decisions which would probably be more interesting than "in which way do I deal more damage".

For some skill that has a small window of variance, this is true. If a skill deals damage around 95 ~ 105, it's no use to pay attention to these stats. ... In another hand, if the target has higher AGI, it might be better to attack it with a lower skill variance.

Interesting little story - in timeblazer, the game I'm working on now, I had the same types of thoughts as you're expressing - for years, in fact. For a long time, I thought it would be neat to include a lot of stats, and make sure that each type of stat was relevant for different types of skills, so that part of the strategy was picking the right skills to use based on the stats you were building for a character. One way I went about this was to give my warrior characters (and enemies) "physical damage" skills which solely used ATK vs. DEF in the damage formula, and "mixed damage" skills which used ATK & MAG vs. DEF & MDF. Warrior equipment that raised MAG raised it by a lot, since only a small number of skills used it.

What I ended up finding through a lot of playtesting was that although this created interesting build paths, it became too limiting within battle, and ended up working against my original design goal of interesting choices. If you built solely ATK, all of the mixed damage skills became weaker than similar physical damage skills. If you built a lot of MAG alongside your ATK, the mixed damage skills became so good that the physical damage skills weren't really worth using. It ended up limiting the number of "live" (good) options on any given turn of battle to the small subset of skills that could make good use of your stats. (Additionally, it was very hard to tell what type of damage enemies were inflicting, which meant less clarity for players as to why they were taking high or low amounts of damage.)

What I ended up doing was removing damage types entirely and reworking the entire stat system, combining ATK and MAG into a single stat (that both warriors and mages could use), as well as combining DEF and MDF into a single stat. For battlers where it really seemed like they should be doing better or worse against warriors or mages, I gave them Passive States (visible to the player) that reduce damage against either Physical or Elemental skills, which is a lot more intuitive than damage types. The rework took a while but the battle system plays out so much more clearly now. Since then, I've always advocated for reducing the number of stats in a game to the minimum number necessary for engaging and interesting choices to be available.

I see a strong parallel with what you have in mind with having high-variance damage skills and low-variance damage skills in a game where stats determine the bias for the variance calculation. You may be unintentionally limiting the player to the highest or lowest variance skills they know, rather than letting them choose from their entire repertoire of diverse skills.

I personally recommend the stat growth is to be something like this.
View attachment 110876
Aka, yes, it's FLAT. You control the character DEX/AGI manually through the game, so you don't need to balance out the numbers at a different level. As I said in the first point, these stats probably are not worth to pay attention when they are at the "standard number". i.e, you have 20 DEX and enemy has 20 AGI, both cancel out, and they variance played out like in vanilla.

However, maybe you have a state that boosts the DEX point by a lot, say 200 for several turns, then you may start to notice that the damage start to hit the higher number in the variance. And since these stats are not worth for your attention, applying the buff shouldn't feel like a waste of a turn either. Maybe while applying the buff, the skill is actually also do something else. Same goes to AGI buff.

The end goal of this concept is ultimately trying to control/minimize the variance. And have the player an access to do so when they want (like I said, applying buff/debuff)

While certainly a noble end-goal, a sincere question I have is: Do you think it's good design to force the player to maximize a stat in order to get consistent results (reliability), or do you think it would be better to start with minimal variance and allow the player to opt into it (e.g. with a weapon that deals lots of damage but sometimes misses)?

This is basically what my latest formula goes.
agi = 10
dex = 10
total = agi + dex
middle = dex / total.to_f
var = 0.5 - (0.5 - middle).abs
variance_rate = middle + rand*var - rand*var

I do like this formula probably the most out of everything we've discussed so far, though it does have a few quirks. (And I'm assuming you make a Sign check or an AGI(< or >)DEX comparison elsewhere, since in your code variance_rate will be the same with 10/90 vs. 90/10.

As mentioned above, it's worth considering that when AGI and DEX are the same (like they'll normally be), you'll end up encompassing the whole range of variance, meaning that if Variance is "worth considering", you'll probably end up with a very wide spread of damage in "normal" situations. This can make it very hard to balance - maybe the boss is tough but fair when you're dealing 100 damage per hit, but if you get unlucky a bunch and hit for 30 or 40 (or even 75) instead, you won't stand a chance against it.

There's also a sort of weird Diminishing Returns curve going on where, for example, if your DEX is one-ninth of the target's AGI, you'll deal an average of 0.1 of the total Variance damage (with a range between 0.0 and 0.2), if your DEX is one-fourth of the target's AGI, you'll deal an average of 0.2 (0.0-0.4), 0.3 requires a little less than half the target's AGI, and so on until you get to 0.5, after which it becomes a mirror (so four times the target's AGI gets you an average of 0.8 variance, and nine times the target's AGI gets you 0.9 variance). Intriguing, but not necessarily satisfying.

If I understand this correctly, theoretically, if the variance of a skill is 80 ~ 120, and both of the stats are equal, it means it behaves like default, but if the DEX is higher, then the variance is shifted like the maximum range is not 120, but (without putting the actual number of DEX and AGI), it can be 130?

Yes. In my first suggestion, the maximum amount of damage you could deal, if the target had 0 AGI, would be 140 (which is twice the listed Variance in the skill of 20). When AGI and DEX are equal, the listed Variance (20%) is the most it could shift either way, but as the ratios become extreme, it can nearly approach twice as much.

Frankly, I don't quite understand this example. Are you referring to my roulette selection formula?

No worries; it's always hard communicating technical concepts through words alone. To give an example with some numbers, let's assume we have a skill with a formula that will do 100 damage, and it has 20% Variance listed. We've decided to make all skills use 8 variance draws. Assume that the attacker has 50 DEX and the target has 50 AGI. Since they're equal, we will divide the 8 variance draws up equally - 4 positive, and 4 negative. I'll choose random results for the Variance draws:
* Draw 1: From 0.0 to +0.05: +0.04
* Draw 2: From 0.0 to +0.05: +0.02
* Draw 3: From 0.0 to +0.05: +0.05
* Draw 4: From 0.0 to +0.05: +0.01
* Draw 5: From -0.05 to 0.0: -0.03
* Draw 6: From -0.05 to 0.0: -0.04
* Draw 7: From -0.05 to 0.0: -0.03
* Draw 8: From -0.05 to 0.0: -0.01
***TOTAL: +0.01
Therefore, the 100 damage will be multiplied by 1.01 to get 101 damage. On a really unlucky attack, the first four draws might be close to 0.0 and the last four close to -0.05, which would get you damage in the 80s.

Now, if the attacker has 150 DEX and the target has 50 AGI, the attacker's DEX is three times as high, so three times as many variance draws should be positive as negative. In the case of 8 variance draws, that means 6 positive and 2 negative. Running the attack again with these numbers:
* Draw 1: From 0.0 to +0.05: +0.04
* Draw 2: From 0.0 to +0.05: +0.02
* Draw 3: From 0.0 to +0.05: +0.05
* Draw 4: From 0.0 to +0.05: +0.01
* Draw 5: From 0.0 to +0.05: +0.02
* Draw 6: From 0.0 to +0.05: +0.03
* Draw 7: From -0.05 to 0.0: -0.03
* Draw 8: From -0.05 to 0.0: -0.01
***TOTAL: +0.13
Now the 100 damage will be multiplied by 1.13 to get 113 damage. Having an imbalance of positive over negative variance draws made it much more likely (though not definite) that the output would come out in the positives.

My methods sometimes give either "good" or "bad" Variance modifiers until the ratios between DEX and AGI become truly extreme, which I view as an advantage of these methods over the ones you proposed. Your methods have advantages over mine, too, such as their ability to make an impact on battle strategy using less extreme differences between DEX and AGI. I think what we've each come up now with is pretty good as far as formulas go - it's just that in the same breath I'd entirely avoid using stats to bias Variance in the first place.

#### TheoAllen

##### Self-proclaimed jack of all trades
First of all let me say how much I admire your graciousness and openness to constructive criticism. I always get a little nervous when I post criticism that leans negative, and the kind words you had for me (in addition to the thoughtful responses) made me feel great.
Oh, of course, I always welcome a criticism that always opens my eyes to any potential issues I never thought of it. Because most of the time, I had an idea, then learned it the hard way that it wasn't good, like, by creating a prototype and it wasn't as pretty as I thought. No one told me

One interesting way to look at the mechanic (I skirted around this in my last post, but failed to express it fully) is to look at the effects of choosing one stat over another - in this case, raising your ATK but keeping your DEX lower (than the opponent's AGI), versus raising your DEX but keeping your ATK at a smaller value. Just making up some numbers out of the blue:
• Raise ATK: You now do 120 damage instead of 100 as a base value, but your lower DEX will cause the variance to be -20% to -0%, meaning in practice you're doing 96 to 120 damage.
• Raise DEX: You still do 100 damage as a base value, but your higher DEX will cause the variance to be 0% to 20%, meaning in practice you're doing 100 to 120 damage.
One stat was marginally better in this example (and the player needed to understand the entire variance bias system and do the math to figure out which one), but essentially, the choice isn't that interesting because whether you're raising the damage on the "formula" side of the equation or the "variance" side of the equation, in the end you're doing the same thing (raising damage dealt with any given attack/skill).
It's an interesting observation. Frankly, I rarely do an actual calculation to see the interaction between the stat. As I said, I just slap it into the game and feels how it played out lol.

However, I have to mention that my vision of this system is "You don't raise AGI/DEX", at least, not permanently. The one that goes up permanently is indeed ATK. Your wording seems to assume that DEX/AGI is raised permanently so you think which one is worth investing. Imagine of SP param in features/traits system. They're a constant and defaulted at 100%. Same goes to AGI/DEX. When you do taunt, you raise TGR, so you hope that the actor is getting attacked more often. In DEX buff, you hope that the actor will do damage at the higher variance more often. Although, whether the number is an actual integer like 10,20,30,100, or in rates/percentage like 100%, 150%, is still subject to change, but anyway ... I assume you get my point.

I always like to look at stats as a way of saying: "How good is a character at doing certain things?" The clearer the relationship between the stat and those things, the better. And that's part of why I feel that all stats should be significant and worth paying attention to.
• If the stat isn't significant to pay attention to because it doesn't do anything worth the player's attention (like RPG Maker's default LUK as used in state application), the stat should be discarded.
Of course, I agree with this point of view which also the reason I discarded everything like magic attack and magic defense (as well as LUK) because I don't see the point of it if I can just use a single attack/defense stat.

If the stat isn't significant to pay attention to because it often will be equal to other battlers' stats (I believe this is your case based on what you said later in your post), and only a few equips/states/etc. will change it, then I usually like to move the effects from stats into Passives. In this case, you could have passives like "Gives your abilities a higher chance for positive variance" (to replace something that gives you higher DEX) or "Gives incoming hostile abilities a higher chance for negative variance" (replace something that raises your AGI).
Oh yes, this is what I was actually trying to say, so you did get my point. The entire stat choice is more suitable for passives, equipment bonus, and maybe a temporary states. Not to mention, if you're also including a separate passive or other means that raises the upper cap of the skill damage (skill upgrade, weapon upgrade, etc).

I've actually seen the game that using AGI and DEX in their system, and the game also including an armament upgrade that boosts the upper cap of the damage higher. So the upgrade is useless if you also don't raise your DEX. And if your DEX is high enough that it constantly hit damage cap, then you may want to upgrade your armament. As a disclaimer, I don't actually know how they did the formula, but the idea was based on that game. And it may fit well in that game design, but need to rework in other game design.

A couple of the older Final Fantasy games gave most attacks/skills multiple hits (for example a Sword Flurry type of attack might attack anywhere from 3 to 7 times), and the actual number of hits would be based on character stats. This is sort of like variance, and I think it's a good way to represent the concept in a slightly simpler, more satisfying way.
While gambling on how many hits based on agility is interesting, I find it a kinda harder to balance. It's like saying, does the agility only specifically affecting this skill? or is it affecting other skill? If not, so the agility is only used specifically in this skill? why even bother to have one then? In another note, it just easier to balance a fixed multi-hit skill. I'm not going to experiment with this idea though.

Ultimately, games that allow characters to move around a physical battlefield are going to be able to represent Agility in the most satisfying ways (but are so hard to get right in other ways), and among games that don't, the ATB system is probably the next-best thing for representing Agility.
I'd love to talk about my pet peeve in ATB, but this isn't just the right place to talk about it

I'll admit there's a reasonable argument to be made that the question of whether to increase ATK (to slam low-AGI enemies) or whether to increase DEX (to not hit really low numbers against high-AGI enemies with high-variance skills) can be interesting, but it's a very opaque calculation (you don't know what enemy AGI will look like in advance when you're choosing which stat to build) and ultimately there are still other decisions which would probably be more interesting than "in which way do I deal more damage".
You asked for it so here is the argument. Theoretically, what if you could actually see the enemy's AGI? Whether it's because the clever UI design to tell the enemy AGI, or the enemy visual (or some sort of it) that you could easily tell that the enemy has low/high AGI, will you able to decide which stat to build? What if the enemy that has a similar class has also similar AGI number? Now, will you able to decide?

What I ended up doing was removing damage types entirely and reworking the entire stat system, combining ATK and MAG into a single stat (that both warriors and mages could use), as well as combining DEF and MDF into a single stat. For battlers where it really seemed like they should be doing better or worse against warriors or mages, I gave them Passive States (visible to the player) that reduce damage against either Physical or Elemental skills, which is a lot more intuitive than damage types. The rework took a while but the battle system plays out so much more clearly now. Since then, I've always advocated for reducing the number of stats in a game to the minimum number necessary for engaging and interesting choices to be available.
Yep, your whole text at those paragraphs is basically explained why I also went into a single stat of atk/def, and I even once removed def entirely because it's basically just a pseudo-HP (why def when I can just up the amount of Max HP), until I come up with the armor mechanic I once shared

Although I do admit, I kind of do and don't get the relation of your point with my text you quoted. I can see I might not like my idea of using small variance to deal damage to high-AGI enemy. But I can't clearly see it. So, to be fair, it still a hypothesis of "what if".

(Additionally, it was very hard to tell what type of damage enemies were inflicting, which meant less clarity for players as to why they were taking high or low amounts of damage.)
This is very true and I think it's still true to even for a popular title.
Most of the games just don't tell the enemy property clear enough. Like, what kind of attack they have, what is the amount of the damage they deal? How much is the variance? Probably, this is the biggest obstacle that need to overcome. Properly informing the player, which is the reason I mentioned that it might suit better for non-RPG game or RPG with a really specific design.

You may be unintentionally limiting the player to the highest or lowest variance skills they know, rather than letting them choose from their entire repertoire of diverse skills.
This might be the reason, but I really can't be sure until I really see/feel it myself. One on top of my head is, generally, a lower variance skill is an AoE attack, it deals lower base damage than the single target. The good thing is, it's AoE, and don't rely on DEX. The bad thing is, well exactly what I said. From what I thought, players might still use the AoE for crowd control, not because it has minimum variance.

Do you think it's good design to force the player to maximize a stat in order to get consistent results (reliability), or do you think it would be better to start with minimal variance and allow the player to opt into it (e.g. with a weapon that deals lots of damage but sometimes misses)?
This is a good question, but I will tell you.
There was a game I used to play where managing buff/debuff is crucial. You start debuff the enemy at the start of the turn, pay attention to when it expires, prepare the next debuff, etc. Same goes with the buff. Once you make an oversight, like, you forgot to debuff ATK down, the enemy starts to deal crazy damage, and what you do is to pray for the next turn that you survived and can debuff the enemy.

I said buff/debuff since I already said at the beginning of my reply that AGI/DEX are constant. So I interpreted the word "maximize a stat" as buffing/debuffing DEX and AGI. And to answer your question, yes it can be a good design, or at least I used to enjoy such design. But whether if it's a good call to manage DEX buff and AGI debuff is another story to tell.

Also to respond to your "attack missed", I honestly don't like it. Misses and evasion sometimes frustrating. I buffed my actor with 50% evasion, but it's still getting attacked at a crucial moment, and evade an insignificant attack. And if the evasion buff is placed on the enemy, it's like my attack always missed.

I do like this formula probably the most out of everything we've discussed so far, though it does have a few quirks. (And I'm assuming you make a Sign check or an AGI(< or >)DEX comparison elsewhere, since in your code variance_rate will be the same with 10/90 vs. 90/10.
Well I think it's, intentional? Unless you mean something else. I mean, it worked as I expected already, or maybe you have a better idea?

If the AGI is zero, it deals the maximum amount of damage
If the DEX is zero, it deals the minimum amount of damage
Upon writing this, I just realized if both are zero, it may throw an error

If DEX is lower then it means the mid-point is getting shifted towards zero and the range window will also getting smaller.
You can try to execute my code here https://repl.it/languages/ruby if you're curious.

Yes. In my first suggestion, the maximum amount of damage you could deal, if the target had 0 AGI, would be 140 (which is twice the listed Variance in the skill of 20). When AGI and DEX are equal, the listed Variance (20%) is the most it could shift either way, but as the ratios become extreme, it can nearly approach twice as much.
While this is an interesting proposal and I may want to actually try it, it also kills the option to "increase the skill/attack upper damage limit". For example, there is a passive/equip that increase the final upper limit by 10%, so the skill that deals 80 ~ 120 with the base is 100, now deals 80 ~ 130.

=============
Now about your second formula approach, I think I get what you're trying to say. It is not bad, but I'm a little bit skeptical about it. I need to run the formula and throws the number to see how it played out before I can "approve" the idea But I will do that tomorrow. I can't believe I spend 2 and half hour just to write this reply lmao.

EDIT:
I almost forgot to respond this.
There's also a sort of weird Diminishing Returns curve going on where, for example, if your DEX is one-ninth of the target's AGI, you'll deal an average of 0.1 of the total Variance damage (with a range between 0.0 and 0.2), if your DEX is one-fourth of the target's AGI, you'll deal an average of 0.2 (0.0-0.4), 0.3 requires a little less than half the target's AGI, and so on until you get to 0.5, after which it becomes a mirror (so four times the target's AGI gets you an average of 0.8 variance, and nine times the target's AGI gets you 0.9 variance). Intriguing, but not necessarily satisfying.
Actually, I'm still working to solve the diminishing return. I'd be lying if I'm 100% satisfied with it. It isn't the best, but so far the formula I'm satisfied to work with. I plan to actually buff the actual DEX or AGI value when one of them wins. So maybe, if DEX is higher than AGI, I multiplied the DEX by 2 times, or so. Thus, winning the tug of war between AGI/DEX for variance might be even more crucial. But then again, it's still a random idea from someone that is going to sleep ....

Last edited:

### Latest Profile Posts

By the power of timezones! This picture shall still be posted on december 1st!!!

This is not something I'd ever even considered but wow! What a way to use music in a game.
I am a complete fool. I went through the trouble of making a clone sprite and setting up a system to have the characters flash, when it turns out - I never noticed that the "._mainSprite" was the actual bitmap being used. I'm happy since that makes compatibility easier, but I also want to scream.
Synchronizing bust and sprite expressions! Plus using a phone behaviour

Long gif tho, let it load first
Wondering how to force a Save State in VNMaker with a name and how to call it with a scene event in order to double check if this Save State exists or not. Phew... Leaving breadcrumbs for chapter DLCs to pickup would be more than half the fight in order to finish this visual novel