RNG compensation

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderators: Forum Moderators, Developers

Forum rules
Before posting a new idea, you must read the following:
Post Reply
User avatar
Posts: 631
Joined: July 18th, 2011, 1:42 pm
Location: Here and there and everywhere

RNG compensation

Post by lipk » July 27th, 2015, 10:48 pm

Here's my turn on this ever-actual subject.

However good player you are, if it's not your day, you might be beaten by a weaker opponent due to sheer luck alone. We all know that. I haven't researched existing solutions, but as far as I know people wanting to fix this usually try to design some alternative combat system mitigating or eliminating the role of dice-rolling. That approach, in my opinion, turns classic Wesnoth gameplay on its head and requires massive rebalancing of unit stats. I'm trying to devise a method that lowers the chances of losing to bad luck while having minimal impact on gameplay.

My idea is to dynamically modify hit chances in order to 'enforce' better statistical characteristics on the RNG. What 'better' means is absolutely up for discussion, personally I think the standard deviance of expected - dealt damage is the key factor. I came up with the following formula (inf = inflicted (damage so far in the game), tak = taken, exp = expected):

chance_to_hit = base_chance + min(20, max(-20, ((inf - tak) - (exp_inf - exp_tak))/1.5))

Capping the compensation at +-20 ensures that the player can't get sure hits/misses under common circumstances. The 1.5 constant is up for fine-tuning.

I ran 100 AI vs AI games with both the compensation algorithm enabled and disabled. Results:
This plot shows the mean of abs(percent(inf, exp_inf) - percent(tak, exp_tak)), percent(x, y) = (x-y)/(y+1)*100 across the 100 games in function of the turn number. This essentially measures 'how lucky or unlucky the player has been so far'. It eventually converges to 0, but it's not indifferent how fast. A typical Wesnoth game ends in a finite number of turns and it's weak of a condolence that you'd have been lucky in turn 20 if your leader gets killed in turn 19. What we can see is that with compensation (blue line), the value converges considerably faster (actually its initial higher value is very likely due to a bug in my implementation).

Standard deviation of exp-tak - (exp_inf-exp_tak) within one turn: with compensation: 9.68, without compensation: 11.66. Slightly lower with compensation, meaning that it's a bit less likely to get very lucky/unlucky in a given turn.

Average number of turns until game end: with compensation: 21.82, without compensation: 18.45. While not strictly an RNG characteristic, I think this could indicate that the game becomes more balanced with RNG compensation, thus it lasts longer between players of quite literally the same skill level.

So, that's it. How do you think the 'fairness' of the RNG should be measured? Any ideas for better compensation formulas?

User avatar
Posts: 472
Joined: April 9th, 2010, 4:58 am

Re: RNG compensation

Post by UnwiseOwl » July 28th, 2015, 12:00 am

I think something like this would be great to implement as an option for those that dislike the effect of the rng, it seems to strike a fine balance that wouldn't destroy the difficulty level of the campaigns. I'm not one of them, but there are so many people that ask for a feature like this that providing it or something similar as a tickbox in the options with the default game would seem to have a lot of merit.
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.

User avatar
Forum Administrator
Posts: 4103
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: RNG compensation

Post by Pentarctagon » July 28th, 2015, 6:04 am

Would this compensation be displayed to the user as part of the damage calculations, or would it still display the unmodified expected results?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

User avatar
Posts: 1038
Joined: August 19th, 2009, 9:28 pm

Re: RNG compensation

Post by tekelili » July 28th, 2015, 1:37 pm

UnwiseOwl wrote:I think something like this would be great to implement as an option for those that dislike the effect of the rng
I agree, but it is just a "polite" way of describe its effect: It is only a psycological improvement, from mathematical point of of view there is no way to state a quicker convergence with expected damage would do game any better. In fact it is still taking time to reach convergence, why a qicker convergence than proposed wouldnt be better? An instant convergence would be reached with no randomess at all... why not try become as close to that as possible?

From my point of view, main complain of people who dislike rng is that a player can lose a game after play better than opponent (while people cofortable with rng think that is not a key point to evaluate a game, rather if it rewards better perfomance in some way, and optimal perfomance is far from be obvious). How a quicker convergence with expected damage could stop that kind of complain from rng haters?
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II

User avatar
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: RNG compensation

Post by iceiceice » July 28th, 2015, 1:53 pm

So, my personal opinion is that these kinds of "luck compensation" systems go against the spirit of the game, specifically, the KISS principle.

