Luck in multiplayer

General feedback and discussion of the game.

Moderators: Forum Moderators, Developers

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

Re: Luck in multiplayer

Post by zookeeper » April 27th, 2014, 9:21 am

I don't think one can really determine how much intention there is in how the luck system works. It's just how the game originally worked, then MP was added, and never has there been a decision to change it because it's always been felt that no proposed alternative is actually better.

Obviously the original gamerules are a conscious choice, but given how Dave surely didn't know how long-lived and popular the game would become, they probably weren't the result of the kind of in-depth analysis of different goals and possibilities that has been seen since. If the game had been designed specifically for hardcore competitive play, then I'd imagine it might have been rather different. And I'm not saying the current system doesn't allow for hardcore competitive play, it just attracts a different, perhaps smaller subset of the competitive-minded crowd, just like poker does.

Is it a conscious decision that sometimes luck decides the match? Not really, that's just a side effect. Is it a conscious decision to keep the system anyway, and despite the fact that playing Wesnoth competitively only appeals to people who don't mind the role luck plays? Certainly.

User avatar
beetlenaut
Developer
Posts: 2391
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Luck in multiplayer

Post by beetlenaut » April 27th, 2014, 9:27 am

To answer your question:
Daravel wrote:Not to be facetious, but, have you decided it's an essential part of multiplayer?
Yes. Yes, we have. If you have any amount of luck in a game, there will always be situations where the better player loses because of it. That's the way luck works. In order to remove the possibility for the better player to lose, we would have to create a deterministic game. It's not that we want some "% of games to be 'unwinnable' due to a random mechanic," that's just the inevitable result of having dice in your game at all, and we want them.

The only real discussion to have here is what percentage is acceptable to you. The mainline developers are satisfied by the current percentage of somewhere around 5%, but people have created eras and mods that change the fight mechanics to reduce that percentage. You could try those, or find people who are willing to play a "best two out of three" match. That would reduce the possibility to tenths of a percent. Or, you could keep in mind that if you play 40 games, we expect that you will be cheated out of a win just once. Out of 40. (And luck into a win once as well.) Because of all the situations you've discussed, you must feel like you are being cheated out of a win far more often than that. Really, you aren't. Wesnoth is just a far more difficult game to master than it seems like at first.

Edit: So, yeah, I was basically ninja'd by zookeeper, but we didn't say exactly the same thing, so I decided to post anyway.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
lipk
Developer
Posts: 631
Joined: July 18th, 2011, 1:42 pm
Location: Here and there and everywhere

Re: Luck in multiplayer

Post by lipk » April 27th, 2014, 10:19 am

2) Luck balances out - This is tied to point 1. On average, luck evens out, it's a rule of maths, regression to the mean and so forth. But this is not a valid counter-argument. Take the above example, where instead of me dealing 35 damage, I deal 10 and instead of them dealing 20 damage they deal 35 (very common), this is a 35 damage swing and possibly a 4 unit swing (2 of theirs alive, 2 of mine dead). That compounds on the next turn when I have less units to hit with and they have more, then I have to spend gold to get myself back on par - and in the retreat lose towns. The fact that, in the last few turns when you have 3 units left, that you overall luck is finally sitting around 0% doesn't make a bit of difference because your opponent has dealt 150 more damage than you in real terms.
An excellent line of thought. I'd go even further and negate your first sentence: luck does not balance out. If you summarize the expected/dealt damage ratio each turn, that indeed converges to zero, but, just as you pointed out, it's not a valid measurement of luck. (Expected - dealt) is, and that is more influenced by early turns when there are more units on the field.

I've been planning to implement a modification that adresses this issue, but don't hold your breath on that.

Daravel
Posts: 309
Joined: August 30th, 2008, 10:39 pm
Location: England

Re: Luck in multiplayer

Post by Daravel » April 27th, 2014, 10:27 pm

