The Random Number Disintegrator

The place for chatting and discussing subjects unrelated to Wesnoth.

Moderator: Forum Moderators

Post Reply
Posts: 28
Joined: November 23rd, 2014, 7:12 pm

The Random Number Disintegrator

Post by Krolan »

Hello there ^^ I post this Off-Topic for 2 Reasons.

1.) It will never be done

2.) Even if it would, I wouldn't be the one to do so. This is an idea, nothing more.

The Random Number Disintegrator is something I think could help this strategy game we all play and love to become less about luck. The Idea.

1.) Through editting a Text-File, a player could enable the RND. The RND would do the following. He would make a RND button appear on every battle-calculations screen.

2.) Once one clicks the button, all percentages turn into certainties. For example, an Archer which shoots 3 times at 40% probability will have a certainty of 1.2 hits. 0.5 and up are rounded up, 0.4 and less is rounded down. So, the Archer would hit exactly one time, and he won't under any circumstances hit more than that. If the RND is activated, all certainties apply to the first, never the last strikes. So, the first attack would hit, for sure, and the next 2 will miss, for sure. The same goes, of course, for the enemy, so the retalation is also a certainty, so even an elven archer which is retaliated at 30% at 2 hits, will get hit once (0.6->1 hit)

3. This would allow to trade a big risk, into a small certainty with the trade-off of loosing the option of having luck and hitting more than once, or not getting hit in retaliation. Another example would be the elven archer in forest against a dwarwish thunderer in mountain. The Archer will hit (2 times), the thunderer won't hit at all (0.3 -> 0 hits). This of course applies only if the Archer, or any other unit, has 60% or more defense. If the unit has only 50% defense, then the thunderer will hit for certain (0.5 -> 1 hit).

4. The In-Game explaination lies in reality. If I'm a lancer, I can try to hit the swordsman while also trying to dodge his attack, which validates the use of a luck-based RNG system. BUT if I'm a lancer, I can also move and attack in a way, which WILL get me hit, but in which case the swordsman can't dodge either. Another example is the archer, which can, very well, put out 4 quick shots (at 40%), but could also calm down, take his time, (stand still, which makes him an easier target=validation of the retalation RND) and only do 2 precise shots (1.6 -> 2) (they're elves, after all, so they should be able to do such a thing)

5. Since the RND has always to be individually activated for every battle-calculation screen, this would allow for a mix of luck-based attacks/strategies with a follow-up in certainty dependant on the outcome of the luck-based fight's I fought. It would also disintegrate the OP'nes of Liches on castle tiles, since I would know exactly how many times the lich will get hit and how many times my units will get hit.

6. I propose this also because there is no logical explaination to this day, how multiple lancers, who were trained in barracks, continue to miss this giant-ass oger. Except if the Rider tries to pull a hero move, and just failes. The Disintegrator would make the same lancer attack once in a very focused and calm state, but "slower" and without the option of "Jumping up in the air with my horse to attack the ogre a second time" (which, in itself, was always strange, since the power of the lance depends on the speed build up when running towards the enemy, the second strike being as powerful as the first never made sense.)

7. I think the RND in combination with RNG would be a great way to allow strategists combine luck and planning into one big pile of awesomeness. Like, Attacking the ancient lich with 3 luck-based attacks and continue the assault based on that outcome. If the ancient lich is at red hitpoints by now, sending 2 Archers to take one precise shot each(and dying in the process for the ancient liches 5 attacks RND'd (magical 70%) to (3.5 ->) 4 certain attack) would end the fight and feel like an accomplishment of wits and tactics.

Anyway, I post this here as an idea to think about, nothing more, nothing less. I enjoy wesnoth the way it is, but I'd also enjoy if my idea would be considered ^^' (again, call it the "childsplay"-version for what I care)



P.s.: This idea is made up for Campaigns or Single-Player Scenarios. The computer would continue to always use RNG on his turn, because a) it is likely to be more beneficial and b) because it'd be to hard to code an AI which considers using RND or not using it.


