Gentle approach to removing random

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:
optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Gentle approach to removing random

Post by optimother » July 12th, 2014, 5:07 am

Background:
Currently 1v1 match outcome is determined by luck (or bad luck) if players skills are similar.

Proposal:
Introduce an Offence ranged from 1 to 100.

Recruiting:
Initial offence value is random.

Attacking:
Suppose unit A with offence off trying to attack unit B with defence def. Before every attack A's offence is decreased by B's defence ( A.off = A.off - B.def ) if A's offence is greater than 0 (A.off > 0) then it's a hit, else miss and A's offence is increased by 100 ( A.off = A.off + 100 ).

Example:
Attacking 10 times unit with 70% defence with 10 damage:

Code: Select all

    offence defence damage 
 1      100      70     10 
 2       30      70      0 
 3       60      70      0 
 4       90      70     10 
 5       20      70      0 
 6       50      70      0 
 7       80      70     10 
 8       10      70      0 
 9       40      70      0 
10       70      70      0 
Total dmg: 3 hits x 10 = 30
Estimated: 3 hits x 10 = 30
Initial offence value can alter the hits distribution, but 10 attacks against 70% def will always result in 3 hits.

Effect:
This is perfectly compatible with current estimates, and even AI should work, although can be improved. This would allow players demonstrate the tactical masterpieces of planning and strategy instead of guessing and watching how their best strategy ruined by RNG. Every replay I watched (not much) contained chat about luck, so I think for tournaments it should be determined. Campaigns should be determined. Playing for fun with friends can be left random.

[Update]
Implemented as add-on Deterministic Offense.

3 options:
  • Deterministic, as described above
  • Deterministic with a little element of randomness: every few hits your units miss instead of hitting, and hit instead of missing. (my personal favorite)
  • Pre-shuffled (or card based), for every defense 5 decks of hits/misses generated (for 60% defense deck consists of 4 hits and 6 misses). Of those one with the shortest longest streak is selected and used for your side. When only one card is left new 10 cards are added and shuffled.
  • Disabled — standard random combats
Last edited by optimother on July 17th, 2014, 9:03 am, edited 3 times in total.

optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Re: Gentle approach to removing random

Post by optimother » July 12th, 2014, 5:17 am

I know it number one frequently proposed idea, after some help with implementation for me personally it can be safely deleted.

And I know there are many attempts to remove randomness but this is significantly different from what I saw.

User avatar
zookeeper
WML Wizard
Posts: 9739
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Gentle approach to removing random

Post by zookeeper » July 12th, 2014, 9:03 am

Considering how my defunct LessLuck Era was implemented (vaguely similar'ish alteration of hit chances mid-combat), this is probably doable as a mod as well... but I don't know how messy or straightforward it'd be.

Anyway, your idea still seems to suffer from being abusable; if you know the units' offense counters, you can know when you'd hit or miss, so you can for example finish off a wounded unit with a unit of yours that you'll know will kill it before receiving retaliation. Or you can melee an orcish grunt at night, safe in the knowledge that it will miss the next two strikes it makes. If you don't mind that and it's only for personal use anyway then that's not a problem of course.

optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Re: Gentle approach to removing random

Post by optimother » July 12th, 2014, 10:13 am

One option is not to show the current value, so that it's hard to remember for every unit, player will be confident that it's not random, but absolutely fair and if it missed before most likely will hit now, without 10 misses in a row against 1hp unit.

I'm trying to read some docs, and it's a real pain to understand. What I've figured out now is that there is no before-blow event, just after-hit/miss. So I think it possible this way:

Code: Select all

attack -> decrease current offense for both attacker and defender; set chance_to_hit
attacker/defender hit -> decrease offense; set chance_to_hit
attacker/defender miss -> add 100 to offence; decrease offense; set chance_to_hit
attack end -> increase offence to revert an extra decrease

User avatar
StandYourGround
Posts: 254
Joined: May 13th, 2009, 2:16 am
Location: On a blue ball spinning through space at incomprehensible speed

Re: Gentle approach to removing random

Post by StandYourGround » July 12th, 2014, 8:04 pm

Will all units start at the same offense value, or will they be assigned an *ahem* random value to start? If they all start the same, then it would be fairly easy to exploit.
I will now resume lurking silently.

optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Re: Gentle approach to removing random

Post by optimother » July 12th, 2014, 9:14 pm

StandYourGround wrote:Will all units start at the same offense value, or will they be assigned an *ahem* random value to start? If they all start the same, then it would be fairly easy to exploit.
I appreciate your irony, but you got my point incorrectly. I don't mind random, but I strongly dislike situations when low-hp unit can dodge much more attacks than anyone can expect. In my original post I proposed cycling initial offense value 100-80-60-40, which seems to work fine. Randomizing it also good option, players will not know for sure about their fresh recruits whether their first attack will succeed or not, I think it would contribute to strategical approach instead of calculation.

Overall, I've implemented it :) Played couple matches against AI, and it works even better than I could imagined, absolutely awesome. Hits and misses are so natural that when I don't track offense values it hard to tell it's not random :) It just goes as it should.

2 disclaimers:
1) It's the first time I see and use Lua, sorry for possibly bad code and excessive copy-paste
2) I didn't find the way to publish the addon, so it's a little more complicated to install for now