tekelili wrote:
2 - Penalties are not random, they are skill based entirely.
I are you really telling me that (basically having 3 options for penaty be throwed: right, left and middle), there is no randomess in wich side each player (penalty thrower and goal keeper) will decide to perform? That means that if the same player throws 100 penalties to the same goal keeper each outcome will be decided only for skill without any randomess involved? Sorry, but I rather see this issue like bassed on players skills: they have some %chance to score.
Different kinds of 'luck'. You can argue that the goalkeeper has to guess which side the player will kick it and there are arguably minimal clues/information for them to use to make that decision, but ultimately both the player and the goalkeeper make a conscious decision on what to do. A goalkeeper may get lucky or unlucky in choosing the right side to dive for the ball.

This is about an outside and truly random force acting on events (in the football analogy, it'd be like a very strong gust of wind) - one which can never be predicted and the results of which can (in the rare case) ruin a perfectly viable strategy.

8680 wrote:
Daravel wrote:Because I'll be honest, I don't think I'll play many more games because I feel like I'm losing games where I'm in an excellent position and make perfectly sound moves but get overly penalised by a massive swing in luck.
Have you tried any of the randomness-reducing add-ons that are floating around? Perhaps you would prefer playing with one of those.
I might check them out, but I fear that the multiplayer community there would be quite small, thanks for the suggestion though :)

zookeeper wrote:I don't think one can really determine how much intention there is in how the luck system works. It's just how the game originally worked, then MP was added, and never has there been a decision to change it because it's always been felt that no proposed alternative is actually better.

Obviously the original gamerules are a conscious choice, but given how Dave surely didn't know how long-lived and popular the game would become, they probably weren't the result of the kind of in-depth analysis of different goals and possibilities that has been seen since. If the game had been designed specifically for hardcore competitive play, then I'd imagine it might have been rather different. And I'm not saying the current system doesn't allow for hardcore competitive play, it just attracts a different, perhaps smaller subset of the competitive-minded crowd, just like poker does.

Is it a conscious decision that sometimes luck decides the match? Not really, that's just a side effect. Is it a conscious decision to keep the system anyway, and despite the fact that playing Wesnoth competitively only appeals to people who don't mind the role luck plays? Certainly.
It's a fair point and I'm certainly not expecting it to be changed and its fair enough if you decided you like it that way; and to reference beetlenaut, I can understand how you accept the small % of games that get hit by extreme luck as fine in order to preserve the overall aim/feel of the game. I guess for me, I do prefer things to be more deterministic and that may predispose me to view bigger turns of luck more unfavorably (both positive for me and my opponent).

Could just be that Wesnoth MP is not for me :) . Though I would follow on from lipk's comment and say that the snowball effect of luck may be being under-estimated. It doesn't have to be a huge luck swing to make a difference, an example being that if you get all your hits on one or two units, but miss on others, but your opponent hits across many units, you may find your damage dealt is similar, the luck % similar, but one player loses 2 units while the other doesn't. That can snowball rapidly, especially if you're defending, get the 'poor luck' and it's not your ToD.

But my question is answered, yes, it is now deliberate design and that's OK. Hopefully I didn't come off as too much of a ranting child (I did post last night after feeling pretty hard done by).

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Luck in multiplayer

Post by Sapient » April 27th, 2014, 11:30 pm

was maintaining the heavy luck element a conscious choice?
Frankly I find the whole premise behind the creation of this thread absurd. First of all, you start with the assumption that the luck element is "heavy", then ask if the developers have even *considered* its impact on multiplayer gameplay? This despite your own knowledge of the countless threads which prove otherwise that they A) have considered it, and B) do not consider the luck element to be "heavy" as you claim. There is your answer. Pointless thread.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

Daravel
Posts: 309
Joined: August 30th, 2008, 10:39 pm
Location: England

Re: Luck in multiplayer

Post by Daravel » April 28th, 2014, 5:05 pm