One of the most important parts of the game is that the attack and damage system is simple and transparent. A lot of TBS games have extremely complex engagement systems that the user isn't really supposed to understand in detail -- IMO this limits how interesting the game can be to experienced players. I think it is one of wesnoth's greatest strengths that it is simple and clear how the engagements work and what the chances are of the various outcomes.

I would be very interested if someone was able to demonstrate that people actually are more satisfied with the game when one of these luck compensation systems is in effect. I would be surprised if they are -- actually I think it's possible that when they do have bad luck, that they would get annoyed that the compensation system isn't working, or cheated them.


Let me add: The simplest ways imo to reduce the impact of luck in the game (reduce the statistical variance of the total damage you deal etc.) are to (1) play larger maps with larger armies (2) increase the number of strikes of the units.

User avatar
Posts: 1038
Joined: August 19th, 2009, 9:28 pm

Re: RNG compensation

Post by tekelili » July 28th, 2015, 2:34 pm

iceiceice wrote:One of the most important parts of the game is that the attack and damage system is simple and transparent.
I apologize to be totally off topic, but really wanted to adress an issue to developers from long time ago related to iceiceice words: BfW is using defense and resistances in multiplies of 10. I guess this was done from a KISS perspective. I think this is a mistake. When an expert player evaluate his attacks, chances become "dirty" anyway. My dark adept with 70% chance on every hit, becomes 49% of hit with both strikes. If I need hit 4 attacks with 2 dark adepts I would have to manage 49% by 49%. From my point of view, developers are limiting themselves in an unnecesary way about balancing tools. I think lot of faction balance could be managed by multiplies of 1 buffs or nerfs to some units stats.

I am not talking only from a theorical point of view. I have developed and played a lot an add on wich often uses "dirty" chances. In my experince as player, it was not more difficult to undestand or manage 63% than 60%.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II

Inactive Developer
Posts: 2460
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: RNG compensation

Post by Anonymissimus » July 29th, 2015, 1:33 am

slightly offtopic: On the UMC server there's still Less luck era. The approach attempted there was to slightly increase/decrease the chance to hit whenever a miss/hit occurs. That fails as it basically makes all defenses 50%; I had added a statistical test case with a berserker and an insane HPs adept showing that.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

User avatar
Posts: 561
Joined: April 3rd, 2009, 5:26 pm

Re: RNG compensation

Post by Xudo » July 29th, 2015, 3:22 am

Something like this was already suggested. See http://forum.wesnoth.org/viewtopic.php?f=36&t=35757

User avatar
Posts: 980
Joined: October 6th, 2011, 5:42 pm

Re: RNG compensation

Post by taptap » August 6th, 2015, 5:48 pm

Don't go there. There are so many strategy games, that drown you in numbers, but there is no proper explanation whatsoever, what the game does with the numbers. This proposal is basically an introduction of a hidden modifier wrecking the so far understandable system. It will also unbalance the game, when you e.g. reduce the chance for undead or northerners to get two hits in a row in a critical spot. When someone complains about that, will you say this system is fairer because, when you say 70% chance to hit, you are not supposed to get a 49% chance for a double hit or that a low-health elusive unit sitting on 70% vs. an elf shouldn't have about 24% chance to survive, but some arbitrarily lowered chance to be fair to people bad at math?

I believe, that since the complaints are mostly due to psychological reasons, they won't go away as long as there is any randomness at all. You just destroy the game for the people playing consciously with the randomness (i.e. don't only think in terms of expected damage, but also in multiple-attack-events, that can hardly be calculated anymore, when the announced chance is modified at every step). A completely non-random game would have one advantage though, it would shatter all the illusions in superior skills "despite bad luck", but I am not sure the people complaining most about luck in the game would actually like that. It would also be a completely different game.
I am a Saurian Skirmisher: I'm a real pest, especially at night.

User avatar
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: RNG compensation

Post by ChaosRider » August 6th, 2015, 8:28 pm

Make a mod which beside using original one (terrain defense) will be using AC (armor class) and Attack Bonus with 1-20 dice roll (as in NWN).
If AB + dice roll has 20 or more diffrence than unit AC (below of AC, you hits enemy only when AB + dice roll is greater than AC) then you can hit enemy with DC roll equals 20 (then all players unlikely with normal terrain defense options will be furious). This idea would require also to set for each unit AC bonus which depends of terrain type and basic AC, AB.
Another option here is that to give critical strike which needs to set for each weapon from what roll amount you have critical (because not for all weapons its equal 20 of dice roll) and value by which your dmg will be multiplied while crical strike (normal for sword can be x2, but for such a scythe x4 - in NWN with weapon master class you could have 16-20 with x5 for scythe).
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.

Post Reply