Inaccurate disarm chances

Discussion in 'Bugs' started by Bohandas, Mar 30, 2013.

  1. Bohandas

    Bohandas Member

    I have noticed that the displayed chances to disarm a given trap tend to differ wildly from the actual chance that the trap will be disarmed.

    For example, with a recently encountered wall trap that I supposedly had a 25% chance to disarm it took 24 tries to remove the trap. If the chance of disarming the trap were really 25% then the odds that it would take me 24 tries to disarm it would be on the order of one tenth of one percent, but in reality situations like this one crop up with frustrating regularity (and CERTAINLY much more often than one trap in every 1000)
  2. Kazeto

    Kazeto Member

    I'll just have you know that "random" does not operate the way you seem to wish it to.

    25% chance to disarm does not mean "lo, only 4 disarming attempts and it will be disarmed, and it is always disarmed after 4 attempts".
    No, it means you have 25% chance to disarm it on the first try. And if that failed, 25% chance to disarm it on the second try. And if that failed, 25% chance to disarm it on the third try. And so on, and so on, until bajilionth try, which has a 25% chance to succeed, the same as all the previous attempts.

    And there are times when you disarm a trap on the first try, even though the chance shown was something like 25~40%. If the whole thing was not truly random (yes, I know nothing is "truly" random in IT, but if anyone gets technical here to prove it I will start dealing out pain and suffering) you would not have even an inkling of a chance for that to happen unless the chance was equal to 100%.
  3. Bohandas

    Bohandas Member

    I know how this works, and I know that the odds of the kind of bad run that I regularly get are supposed to be on the order of one in a thousand* but instead they happen about one time in ten

    *(Assuming that the chance Z of a trap remaining armed after X tries with Y% chance of success is equal to {[(100-Y)/100]^X}*100=Z%)
    Kazeto likes this.
  4. mining

    mining Member

    I'm pretty sure that the Dredmor RNG is streaky / bad in some way.
    Kazeto likes this.
  5. Kazeto

    Kazeto Member

    And now comes the question of whether it only goes one way or if it also streaks the other way with some traps being disarmed on the first try regardless of their low chances.

    And sorry if I sounded condescending in my previous post. I was sort of tired when I wrote it, and I just noticed it might be taken as such.

    To be honest, all RNGs tend to be streaky unless there are counter-measures against it. It's weird and crazy, but appropriate considering how electronics work - you'd have to flush the whole thing after rolling every single number if you wanted something less streaking, and I know many programmers don't bother with that.
  6. mining

    mining Member

    And that's the irony of it, lol.

    Your PRNG is always shit, its just how the shittyness is apparent to players :).
    Kazeto likes this.
  7. r_b_bergstrom

    r_b_bergstrom Will Mod for Digglebucks

    Your formula is correct... though the final number it generates is actually it's more like 1 in 750 than 1 in 1,000. Either way, that specific event should be exceedingly rare. Problem is that common sense can actually be misleading here, and cause us to find fault way before anything strange has actually happened, and some things that seem like they should be rare are actually pretty common.

    When the 25% disarm chance trap takes 10 attempts to disarm, that starts to feel like something's gone wrong... but it's not actually abnormal at all. The odds of it taking 10 or more attempts to disarm such a trap is roughly 7.5%. One out of every 13 such traps should take 10 or more attempts. Which isn't too far off from the "about one time in ten" that you described.

    Going Rogue generates 70 traps per floor (so more than a thousand by the time you reach Dredmor). If you're clicking on the traps that have 25% disarm chance, you should expect to get 3 to 6 traps each floor that feel wonky.

    Even if your disarm rate is 40%, each individual trap has a better than 1% chance of taking 10 or more disarm attempts. On GR, you should average about 2 such annoying traps per 3 floors.
    Null, SkyMuffin, Kazeto and 1 other person like this.
  8. r_b_bergstrom

    r_b_bergstrom Will Mod for Digglebucks

    Oops. Double post. See above.
    Kazeto and mining like this.
  9. dbaumgart

    dbaumgart Art Director Staff Member

    That's a really good explanation Bergstrom!

    (... and it is why perhaps if we were to do such a thing again we might not just do straight-up percent chances for success, but rather start tipping odds one way or another & give feedback that the player's additional effort is either helping or hindering what they're trying to accomplish. Actual randomness just doesn't feel very intuitive or responsive.)
    SkyMuffin and Kazeto like this.
  10. Kaidelong

    Kaidelong Member

    The dredmor PRNG does have a bit of a problem. Savegames should have a fixed random seed and a single RNG state that has to be passed to all computations needing a random number (if they don't already). The refactoring that'd go into implementing that may well fix many of the problems.

    (This is based on reports of people always tending to get the same item spawns game to game to game, IE seeing staves of godewijn all the time but never seeing a hexaxe of the magic axelords)

  11. Imo, Actual randomness has no place in almost any video game, period. What makes it palatable in Dredmor is that it's a single-player "rogue-like" - dying to the whims of the RNG is arguably part of the experience. That's probably the only case that "could" justify actual randomness over pseudo-random rolls (for those that don't know, that's a mechanic that adds to the chance of success every miss, and removes from it every hit).

    In a PvP context, pseudo-random is pretty much the only way to go because actual randomness takes skill out the equation. A simple example would be two players with identical builds fighting it out. You expect, in this situation, the better player to win. Assuming they both have a crit/chance to hit mechanics though, luck becomes a huge factor. Take a 50% chance of crit - there's a chance that one in every sixteen game with feature one player getting two crits in a row, while the other player gets none (1/4 x 1/4 = 1/16). When you consider that as a percentage chance, it's fairly likely that if you play 4 games, you'll see it happen (25% of seeing it happen, actually). If it happens in two games in row for any one player, all you can do is shrug and/or explain the maths. In practice though, no one wants to invest hours building up a character only to leave everything up to luck. People who like that kind of thing play actual "games of luck" instead of video games. Our modern appreciation of video games is that luck is interesting as a mechanic, but should not trump skill.
    I am not speaking out of personal preference here, but based on actual experience. If you look at the feat list in D&D rulebooks, and what adding points to any given "skill" does in practice, you'll see that for the most part, it's aimed at "taking randomness out of the equation". A high-level fighter doesn't perform better in melee compared to low level one because he hits that much harder, but rather because his feats and skill levels rig the combat rolls in his favor. Many feats give you free re-rolls if you miss the first one (you usually see that for rogues though). In practice, it won't give you that much of a bigger chance of winning an unlikely roll (if you miss something you had 10% chance of hitting, it only gives you an extra 1% chance of getting it), but it does give you a much bigger chance of NOT FAILING a likely roll (A second roll if you miss something you had a 90% chance of hitting will raise the net odds of you winning to 99%). And that's in the "truly random" die-based pen and paper iterations of the game.
    Looking at a more contemporary example, all MOBA types use pseudo-random generators, precisely because you want skill, rather than luck, to be the deciding factor in a PvP environment, and considering the millions of players behind DotA and LoL, it's hard to argue that the pseudo-random mechanic has more negatives than pluses.

    What about a non-PvP context then? Well, in this case, the big arguments, even in a game with punishing difficulty, areopportunity cost and fairness.
    Opportunity cost (economic theory - essentially, time spent doing X is time not spent doing Y, therefore the real cost of doing X is the cost of doing X + the cost of not doing Y) first - If i have a 10% chance of achieving X, and i decide to expend 10 actions to make X happen, then X MUST happen on one of those ten tries. Why? Because otherwise, i'm just better off using those 10 actions doing something else. In a truly "random" environment, players often end up in a situation where they simply avoid anything they don't have 100% chance of achieving. That's, btw, how i approach DoD - unless i have 100% trap clearance, and/or the trap will do no damage to me, I simply leave it alone. That's bad from a gaming point of view, because you want to reward players who take "reasonable" risks. However, with a truly "random" system there is no such thing as a "reasonable" risk, because all risks are "random".
    This ties in to the notion of "fairness". A truly random generator will let a player with a 10% chance of achieving X get 2 instances of X in a row, while leaving the 90% player with 2 misses in a row. In practice, that's not 'fair', because you typically don't get good odds of achieving something without a MAJOR investment of stat points. Your normal assumption is that players are "intelligent" i.e. they'll take all the bits and pieces you throw at them and build a game plan of sorts. If your game is rife with "randomly decided outcomes" then what you'll see is that players start planning their way around those probabilities. That's good, and you want to reward that. However, if you have a truly random system, then you actually have to hedge your bets to make it work. Classic DoD example - disarming an acid trap with a 40% chance of success. Say i can tank 5-6 hits before i die, i'm inclined to think, i can risk trying three times, knowing that disarming this trap will take, at most 1/2 of my hp. That's my plan. Yes, there is a risk factor, but no one would call it a bad plan. Normally though, that's the only thing i should have had to worry about. With a true RNG, I actually have to think, on top of that, "what if i try 3 times and fail all three, can I afford that kind of loss for no gains at all?". The answer to that is generally no. So instead of investing points into stats that take my odds of disarming the trap from 10% to 40%, i'm almost always better off grabbing stats that make me immune/very resistant to the trap itself, then spam clicking on the zero damage trap until i disarm it. Is that the kind of play we want to encourage? I'd think not.

    So yes, true RNG creates a harsh game system, and we can all agree that modern video games don't have enough of that these days. However, what we should be striving for is "harsh but fair", not "harsh because it's completely random". There are plenty of good examples of how to implement "harsh but fair" mechanics out there, including the Dark/Demon Souls games.
    Kazeto likes this.
  12. Bohandas

    Bohandas Member

    I thought "Pseudo random" simply referred to the fact that you can't generate truly random numbers with a mathematical algorithm
    Null, mining and Kazeto like this.
  13. Kaidelong

    Kaidelong Member

    You can get pretty close though, in practice dredmor's PRNG shouldn't appear streaky or biased according to the viewpoint of the player.

    Also All ur lutes R belong to me, the effects of a fair random number generator should be predictable on the long term if you think probabalistically, and adding some situations where things do not go exactly as planned forces you to keep backup plans. That is exactly what should be encouraged.

    Look at Smogon, for example, where skilled players can routinely be defeated because they are overly unlucky. Skill still gets empathized overall.

    Or poker, for that matter.
    Kazeto likes this.
  14. Kazeto

    Kazeto Member

    And all that having been said (seriously, thanks for the rant, AllurlewtsRbelongtome), I think the way to go in this case would be to rig the "RNG" in Dungeons of Dredmor (or at least in your future games, if you decide not to dabble with DoD's innards for that) so that whenever the player failed to disarm a trap, his chance to disarm any subsequent trap would be raised, either by a flat amount (5% sounds good, though some people likely would want for it to be 10% or so, or simply make the value editable by loading it from a file; with a hard limit of 95% disarm chance and another limit of 30% or 50% increase, whichever works better) or by a percentage of the base disarm change (10% of it would seem good, with a hard limit of 95% disarm chance and likely another hard limit of 100% increase), with the "bonus" being reset to nil when player succeeded at disarming a trap.
    SkyMuffin and mining like this.
  15. SkyMuffin

    SkyMuffin Member

    The problem is that statistically, random numbers would occasionally give you streaks (as explained by Bergstrom). Just because the player sees it as "unfair" doesn't mean it actually is; those 2-3 finicky traps per floor will always stand out simply by taking up more time and possibly damaging the player. And most people don't understand that probabilities are not additive, with chances for a "hit" staying exactly the same for each successive attempt. Lots of people see "luck" as an organic or metaphysical entity with inclinations and feelings...obviously, randomness doesn't work that way.

    Kazeto likes this.
  16. Apologies on that, i meant "pseudo random PRNG" in the "rigged PRNG" sense. However, it was too much of a pain to make the distinction, so I just let it slip and hoped no one would get confused. As far as technical terms are concerned, you've got the right definition.

    It would actually have to reset to lower than 10%, otherwise that would effectively mean that you have far more than a 10% chance of getting what you want.
    Consider this example with a base of 50%
    What we want to guarantee is that 1 attempt in 2 results in a success (i.e. if you miss, you should have a 100% chance of getting the next one)
    let's look at 2 attempts
    in the first 1, you miss
    that means that for attempt 2, you get a guaranteed win
    however, what if you win a roll outright? you still get a 50% of winning the next roll.
    You end up with something like this - because of the guaranteed win system, every 2 attempts you make has a 25% of getting it right both times, a 25% chance of getting it right the first time, and missing the second one, and 50% chance of missing the first, and getting the second (because if you miss the first one, you're guaranteed a hit on the next one).
    So if you put it together, how many times do we expect to see you succeed for every 2 attempts you make - (0.25 x 2, 0.25 x 1, 0.5 x 1 = 1.25). That means you'll effectively have a 1.25/2 = 5/8 chance, instead of a 4/8 chance of seeing something happen. Depending on how valuable the outcome of that roll is (e.g. a crit), then you end up with stats that are far more valuable in practice than they should be on paper. Ideally, you want to drop the base odd after getting the positive outcome, but it seems far simpler to just balance the stats while keeping in mind that the odds are better than they sound (e.g. if you have an ability that gives a 50% chance of doubling your damage, you can assess how late you want to give players access to it based on the premise it adds a bit more than an extra (+0.5 x 1) to your base damage).
    Kazeto likes this.
  17. mining

    mining Member

    Kazeto likes this.
  18. Kazeto

    Kazeto Member

    Yes, I know. But people complain, and AllurlewtsRbelongtome made a point on it. Which is why I proposed that.
    But thanks for the explanation nonetheless - the less computer-savvy users likely learned something from you just now.

    The details can always be fine-tuned. And there's nothing saying it can't go both ways, with negative modifier as well as a positive one.

    The point is to get the base for it working, and then the fun starts.
  19. r_b_bergstrom

    r_b_bergstrom Will Mod for Digglebucks

    I'm skeptical of that whole paragraph. To present D&D as an example of "taking randomness out of the equation" sounds hollow to me.

    A quick glance through my 3rd, 3.5 and 4th edition Player's Handbooks reveals very few "reroll" Feats, and an awful lot of "+1" or "+2" Feats. Which, given that it's a d20-based system, is just adding +5% to +10% to your success odds. You can get big bonuses to Skills and Attack rolls over time by accumulating all these little modifiers, so a high-level character might have +25 in stacked bonuses to some particular roll... but that's still a final result of anywhere from 26 to 45! Lots of random variance.

    If the target numbers for those rolls were constant at all levels, then that steady accumulation of bonuses could be viewed as "taking randomness out of the equation" _eventually_, but in practice those target numbers just keep rising. Goblins get replaced by Orcs, which get replaced by Bugbears, which get replaced by Half-Dragon Infernal Dire Bugbears, which then add a few levels of Barbarian and put on magic armor, etc. In 3.X anyway, you'd often see high-level Fighters making 3 or 4 attack rolls a turn, but only 1 (rarely 2) of those rolls would have a better than 50-50 shot at hitting, the others were "hail mary passes" in need of a lucky die roll to succeed. That fighter could clear the room of low-level mooks when the opportunity presented itself, but the typical encounter was leveling up right with him and getting harder-to-hit at a rate just slightly behind his to-hit bonus. You come out slightly ahead over time (BAB advances faster than AC), but it's still very much luck-dependent.

    While those examples are combat- and to-hit- based, the same holds true throughout other aspects of D&D. Saving Throw DCs keep going up, and the results of a failure get much worse. The simple covered-pit and crossbow-in-the-wall traps get slowly rotated out in favor of magical traps that have progressively higher target numbers to disarm. You can't "Take 20" on a Disable Device check vs a Trap, because the consequence of failure is to take damage. It's pretty much exactly what you see in Dredmor.

    The difference, I guess, is that you wouldn't stand around poking the same trap 15 times in a tabletop game. Not because the rules prevent it, but because the other players would start giving you a hard time. That very thing happened last week at my table, with one PC hilariously blowing the same die roll three times in a row (repeatedly falling out of a boat and climbing back on board) until the rest of the party more or less peer-pressured her into doing something different for round four. Dredmor doesn't need "better" math, it just needs to laugh at you when you click on the same trap a fourth time.
  20. Bohandas

    Bohandas Member

    BTW, for anybody wondering, I'd like to preemptively clarify that the feat system was introduced in the third edition so the lack of 1st and 2nd edition references is not relevant to the argument.
    Kazeto likes this.