Sapient wrote:
was maintaining the heavy luck element a conscious choice?
Frankly I find the whole premise behind the creation of this thread absurd. First of all, you start with the assumption that the luck element is "heavy", then ask if the developers have even *considered* its impact on multiplayer gameplay? This despite your own knowledge of the countless threads which prove otherwise that they A) have considered it, and B) do not consider the luck element to be "heavy" as you claim. There is your answer. Pointless thread.
I think you've put a fair bit of false emphasis on two particular words and have attacked my post on that basis. I never complained about bad luck in general or claimed that the influence of general bad luck is 'heavy' - I'm talking about significant luck swings, in the order of losing 20-30 damage in a turn and then your opponent gaining 20-30 damage and perhaps repeating on the following turn and then how that simple case of events can have a huge impact on the outcome of a multiplayer game. Not all luck, I can live with the general ebb and flow of hits and misses, but huge luck swings that are far off what any sensible tactic or plan should account for. Here is the relevant quote from Dave:
Wesnoth's approach also requires a substantial amount of analytical ability from the player. In chess, and in Fire Emblem, one knows that if they lost, they made a mistake. In Wesnoth, one can occasionally play better, and still lose. Bad in many ways perhaps, but still it adds an interesting facet: it requires more analysis as a player. You have to be able to distinguish from situations where you played a good strategy but still lost, and situations where you lost because of your poor strategy. Certainly, in real games, a losing player will almost certainly have made mistakes, but working out what those mistakes were becomes difficult, and requires great analysis.
My question was always around whether there had been discussion around the effect of edge case scenario's and how they impacted on multiplayer games (they are more susceptible to luck due to a human's ability to capitalise and adapt to the swing in their favour, that you have less units to work with and are in a constant gold war). Dave mentions that one should be able to distinguish between situations where you played a good strategy but still lost (due to luck), and situations where you lost because of poor strategy. This is my opinion only, but, the moment in which poor strategy is undone by random chance, the game has failed (in a case where it pits player against player). The question has been answered though, yes it has been discussed, yes it wasn't originally planned into the game, but as a result of it being a direct port of singleplayer, here it as and yes, we want it to stay - and that is fine. I was just wondering.

Though (without evidence myself) I do wonder what effect smaller bouts of luck can swing a multiplayer game - take the situation where player A hits two units and scores average damage across both then player B hits two units, gets unlucky by missing one unit completely but then maxes out hits on the other and kills it - in this situation, who got luckier? They may have done the same damage, with the same chance to hit, all been on good terrain etc etc. But one player has a clear advantage. What if it happens again at three points in the game? Has player B now got a significant advantage purely from luck?

Putting an '*' around a word and making out as if I asked the question in an accusatory manner is not really fair, is it? It was a general, honest question. I'm also not aware that my knowledge of Wesnoth threads was public knowledge, reading Dave's post and the other threads coming up in the forum search, I find none that detail the specific discussion of luck as it pertains to multiplayer specifically and the nature of competitive Wesnoth (not in terms of professional, E-sports or the like).

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

Re: Luck in multiplayer

Post by iceiceice » April 28th, 2014, 5:26 pm

I hope we all have better things to do than argue after the fact about whether the thread was pointless to begin with.

That being said, I think Sapient has a point. Despite your apparent best intentions, this was pretty much "just another luck thread" that was largely unproductive. You basically came just to complain about losing games because of bad luck. There has been nearly an entire book written on this forum about the role of luck in wesnoth. This question "did we think about it *specifically with regards to multiplayer*" is a bit strange... maybe yes, maybe no, so what? Most games don't invent special rules for the multiplayer version. And afaict you didn't offer any constructive proposal.

Instead you offered this:
Daravel wrote: The moment luck (or any arbitrary game mechanic) makes a sound move by a player pointless, then the game has failed (my opinion).
When with a little searching, you would have known that Dave wrote
Dave wrote: In Wesnoth, one can occasionally play better, and still lose. Bad in many ways perhaps, but still it adds an interesting facet: it requires more analysis as a player.
When I look at walls of text beginning "My question was always around whether there had been discussion..." I know I can safely assume that that is not, in fact, the real question. :whistle:

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