1. The RND should not take effect if the enemy has no way to retaliate. The Why: An enemy which cannot retaliate WILL focus on dodging, therefor the RNG is rightfully used in that case (with melee attacked dark adepts for example). This rule could also apply if calculation for retaliation would result in 0 hits. (with a dwarfish thunderer retaliating an elven archer on forest tile for example (0.3->0), since an attacked unit realizing that there is no point in retaliating will also focus on dodging (after luck-shooting their 0-hit RND weapon in RNG)

2.The RND also should not take effect if the calculation of the RND would result in the attacking unit certain-attack an enemy for the maximum number of attacks (Example: A unit making 2 attacks at an enemy in shallow water (20%) would result in 1.6->2 certain attacks. The RND-Button is not a cheat button, so the RNG takes its (normal) effect)

3. The RND should not be able to certainify more than 2/3 of attacks (Meaning: Human Archer (3 attacks) with 60% hit-chance(Plains) will have 2 certain attacks (1.8->2), rightfully so. However, a Red Mage (4 attacks) with 70%(magical) hit chance would result in (2.8->3) certain RND-attacks, which is 3/4 of attacks surpassing the 2/3 limit. The Red Mage would, because of that, get only 2 certain attacks. This rule makes Exeption number 2 pointless btw. It also means that your own or a retaliating Ancient Lich (5 attacks) will not get (3.5->4) attacks, since this is 4/5, but will get 3 certain RND attakcs, which is 3/5 which is slightly less than 2/3, and as such contained in the rule)
I do GPE(Genuine Playing Experience), Screenshot-reinforced and detailed Bug-Reports for Campaigns. If you want me to check yours, be it Pre-Alpha, Alpha, Beta or finished, let me know. Since I don't know anything about coding, I'll be unable to tell you why something bad happens though. PM me.
User avatar
Posts: 851
Joined: February 24th, 2011, 4:20 am

Re: The Random Number Disintegrator

Post by Crow_T »

It's not the same idea, but you should try the addon in my sig for a bit if you are frustrated by the current battle system. It's not based on simple hit/miss, but instead uses a biased randomization to determine damage based on chance to hit. There is also the PRNG mod which increases chance to hit after a miss.
Posts: 28
Joined: November 23rd, 2014, 7:12 pm

Re: The Random Number Disintegrator

Post by Krolan »

This topic is old and noone ever gave a rats tail about it but nontheless, here is an addition:

Rule Number 8:
If RND is activated, the retaliating opponent gets to attack (and hit) with all his possible attacks before the attacking unit gets his. So an Orc attacked by a horseman will atack with his 1 attack and hit, before the horseman gets to attack on his end. Since the Horseman gets damaged for twice as much damage, this is in my view balanced. The attacked unit in this example acts like a unit having "first strike", except that an Elven Archer would attack its 2 RND-Attacks before the horseman attacks at all.
Rule Number 8.1:
If the retaliating opponent already has "first-strike" and RND is activated, the retaliating unit gets ALL of its attacks and hits them for certain despite Exception 3, which states that no more than 2/3 of attacks could be validated (example: A Horseman attacking a lancer, who has first strike, will be damaged 3 times in a row without reacting, before continuing doing its one attack and hitting for certain (Exception Number three: no more than 2/3 of attacks can be validated, Horsemen have only 2 attacks (see first post))

Either way, greetings from germany.

Also, since we're charity-whoring right now I think it would be wise to set thoughts on a anti-frustration solution, since luck-frustration, in my opinion, is the downfall of wesnoth regarding so called casual players, which are sadly the majority.


Ps.: No more than 2/3 attacks can be validated is in conflict with the thunderer, which has only one attack. Thats why I present:

Exception Number 4: An attacked thunderer ( or any one-attack-unit ), while RND is activated, will hit no matter what.

With Rule Number 8 this also means, that the thunderer will attack first and he will hit.

This Exception can be ignored if following exception number 3 (see above). If the retaliating opponent would get 0 hits, RNG is use.
I do GPE(Genuine Playing Experience), Screenshot-reinforced and detailed Bug-Reports for Campaigns. If you want me to check yours, be it Pre-Alpha, Alpha, Beta or finished, let me know. Since I don't know anything about coding, I'll be unable to tell you why something bad happens though. PM me.
User avatar
Posts: 4960
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: The Random Number Disintegrator

Post by Dugi »

I have actually implemented this in the past elsewhere. Each unit had some karma values, if it got hit, its karma went up, decreasing its chance to get hit, if it was missed, its karma went down, increasing the chance to get hit. As a result, 1 in 4 attacks with 75% chance to hit missed, but it could not be told which one would it be. There were no strange hit streaks or miss streaks.

It could be implemented into wesnoth in roughly 2-3 hours of work, as an add-on.

Your vision has made a few strange rules that I find rather bizarre, such as thunderer always hitting (he could just miss every fourth turn if his chance to hit is 75%, no?) that leads into huge unbalance.
Posts: 28
Joined: November 23rd, 2014, 7:12 pm

Re: The Random Number Disintegrator

Post by Krolan »

I'm bored and I realized that my initial presentation... lacks... to put it lightly. So here is the RND, the concept at its rules in a (hopefully) more accessible manner:

The Why:
Having bad luck sucks. Having streaks of bad luck sucks even more. Over the years playing this game (mostly single player) and my own share of whining, moaning and complaining, I had more concrete thoughts on the Issue. I don't want to try and repeat what the real issue with luck in this game is, I want to present a possible solution. As mentioned I'm no coder. If I knew how I could access the knowledge rather efficiently I'd do so, but maybe I'm just lazy or caught up in everyday life.

The concept:
The RND (short for my self-proclaimed Random Number Disintegrator) is meant to counter the issue of bad luck without changing the core mechanics of the game. RNG will still have its use, there will be moments where it would be smarter or better to use RNG, but sometimes one feels unlucky and often times one is right about that. RND would essentially allow a player to activate a function, which will trade risky but potentially rewarding actions for less rewarding actions which therefor will have a certain, unchangable result.

RND should be activated through a text-file edited by the player. This is to prevent everyone using it. I feel that a player should first experience the initial wesnoth before making the decision to activate this function. The RND would be a button on every Battle-Screed (the Screen one sees before confirming his attack and watching its resolve)

RND Rules:

Rule Number 1: If RND is activated RNG is turned off for the chosen combat. The estimated result should change to "Chance to hit 100%" and the amount of attacks each unit performs reduced to an amount explained further in the rules.

Rule Number 2: The amount of attacks a unit gets in RND is calculated through the initial probability to hit and the amount of initial attacks. An elven Archer, which has 4 attacks, attacking a unit at 60% probability, will have 2 attacks (4*0,6 = 2,4 = 2). Decimals at or below 0,44 are rounded down (0,44=0,4=0), Decimals at or above 0,45 are rounded up (0,45=0,5=1). If calculations lead to the amount of attacks of either unit to become 0, RNG is used instead.

Rule Number 3: The RND will not validate more than 2/3 of initial attacks. A Mage (70%, 4 attacks) will only hit 2 times instead of 3 (4*0,7 = 2,8 = 3), since 3 attacks represent 3/4 of his initial attacks. If because of this rule the amount of attacks a unit performs would become 0, the RND button shall be greyed out and RNG shall be put to use (One-Hit Units are the only ones suffering from this).

Rule Number 4: The calculated certainties always apply to the first, never the last, attacks. (so with 2 RND attacks based on 4 RNG attacks, the first 2 will hit, for certain, the last 2 will miss, for certain.)

Rule Number 5: While RND is activated the retaliating unit gets to attack with all his calculated attacks, before the attacking unit takes any action. If as a result of this rule the attacking unit would die before its attack happens, RND on the battle-calculation Screen shall be greyed out and RNG is to be put to use.

Rule Number 5.1: If the retaliating unit has the ability "first strike" it gets to retaliate with its initial maximum number of attacks and hit its attacks for certain before the attacking unit gets to take its action, ignoring Rule Number 3. RND is greyed out, if the attacking unit would die as a result of activating RND. A retaliating spearmen will always get to attack 3 times in a row and hit for certain before the attacker deals any damage, if attacked by a unit while using RND.

Thats it. There are a good chunk of examples, where RND couldn't be used, but another good chunk where RND could be put to good use. The RND, in my opinion, would make the decision making more complex and therefor add to the experience.

For some madness and conflicting thoughts and stupidly formulated sentences, check the previous 2 postings.


Thank you @Dugi for posting while I was writing :D

Yes, it's true, the thunderer hitting always no matter what was a stupid idea. In effect, the thunderer would nerver run under RND. Checking the 6 rules in this post, I realize, that all one-hit-units could not be run under RND. If the Thunderer wouldn't hit at all, because of Rule Number 2, RNG is used. If the thunderer would hit, because of Rule Number 3, RNG is used.

I think the main difference between your (already developed...) system, and my (never to be developed...) concept is that your system reduces randomness based on random events happening, while my concept would allow the player to use the initial RNG in adittion to an on-and-off system, which trades in certainties, so the player, activating RND KNOWS what will happen next and in which order, but has to deal with a potential disadvantage in comparission to RNG.

I think it would also be possible to include the RND with your system, but since yours seems to work pretty well it doesn't seem necessary ^^

Greetings :)
I do GPE(Genuine Playing Experience), Screenshot-reinforced and detailed Bug-Reports for Campaigns. If you want me to check yours, be it Pre-Alpha, Alpha, Beta or finished, let me know. Since I don't know anything about coding, I'll be unable to tell you why something bad happens though. PM me.
Post Reply