Installation:
Search it in add-ons menu in 1.11.15+
The obsolete, hard way:
Last edited by optimother on August 9th, 2014, 11:51 am, edited 2 times in total.

User avatar
Crow_T
Posts: 850
Joined: February 24th, 2011, 4:20 am

Re: Gentle approach to removing random

Post by Crow_T » July 12th, 2014, 10:09 pm

Just did a quick test, it's certainly more aggressive which I like :twisted: I'm not sure I get the 100,80,60, etc. countdown- does that mean units get weaker (hit less) as they are recruited?

optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Re: Gentle approach to removing random

Post by optimother » July 12th, 2014, 10:17 pm

Sorry for the countdown — forgot to remove it, used for debugging :) To get rid of it just comment or delete line 197. It doesn't mean that units are weaker, it just shifts the hit/miss cycle so that not all first attacks succeed. Unit with 100 offence will definitely hit anyone on first strike and will get offence decreased, 20 will hit no one but will get high offence for next blow.

User avatar
ancestral
Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Gentle approach to removing random

Post by ancestral » July 13th, 2014, 2:10 am

I still prefer a card stack or weighted random number generation. I think both of these have been attempted before on the forums.

With the card stack, imagine a deck of 52 cards, each representing a value. When you’ve used one value, you won’t see it until you've exhausted the deck. In Wesnoth, probably each kind of attack would need its own “deck.” (Settlers of Catan have this as an option instead of dice.)

The weighted RNG would be, when one result is chosen, it becomes slightly more probable the opposite will be had the next time around. (Supposedly Warcraft III uses a model similar to this.)
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer

User avatar
Crow_T
Posts: 850
Joined: February 24th, 2011, 4:20 am

Re: Gentle approach to removing random

Post by Crow_T » July 13th, 2014, 1:11 pm

I agree that having the recruit values randomized would be a good idea in that it would discourage manipulation of the system. In this case the recruit values 100,80,60,40,20 would sequence in random 5 number blocks.

Personally I don't plan on obsessing over keeping track of the order- I'm just happy to see some alternate battle systems :D

optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Re: Gentle approach to removing random

Post by optimother » July 13th, 2014, 1:26 pm

ancestral, it seems pretty easy to implement the card-stack-ed random, I just don't understand how to apply it to Wesnoth preserving the stats and balance. Can you provide couple examples: 1) dealing 10 attacks against 70% defense, 2) 5 attacks to 70% then 5 to 50.

Crow_T, here it is: http://pastie.org/9385009 - updated version of the deterministic_offense.lua with random initial offense values and fix for magical attacks.

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

Re: Gentle approach to removing random

Post by tekelili » July 13th, 2014, 2:19 pm

ancestral wrote:I still prefer a card stack or weighted random number generation.
Just note that if player knows deck size you would be rewarding "count cards". This would be pretty easy with attacks with 30% chance to hit (like a grunt attacing an elvish archer). If I have already got all possible succesfull cards for such attacks, I wont attack again versus 70 defense until deck is restarted.

In general, any try to balance pure randomess can lead to luck manipulating from players. If having some pretty bad misses a player can expect more hits in future, he can plan more risky attacks. If having some pretty unexpected hits, player will play conservative and will "waste" some attacks on non risky spots.