Re: Luck in multiplayer

Post by zookeeper » April 28th, 2014, 6:08 pm

:doh: This will be just another luck thread only if it keeps getting derailed towards that. Please, everyone, think before you post.

User avatar
pyrophorus
Posts: 513
Joined: December 1st, 2010, 12:54 pm

Re: Luck in multiplayer

Post by pyrophorus » April 29th, 2014, 12:04 pm

Hi !
Anyway, I have a question about all mathematical arguments which were given. They all rely on the implicit assumption the RNGs gives something very close to a normal distribution. This is certainly the case on long sequences using the same seed. But what if the RNG si reseeded very often ? IMO, it's not obvious the results still follow a normal distribution.

Btw, I think some other ideas could be explored to diminish users frustration about luck. For instance, nerfing defense and damage on unit near death. This could solve the "Dark Adept-with-one-hitpoint-left-dodging-six-attacks-and-and-retaliating-at-full-strength" well-known problem in another way.

Friendly
Campaign Return to Noelren *** HowTos: WML filtering, WML variables
Please help to to update the Guide to UMC Campaigns

Velensk
Multiplayer Contributor
Posts: 3988
Joined: January 24th, 2007, 12:56 am

Re: Luck in multiplayer

Post by Velensk » April 29th, 2014, 1:03 pm

Although the point in general stands, odds are there should have been no retaliation because the person attacking should have been using melee attacks.

The range mechanics in general serve both as a method of encouraging combined arms and giving luck mitigation considerations. For example, if all you have that can attack that dark adept is an elvish archer you have the choice between a fairly reliable kill with no chance of taking retaliation or a very reliable kill where you risk getting blasted hard. A much more interesting dilemma than knowing that you'll kill it without taking any damage. When the adepts turn comes back around (assuming he lived), there's that chance that he can blast the archer and survive but in most circumstances this would not be worth the risk of being finished off by the retaliation before he can even get his second shot off.

In any case, I don't think that making low health units weaker would be ultimately beneficial.

If I were to try to modify the game to make it less luck prone, I'd probably just operate on the assumption of a higher base number of strikes relative to damage (so a spearman would have 5 strikes or similar and health and healing would be scaled accordingly). To be honest, I don't think this would actually make the game more fun or interesting for me but it might reduce the frequency of frustrating moments. For me the metal of how it feels now is more than worth the frustration and I don't think I'd want to switch but I can see why it might be worthwhile for others.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."

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

Re: Luck in multiplayer

Post by iceiceice » April 29th, 2014, 2:49 pm

pyrophorus wrote:Hi !
Anyway, I have a question about all mathematical arguments which were given. They all rely on the implicit assumption the RNGs gives something very close to a normal distribution. This is certainly the case on long sequences using the same seed. But what if the RNG si reseeded very often ? IMO, it's not obvious the results still follow a normal distribution.
The RNG we use is a linear congruential generator.
http://en.wikipedia.org/wiki/Linear_con ... _generator

Dave apparently found this exact description in the manual pages for rand.
https://github.com/wesnoth/wesnoth/blob ... le_rng.cpp

This looks to be the man pages that described it:
http://linux.die.net/man/3/rand

It's obvious to me that if the seed is truly random, then the next call of "random_next()" will be truly random with negligible error.

Actually I think there may be a bug though, in that the man page calls for an "unsigned long" to be used, and in our implementation the rand_pool_ is an unsigned int. :shock:
https://github.com/wesnoth/wesnoth/blob ... le_rng.hpp

Regardless of that though, I think the answer to your question is that reseeding does not cause any noticeable short term bias. I think it's a good question though, it seems at least conceivable to me that depending on how seeding works there could be noticeable short term bias in an RNG that is only ameliorated in the long term, and it could be an "acceptable" RNG. Ours doesn't seem to have *that* problem. Edit: I say this because it appears that all of the state of the RNG is uniformly randomized by reseeding.

Edit: I wrote "Dave apparently found..." because I assumed this code hadn't changed since the beginning, but that assumption was wrong. I now think that the "man rand" based rng was introduced in this commit: 64ca3423ac7f0f182775cf27e921dfa37f804a2a

Edit: I have now patched this in 1.12 and master, 1.12 commit was b636f3c9715d4a795df82a4435c2e5a8def81e3c
Last edited by iceiceice on April 29th, 2014, 5:11 pm, edited 2 times in total.
Reason: edited github links to point to historical states of the files

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: Luck in multiplayer

Post by AI » April 29th, 2014, 5:31 pm

Well, the algorithm asks for an unsigned long because it's guaranteed to be at least 32 bits wide. On every system wesnoth has been compiled for though, an unsigned int is also at least 32 bits wide, even if the standard doesn't guarantee that (it guarantees 16 bits).

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

Re: Luck in multiplayer

Post by iceiceice » April 29th, 2014, 6:12 pm

Ok, that's good news. (For anyone reading who doesn't know what that means, it means that this probably didn't affect any of the users.)

Still, I can't help but feel that we the devs have a little pie on our faces here. It would have been nice if before writing responses in these threads that amount to "the problem is that the human brain cannot comprehend the true nature of randomness", someone had checked the source and the specification, at some point in the last 6 years... the example in the specification is really only 4 lines of code, depending on how you count. Not that the human brain bit is wrong but I would hope people would double-check before writing that...

It's a bit unfortunate that we exposed ourselves to a possible problem like this... why don't we just use a library, instead of re-implementing source code we found in a man page?

The notes section in that man page writes:
man wrote: Notes:
The versions of rand() and srand() in the Linux C Library use the same random number generator as random(3) and srandom(3), so the lower-order bits should be as random as the higher-order bits. However, on older rand() implementations, and on current implementations on different systems, the lower-order bits are much less random than the higher-order bits. Do not use this function in applications intended to be portable when good randomness is needed. (Use random(3) instead.)

Example:
POSIX.1-2001 gives the following example of an implementation of rand() and srand(), ...
Wesnoth is an application intended to be portable, that needs good randomness. Why don't we switch to something like this instead, as suggested? http://linux.die.net/man/3/random

Edit: The commit message that introduced this rng code is:

"race should not depend on game_state.
This refactoring tries to fix that. It creates an own class for the
rng part of game_state that is used within race. This still needs to
be checked (Mordante will do that soon). If this commit causes all
kinds of weird problems (i don't think so, but you never know), feel
free to revert it."

Edit: Looking at the commit history it looks like we have actually gone on RNG bug hunts before and fixed some 3 years ago. I think some of them would still have existed whether we used a library or not, but it looks like for some of them, and for this issue, it would have helped.

Edit: Okay, this is less severe than I may seem to have implied, I guess it's likely that if someone tried to run wesnoth on a platform where unsigned ints are only 16 bits, there would be other glaring issues. But still. I've definitely read things on the forum to the effect that "I don't think there are any problems in the C random number generator code," when it looks like we weren't really using that.
Last edited by iceiceice on April 29th, 2014, 7:48 pm, edited 1 time in total.
Reason: s/bytes/bits

aquileia
Developer
Posts: 120
Joined: August 25th, 2012, 5:13 pm

Re: Luck in multiplayer

Post by aquileia » April 29th, 2014, 6:45 pm

iceiceice wrote:why don't we just use a library, instead of re-implementing source code we found in a man page?
mordante once explained to me that the behavior of e.g. std::rand() is implementation defined, so in fact portability is the reason Wesnoth implements its own RNG. There are great libraries for well-defined RNG implementations, but adding another dependency just for that...

At least that's how I understood him, I may be wrong.

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

Re: Luck in multiplayer

Post by iceiceice » April 29th, 2014, 6:49 pm

Okay, maybe rand() is like that, but the man page specifically points out random(3) as a portable alternative.

Post Reply