In general, I dont see what "randomess balace" offers: In normal Wesnoth, players plan their moves claculating chance of outcomes with total randomess. In "balanced randomess" enverioments, players do exactly the same but they have also to weight the outcomes chances memorizing previous outcomes ;)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II

optimother
Posts: 76
Joined: July 12th, 2014, 4:09 am

Re: Gentle approach to removing random

Post by optimother » July 13th, 2014, 6:17 pm

tekelili wrote:Just note that if player knows deck size you would be rewarding "count cards". This would be pretty easy with attacks with 30% chance to hit (like a grunt attacing an elvish archer). If I have already got all possible succesfull cards for such attacks, I wont attack again versus 70 defense until deck is restarted.
Then keep separate decks for different defenses: one for 20% (contains 8 hits and 2 misses), one for 30 (7hits/3misses) etc. and when attacking pull cards from the right stack. This is even closer to expected mean value because the deck is not per-unit, but rather per-side, and at the same time is not deterministic.

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

Re: Gentle approach to removing random

Post by tekelili » July 13th, 2014, 6:56 pm

optimother wrote:
tekelili wrote:Just note that if player knows deck size you would be rewarding "count cards". This would be pretty easy with attacks with 30% chance to hit (like a grunt attacing an elvish archer). If I have already got all possible succesfull cards for such attacks, I wont attack again versus 70 defense until deck is restarted.
Then keep separate decks for different defenses: one for 20% (contains 8 hits and 2 misses), one for 30 (7hits/3misses) etc. and when attacking pull cards from the right stack. This is even closer to expected mean value because the deck is not per-unit, but rather per-side, and at the same time is not deterministic.
If I understand you well, it would be totally deterministic after 9 attacks (just one card left in deck). It is not so difficult count nine attacks vs determinated defense value (but I find irrelevant how difficult it is remember it). Just imagine how broken could become a combat when a player can know an attack outcome for sure and use such attack on a key spot or combined with skills as charge.

Edit: Repeating a little my last post, I dont see non-luck or balanced-luck systems working in Wesnoth. At difference of chess, where each player can only move one "unit" per turn and advantages are gained and exploited slowly, in Wesnoth the power players have at own turn is inmense and can easyly decide a game before oponent gets its next turn. Giving more deterministic outcomes to attacks, would overpower the active player (his army would be by far more efficient).
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
iceiceice
Developer
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Gentle approach to removing random

Post by iceiceice » July 13th, 2014, 7:13 pm

optimother: One possible issue with the idea of having multiple decks is that, if the decks are proceeding independently of one another, then it is possible that they will all sync up on one turn and you will get tons of hits on that turn. The player might even arrange for this.

It depends on what "problem" you are trying to solve. If you think the "problem" is that a single unit might, over the course of it's lifetime / a significant portion of the game, get way more hits than usual, then the offense counters / decks will solve that issue pretty decisively.

If you think the "problem" is that one team might get way too many hits on a single turn and gain a decisive advantage by killing all the enemy units before the luck can balance out, then I think you need to use a system where the units are linked, so the counter(s) / deck(s) are shared and used equally by all of the units in the team.

This stuff was discussed at length here: http://forums.wesnoth.org/viewtopic.php ... 26#p570326

One possible solution which I proposed was, instead of decks etc. for each defense value, generate numbers from a low-discrepancy sequence and use those instead of the RNG values. But I never coded or playtested this idea.

Edit:
tekelili wrote: Giving more deterministic outcomes to attacks, would overpower the active player (his army would be by far more efficient).
This is a very interesting point which I never thought of before, I think you are quite right. The strategy is all about risk vs reward... it might be that if you eliminate or reduce the risk, you should also reduce the damage of all units across the board by some fixed fraction (or similar) to reduce the reward for attacking first, or risk factional imbalance. :hmm:

Tbh though, I'm not sure if there's any way to retain the kind of balance you have in 1 v 1 mp games... I'm pretty sure reducing the variance hurts orcs trying to attack elves for instance. In a large attack of orcs on elves, you rely on occasionally getting lucky and double hitting to generate kills. If that never happens then you can never kill anything, and you probably have no hope. So maybe reducing luck also hurts some attacking factions, rather than helping them. That seriously complicates even the hypothetical idea of "retaining wesnoth balance" while reducing luck.

Post Reply