Do spell percentages ever lie?


Ask fellow adventurers how to stay alive in the deep, dark, dangerous dungeon below, or share your own accumulated wisdom.

Shoals Surfer

Posts: 259

Joined: Saturday, 7th February 2015, 14:46

Post Saturday, 20th August 2016, 10:00

Do spell percentages ever lie?

I just miscast Controlled Blink 4 times in a row, at 4% failure (entering a new Pan floor, dropped into the middle of the action. Turned out OK).

That has odds of 1 in 390,625. Or, more likely, there was something at work I didn't understand. So - is there any hidden effect that can make spellcasting success lower than displayed on the spells screen?
http://crawl.akrasiac.org/scoring/players/odds

Won my last species (Mummy) on 17/01/2016.
Won my last background (Arcane Marksman) on 06/09/2016.
User avatar

Tartarus Sorceror

Posts: 1762

Joined: Monday, 14th October 2013, 01:05

Post Saturday, 20th August 2016, 10:15

Re: Do spell percentages ever lie?

In a truly random system, freak sequences of results happen. It feels weird to us, and humans tend to look at these repeated sequences as not truly random, or somehow influenced. For example, if you flip a coin ten times in a row and get heads all 10 times, that feels extremely weird-this coin must be weighted! But all the other coinflips you get throughout your life aren't taken into account with this, and if you looked at all those hundreds of times, one streak of 10 heads wouldn't move the average number of heads coinflips away from 50%, and over the greater course of "total coinflips ever" is not even a blip on the radar. In that same vein, have you looked at all the times you've cast controlled blink successfully, instead of just this one streak with a really small sample size? The bigger the sample size, the closer you get towards accurate percents-and 4 is a tiny sample size. Moreover, it's really part of a larger set, which is "all the times you have cast controlled blink", not just "the 4 times it went wrong".
This is part of why humans are really bad at "creating" random samples-when we are given a task like "take these 100 blue and red balls, and place them in a horizontal line under these cups, randomly distributed", people tend to do things like try and avoid placing too many balls of the same color in a row. "Oh, I already placed 7 red balls, I need to place a red one now, because it's random. There can't be 8 red in a row." But that's not how randomness works, long unbroken 'unlikely' sequences will randomly happen if the selection process is truely random. Avoiding creating long sequences is itself an ordered pattern, and the shorter a sequence you count as "unacceptably" long, the more ordered the pattern becomes-for example, refusing to place 4 red balls in a row instead of 8 makes the pattern more consistent, and more predictable. But humans are prone to this, because we're pattern based creatures, so sometimes in a random set we'll 'find' a pattern and think it cannot really be random.

What I'm saying is, it sounds like you just got unlucky.
Last edited by Shard1697 on Saturday, 20th August 2016, 10:28, edited 1 time in total.

For this message the author Shard1697 has received thanks:
vergil
User avatar

Vaults Vanquisher

Posts: 510

Joined: Friday, 1st July 2016, 22:32

Location: Aachen, Germany

Post Saturday, 20th August 2016, 10:27

Re: Do spell percentages ever lie?

Shoals Surfer

Posts: 259

Joined: Saturday, 7th February 2015, 14:46

Post Saturday, 20th August 2016, 10:37

Re: Do spell percentages ever lie?

Yes, I understand that - but that explanation breaks down for sufficiently unlikely events. The reason I ask here is that the particular event is so unlikely that I wouldn't expect to see it *ever* in a long career playing Crawl. If I cast one spell with 4% failure every ten seconds, and retry every failed spell until it works, to fail 4 times in a row should take me 1100 hours of playing time. I'm all for trusting RNGs, but if you pick up a new coin and your first 19 flips land heads (which is the equivalent here), it's time to question whether your coin is fair.
http://crawl.akrasiac.org/scoring/players/odds

Won my last species (Mummy) on 17/01/2016.
Won my last background (Arcane Marksman) on 06/09/2016.

For this message the author Odds has received thanks:
Rast
User avatar

Tartarus Sorceror

Posts: 1762

Joined: Monday, 14th October 2013, 01:05

Post Saturday, 20th August 2016, 10:42

Re: Do spell percentages ever lie?

You're not the only crawl player, though. If you're saying "this is only likely to happen within 1100 hours of playtime, and I don't have that much"(well, you're talking about constantly casting it, but bear with me), what about this happening to 1 of 2 players with 550 hours of playtime each? 1 of 4 players with 275 hours of playtime each, etc? Of course, people aren't constantly casting cBlink every 10 seconds, but there's been a lot of crawl players playing a lot of crawl for years. In that system, something like this is much more likely to happen than looking at you in a vacuum, and someone has to be the guy who gets the short end of the stick-just wound up being you.

This isn't to say that it's impossible that there's some fuckup in crawl's code, but in this case I doubt it.
User avatar

Tartarus Sorceror

Posts: 1698

Joined: Saturday, 18th June 2016, 13:57

Post Saturday, 20th August 2016, 10:51

Re: Do spell percentages ever lie?

Trying to cast a spell at 34% failure rate can bring to a 5 fail - 1 succeed - 4 fail series. Trying to use a 71% failure ability can bring to 15 consecutive fails.
Failing a 4% spell 4 times is somewhat more difficult than getting 4 twenties on a d20. It is rare, but not impossible. Triple twenties are a chance, to the point that D&D 3.5 had special rules for this case. A game of Crawl has much more dice rolling, so weird things will happen more often. You now got a 1/390,625 series, but I wonder how many throws are made during a game. It would be fun to have them counted.
BTW, a 4% spell should have a 1/25 spell failure chance. If you use the spell often, you will see it happening a lot, although maybe not 4 times in a row. I wouldn't consider it dependable, anyway.

There's also the fact that any result is actually equally rare, and that they have special meaning because of us, but any series is very unusual, although far from impossible. If you get a few friends to play dice, you will notice. And this probably has something to do with certain divination techniques that let the little stones or bones speak, because we give them so much meaning, that we actually imagine them to mean something independently from us.
I Feel the Need--the Need for Beer
Spoiler: show
3DSBeTr 15DSFiRu 3DSMoNe 3FoHuGo 3TrArOk 3HOFEVe 3MfGlOk 4GrEEVe 3BaIEChei 3HuMoOka 3MiWnQaz 3VSFiAsh 3DrTmMakh 3DSCKXom 3OgMoOka 3NaFiOka 3FoFiOka 3MuFEVeh 3CeHuOka 3TrMoTSO 3DEFESif 3DSMoOka 3DSFiOka

Shoals Surfer

Posts: 259

Joined: Saturday, 7th February 2015, 14:46

Post Saturday, 20th August 2016, 11:09

Re: Do spell percentages ever lie?

You're not the only crawl player, though. If you're saying "this is only likely to happen within 1100 hours of playtime, and I don't have that much"(well, you're talking about constantly casting it, but bear with me), what about this happening to 1 of 2 players with 550 hours of playtime each? 1 of 4 players with 275 hours of playtime each, etc? Of course, people aren't constantly casting cBlink every 10 seconds, but there's been a lot of crawl players playing a lot of crawl for years. In that system, something like this is much more likely to happen than looking at you in a vacuum, and someone has to be the guy who gets the short end of the stick-just wound up being you.

This isn't to say that it's impossible that there's some fuckup in crawl's code, but in this case I doubt it.

Sure. That 1100 is probably 10-100 times too low (the assumptions are absurd), but this isn't in the realms of "this should never happen to any crawl player ever". If my experience is very rare, and there's no known reason for it, then yeah, it was probably luck.

Nevertheless, when you see that unlikely an event it's rational to initially suspect there is a game mechanic you don't fully understand (or a bug). Without some very serious knowledge of the system, it's a more likely explanation than randomness. Even after the lack of anyone here knowing about it, what are the odds that there's a fairly recent bug in spell percentages? What are the odds that the current people looking at this thread don't know about that bug? If each of those is 1%, it's a more likely explanation for what I've seen this morning.

@Shtopit: there are lots of chances for unlikely events, sure. But its not really right to count them all - the game hasn't had that many chance for *interesting* sequences of chance 1/400,000. That's important for the same reason that if you get a sequence of 20 heads on a coin, you should sit up and take notice - but most other sequences you should be happy to accept as "probably random", even though they are all equally likely.
(And yeah, I don't consider a 4% failure chance reliable. On Controlled Blink particularly, that's not an acceptable failure rate, since many uses of the spell are critical.)
http://crawl.akrasiac.org/scoring/players/odds

Won my last species (Mummy) on 17/01/2016.
Won my last background (Arcane Marksman) on 06/09/2016.
User avatar

Blades Runner

Posts: 546

Joined: Friday, 2nd October 2015, 14:42

Post Saturday, 20th August 2016, 11:17

Re: Do spell percentages ever lie?

I would not be surprised if an error in computing these percentages is discovered someday. Until someone posts a proof of the correctness of the code, I reserve judgment on the veracity of the numbers produced. I agree that the numbers don't jibe with intuition about how often streaks of miscasts and so on should happen.

e: One thing that strikes me about it is that I've played other roguelikes that have spell failure and I don't recall having often felt I was getting more spell failures than I would expect based on the reported fail rates. I would also say that crawl has unusually complex formulas that take a large number of factors into account.
The Original Discourse Respecter

Lair Larrikin

Posts: 25

Joined: Friday, 23rd May 2014, 07:12

Post Saturday, 20th August 2016, 12:24

Re: Do spell percentages ever lie?

Odds wrote:Yes, I understand that - but that explanation breaks down for sufficiently unlikely events. The reason I ask here is that the particular event is so unlikely that I wouldn't expect to see it *ever* in a long career playing Crawl.


"Unlikely" events happen all the time. This one in particular stood out for you, and that's reasonable; miscasting a spell four times in a row in a crucial situation is memorable. But what about the D:1 layout you got this game? Surely the probability of getting that exact layout is exceedingly small? Or perhaps look at the last 100 to-hit rolls; what are the chances that exact sequence occurs? But those examples are not interesting, so you didn't give a second thought about how unlikely the current distribution of consumables you have encountered is, or how that shop is selling that exact list of items, etc. It is possible that there is something wrong with the code, but I don't think this singular observation shows anything. If you are skeptical about the displayed spell failure percentage, you could go into wizmode and cast a spell many times, and analyze the resulting string of success/failures.

goodcoolguy wrote:Until someone posts a proof of the correctness of the code, I reserve judgment on the veracity of the numbers produced.


Even if the code is correct, I'm not sure how you can be satisfied. What exactly do you envision a "proof of correctness" to be?

For this message the author Category has received thanks:
cerebovssquire
User avatar

Zot Zealot

Posts: 982

Joined: Monday, 29th September 2014, 09:04

Post Saturday, 20th August 2016, 12:38

Re: Do spell percentages ever lie?

You can see the code that calculates spell failure rate here:

https://github.com/crawl/crawl/blob/871 ... t.cc#L2022

You probably also want to understand how random2avg works:

https://github.com/crawl/crawl/blob/mas ... om.cc#L227

For this message the author chequers has received thanks: 2
cerebovssquire, Odds

Shoals Surfer

Posts: 259

Joined: Saturday, 7th February 2015, 14:46

Post Saturday, 20th August 2016, 12:48

Re: Do spell percentages ever lie?

This thread is quite interesting.

Category wrote:"Unlikely" events happen all the time. This one in particular stood out for you, and that's reasonable; miscasting a spell four times in a row in a crucial situation is memorable. But what about the D:1 layout you got this game? Surely the probability of getting that exact layout is exceedingly small? Or perhaps look at the last 100 to-hit rolls; what are the chances that exact sequence occurs? But those examples are not interesting, so you didn't give a second thought about how unlikely the current distribution of consumables you have encountered is, or how that shop is selling that exact list of items, etc. It is possible that there is something wrong with the code, but I don't think this singular observation shows anything. If you are skeptical about the displayed spell failure percentage, you could go into wizmode and cast a spell many times, and analyze the resulting string of success/failures.

So, I don't think this is the right way to look at things. Yes, the game has much more unlikely things. But there's a difference between "unlikely and boring" and "unlikely and interesting", and it matters.

To illustrate this - if we play poker all evening, and I get two aces every hand, you will rightly conclude I'm cheating. If I get a random-looking (but just as unlikely) sequence of hands, you will conclude that the hands are probably random. That's because the evening with the aces, while just as *unlikely*, is more *interesting*.

Similarly - I didn't notice the D:1 layout. Sure, it was unlikely - but that doesn't make my sequence of miscasts less surprising. What *does* make it less surprising is the other opportunities for "interesting and unlikely" events that didn't happen in the game. Most obviously, other sequences of miscasts that would have stood out. There might be some others - though since I don't know any details of melee or generation, and don't see any percentages, there aren't actually too many other examples that could be as surprising.

To put things another way, your argument is a catch-all argument that *any* event in Crawl is expected and doesn't show anything is up. I think my sequence of 4 miscasts was quite likely a coincidence. But suppose it was 10 miscasts. That has odds of 1 in 10^14 - so it should never happen during any game of crawl. If anyone ever sees 10 miscasts in a row at 4%, we should immediately conclude crawl is bugged. Your argument would say that because a D:1 layout is way less likely than 1 in 10^14, we should ignore it. And that can't possibly be right.
http://crawl.akrasiac.org/scoring/players/odds

Won my last species (Mummy) on 17/01/2016.
Won my last background (Arcane Marksman) on 06/09/2016.

Dungeon Master

Posts: 388

Joined: Monday, 18th August 2014, 20:04

Post Saturday, 20th August 2016, 12:50

Re: Do spell percentages ever lie?

If you really are worried, you can do the following: go into wizmode, create a character that is as identical as possible, and then pick a large enough number (beforehand) like 100, and cast cblink that many times. If this diverges from the percentage substantially, then there's something to worry about. I've done this on a few cases where I hit seemingly unlikely events, but with a large enough sample I've always found the expected behavior in aggregate. I also at that time audited the relevant random code myself, not that I'm an expert in randomization, but it's a pretty straightforward code path to look at for most particular percentages. (There's just a lot of different ways things can be randomized).

Humans are very bad at judging randomness.

For this message the author advil has received thanks: 3
Arrhythmia, cerebovssquire, ydeve

Shoals Surfer

Posts: 259

Joined: Saturday, 7th February 2015, 14:46

Post Saturday, 20th August 2016, 12:50

Re: Do spell percentages ever lie?

chequers wrote:You can see the code that calculates spell failure rate here:

https://github.com/crawl/crawl/blob/871 ... t.cc#L2022

You probably also want to understand how random2avg works:

https://github.com/crawl/crawl/blob/mas ... om.cc#L227

Thanks! What is the value that gets displayed for spell success - is it the "raw_fail" variable in that first link?

EDIT: no, presumably it's the output of "get_true_fail_rate".
http://crawl.akrasiac.org/scoring/players/odds

Won my last species (Mummy) on 17/01/2016.
Won my last background (Arcane Marksman) on 06/09/2016.
User avatar

Blades Runner

Posts: 546

Joined: Friday, 2nd October 2015, 14:42

Post Saturday, 20th August 2016, 13:00

Re: Do spell percentages ever lie?

Category wrote:Even if the code is correct, I'm not sure how you can be satisfied. What exactly do you envision a "proof of correctness" to be?


I mean a mathematical proof that the program does what it's claimed it does, assuming the correctness of the compiler and the operations performed by the host machine. In other words, the usual definition of "proof of correctness" for computer programs.

edit: I too have looked at the code and I have not seen anything there I thought was particularly fishy, other than that the formulas are moderately complicated. Since complaints about this issue usually center around perceptions of correlation, one thing to look at is whether there's some hidden correlation between rolls.

edit 2: I'm going to go ahead and say something crazy here. Maybe, instead of using a complicated randomization formula like 1d102 + 1d101 + 1d100 - 3 or whatever it is and then trying to invert its cumulative distribution function or whatever is going on there (it's been a while), maybe -- just maybe, mind you -- the complicated formulas based on int, str, spellcasting and school skills, armor encumbrance, the phase of the moon, etc. should just put out a number that a single roll of 1dX has to beat. Wild idea, I know.
Last edited by goodcoolguy on Saturday, 20th August 2016, 14:24, edited 1 time in total.
The Original Discourse Respecter

Lair Larrikin

Posts: 25

Joined: Friday, 23rd May 2014, 07:12

Post Saturday, 20th August 2016, 14:23

Re: Do spell percentages ever lie?

Odds wrote:But there's a difference between "unlikely and boring" and "unlikely and interesting", and it matters.


I think we agree here, though this particular statement makes me feel uneasy, since "boring" and "interesting" are not well-defined. The main issue I had was your claim that the event suggests something is wrong with the code solely due to how unlikely it was, which is why I presented examples of similarly unlikely events that we would not consider to be indicative of bad code.

The problem here is that we have one known probability: given that the code works, what is the probability that the spell miscasts four times in a row? (0.04^4) Here we see that the miscast event happened, and we want to know how much this supports the notion that the code is not working as intended; intuitively it feels that the more unlikely the event, the more it points towards the code being broken, and that's not completely true. If we try to apply Bayes', we'll have to deal with nebulous variables like "what is the probability the code is right" and "if the code is broken, what is the probability we get quadruple miscasts".

So for the poker example, I would be more inclined to suspect cheating against aces than random hands since if you are going to cheat, you probably are going to make your hand good. The crawl code does not have such motives, but perhaps it is easy to mess up the code in a manner that would cause miscast chains to happen more. In the same way, if we had some random-looking sequence of spell failure/successes that come up to the same probability as four failures, we don't regard this as evidence of a bug as we would expect something more spectacular out of a bug. Whether this is correct, I don't know; these things are basically impossible to quantify, leaving us to human intuition, which is pretty bad at this stuff.

For what it's worth, a fun anecdote: I once miscasted fire storm four times in a row at <5% fail. I ate a few torments and was in a pretty bad spot, but the fourth miscast created a smoke cloud, allowing me to teleport away without taking more damage.

goodcoolguy wrote:I mean a mathematical proof that the program does what it's claimed it does, assuming the correctness of the compiler and the operations performed by the host machine. In other words, the usual definition of "proof of correctness" for computer programs.


If by this you mean "take the code as written, and via some formal system of axioms, show that it is equivalent to this simpler statement that summarizes what we think it does", this is hard to do for all but the simplest of programs. If you just want to convince yourself the code works, the best way is just to read it yourself and try to understand it, since any proof that it works will be longer and harder to understand than the code itself.
User avatar

Blades Runner

Posts: 546

Joined: Friday, 2nd October 2015, 14:42

Post Saturday, 20th August 2016, 14:25

Re: Do spell percentages ever lie?

I agree that it is hard to prove the correctness of programs, yet people do it and I will not be satisfied with less in this case.

e: Actually, I would be satisfied with a comprehensive suite of simulations that includes autocorrelation analysis.
The Original Discourse Respecter
User avatar

Abyss Ambulator

Posts: 1194

Joined: Friday, 18th April 2014, 01:41

Post Saturday, 20th August 2016, 14:33

Re: Do spell percentages ever lie?

Probably not but I remember the guy who made dcss-ca saying that the spell failure rates were calculated wrong once and they were way higher in that fork.
remove food

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Saturday, 20th August 2016, 14:45

Re: Do spell percentages ever lie?

tabstorm wrote:Probably not but I remember the guy who made dcss-ca saying that the spell failure rates were calculated wrong once and they were way higher in that fork.


Then the guy told that he was wrong, crawl devs explained to him how it works and he agreed that there are no bugs in that code. So I am pretty sure spell failure rate display is correct.
As anecdote, I got 3 miscasts in a row with 1% Necromutation so 0.0001% events do happen sometimes.
User avatar

Blades Runner

Posts: 546

Joined: Friday, 2nd October 2015, 14:42

Post Saturday, 20th August 2016, 15:12

Re: Do spell percentages ever lie?

In my opinion, belief that output of a pseudorandom number generator no more sophisticated than the one in glibc fed through a formula involving an average of 3 random numbers after performing modular division to 3 different bases with unrelated prime factorizations produces a statistically random sequence is no less magical thinking than the gut feeling people have that the numbers aren't right.
The Original Discourse Respecter
User avatar

Spider Stomper

Posts: 216

Joined: Monday, 1st April 2013, 04:41

Location: TX

Post Saturday, 20th August 2016, 15:15

Re: Do spell percentages ever lie?

I'll never forget the old adage I was told when I was learning how to play by watching webtiles.

"33% is 50% and 50% is 100%."
take it easy

For this message the author Cheibrodos has received thanks: 2
Arrhythmia, ydeve

Shoals Surfer

Posts: 259

Joined: Saturday, 7th February 2015, 14:46

Post Saturday, 20th August 2016, 17:02

Re: Do spell percentages ever lie?

Category wrote:
Odds wrote:But there's a difference between "unlikely and boring" and "unlikely and interesting", and it matters.


I think we agree here, though this particular statement makes me feel uneasy, since "boring" and "interesting" are not well-defined.

It makes me uneasy too, but I think it's correct :)

Category wrote:So for the poker example, I would be more inclined to suspect cheating against aces than random hands since if you are going to cheat, you probably are going to make your hand good. The crawl code does not have such motives, but perhaps it is easy to mess up the code in a manner that would cause miscast chains to happen more. In the same way, if we had some random-looking sequence of spell failure/successes that come up to the same probability as four failures, we don't regard this as evidence of a bug as we would expect something more spectacular out of a bug. Whether this is correct, I don't know; these things are basically impossible to quantify, leaving us to human intuition, which is pretty bad at this stuff.

To quantify this for simple cases (like number of miscasts), you can define results on some simple scale (%age of miscasts), and ask "what is the chance of a result at least this extreme"? That gives a fairly well-defined sense in which four miscasts (or four hundred successes) is surprising, while a random-looking sequence isn't.

I agree with everything you said about the difficulties of analysing what I should actually believe after seeing 4 miscasts at 4% - it's hard to guess the probability of seeing this due to a bug in the code (as Bayes demands). FWIW, with this not being a feature (which was my original reason for posting here), and the code looking pretty convincing, I now believe I just saw a 1 in 400,000 event. Glad I survived it :)
http://crawl.akrasiac.org/scoring/players/odds

Won my last species (Mummy) on 17/01/2016.
Won my last background (Arcane Marksman) on 06/09/2016.
User avatar

Tartarus Sorceror

Posts: 1891

Joined: Monday, 1st April 2013, 04:41

Location: Toronto, Canada

Post Saturday, 20th August 2016, 20:53

Re: Do spell percentages ever lie?

I think gammafunk was convinced that spell failure lied for the longest time, but I don't know if his opinion's changed.
take it easy

Spider Stomper

Posts: 201

Joined: Thursday, 16th July 2015, 21:47

Post Saturday, 20th August 2016, 23:12

Re: Do spell percentages ever lie?

I don't believe them either. Every once in a while I get tempted to keep statistics, but it requires too much discipline and I feel sure that some other nerd already has compiled 10,000 castings' worth already.
User avatar

Tomb Titivator

Posts: 911

Joined: Thursday, 17th December 2015, 02:36

Post Saturday, 20th August 2016, 23:59

Re: Do spell percentages ever lie?

goodcoolguy wrote:edit 2: I'm going to go ahead and say something crazy here. Maybe, instead of using a complicated randomization formula like 1d102 + 1d101 + 1d100 - 3 or whatever it is and then trying to invert its cumulative distribution function or whatever is going on there (it's been a while), maybe -- just maybe, mind you -- the complicated formulas based on int, str, spellcasting and school skills, armor encumbrance, the phase of the moon, etc. should just put out a number that a single roll of 1dX has to beat. Wild idea, I know.

Potential bugs aside, this could easily be done and would have literally zero impact on the game. Because however it's done, at some point, it's just a binary distribution, a loaded coinflip. EG If miscast chance is 5% then cast the spell if 1d100>5. By contrast, you can't do the same with e.g. melee damage, because the melee damage formula does a whole lot of dice rolls and adds them up to a distribution quite different than 1dX.

Ziggurat Zagger

Posts: 6454

Joined: Tuesday, 30th October 2012, 19:06

Post Sunday, 21st August 2016, 01:17

Re: Do spell percentages ever lie?

HardboiledGargoyle wrote:
goodcoolguy wrote:edit 2: I'm going to go ahead and say something crazy here. Maybe, instead of using a complicated randomization formula like 1d102 + 1d101 + 1d100 - 3 or whatever it is and then trying to invert its cumulative distribution function or whatever is going on there (it's been a while), maybe -- just maybe, mind you -- the complicated formulas based on int, str, spellcasting and school skills, armor encumbrance, the phase of the moon, etc. should just put out a number that a single roll of 1dX has to beat. Wild idea, I know.

Potential bugs aside, this could easily be done and would have literally zero impact on the game. Because however it's done, at some point, it's just a binary distribution, a loaded coinflip. If miscast chance is 5% then cast the spell if 1d100>5. By contrast, you can't do the same with e.g. melee damage, because the melee damage formula does a whole lot of dice rolls and adds them up to a distribution quite different than 1dX.


The current roll *is* simplified, converting it from the current formula (roughly 3d100/3>X) to an equivalent 1d100>X just adds an extra step to the existing process for no gain. There's literally nothing gained other than extra steps and the ability for someone to point to a place in the code where it's rolled and say "hey that's a percentage chance of something happening"

If you want to talk about *changing the distribution* that's different from simply converting the existing derived percentages to rolls, among other things the current distribution makes for a rapid fall off point where going from near-impossible to fairly-likely takes place over a small range of skill, I personally like that the success chances do that, having a simple distribution would mean that it'd take a very long time to go from "barely possible" to "castable" which isn't better for game play.
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!

Ziggurat Zagger

Posts: 6454

Joined: Tuesday, 30th October 2012, 19:06

Post Sunday, 21st August 2016, 01:18

Re: Do spell percentages ever lie?

Something that would be good to do is create a spell simulator that behaved similarly to the fight simulator, that would make testing for bugs easier.
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!
User avatar

Blades Runner

Posts: 546

Joined: Friday, 2nd October 2015, 14:42

Post Sunday, 21st August 2016, 03:37

Re: Do spell percentages ever lie?

I don't understand how anyone can even argue about this. The game already computes the odds it claims it uses for spell failure so why not, you know, literally roll against those odds? This is just comical.
The Original Discourse Respecter

Ziggurat Zagger

Posts: 6454

Joined: Tuesday, 30th October 2012, 19:06

Post Sunday, 21st August 2016, 21:08

Re: Do spell percentages ever lie?

goodcoolguy wrote:I don't understand how anyone can even argue about this. The game already computes the odds it claims it uses for spell failure so why not, you know, literally roll against those odds? This is just comical.

Because it would be inefficient and a waste of processing power, it only calculates the display percentage when actually displaying it, and that is more work than just rolling the dice in the fashion that is done now. It might make more sense to you, a human, but it would be comically bad programming to do so.

To give an analogy: computers represent numbers under the hood in a way that humans don't typically use, when doing math, computers use the internal representation, when displaying numbers, they are converted to ones that make sense to humans, because that it who is reading it, what you are asking for is similar to asking why computers don't simply do math on the numbers that they present to humans, rather than on the internal representation that they have for numbers to start with.
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Sunday, 21st August 2016, 21:21

Re: Do spell percentages ever lie?

Siegurt wrote:Because it would be inefficient and a waste of processing power, it only calculates the display percentage when actually displaying it, and that is more work than just rolling the dice in the fashion that is done now. It might make more sense to you, a human, but it would be comically bad programming to do so.

To give an analogy: computers represent numbers under the hood in a way that humans don't typically use, when doing math, computers use the internal representation, when displaying numbers, they are converted to ones that make sense to humans, because that it who is reading it, what you are asking for is similar to asking why computers don't simply do math on the numbers that they present to humans, rather than on the internal representation that they have for numbers to start with.


If computational speed was that important, we would still work on assembler only, but actually lots of other programming languages were created to make development easier and more importantly more error-prone. I don't think we would notice any speed difference with what goodcoolguy suggests, the code is run only once when PC casts a spell, it is not even shared by monsters.

Ziggurat Zagger

Posts: 6454

Joined: Tuesday, 30th October 2012, 19:06

Post Sunday, 21st August 2016, 23:39

Re: Do spell percentages ever lie?

Sandman25 wrote:
Siegurt wrote:Because it would be inefficient and a waste of processing power, it only calculates the display percentage when actually displaying it, and that is more work than just rolling the dice in the fashion that is done now. It might make more sense to you, a human, but it would be comically bad programming to do so.

To give an analogy: computers represent numbers under the hood in a way that humans don't typically use, when doing math, computers use the internal representation, when displaying numbers, they are converted to ones that make sense to humans, because that it who is reading it, what you are asking for is similar to asking why computers don't simply do math on the numbers that they present to humans, rather than on the internal representation that they have for numbers to start with.


If computational speed was that important, we would still work on assembler only, but actually lots of other programming languages were created to make development easier and more importantly more error-prone. I don't think we would notice any speed difference with what goodcoolguy suggests, the code is run only once when PC casts a spell, it is not even shared by monsters.


Actually modern c/c++ compilers generate code that is typically faster than most hand rolled assembly (you have the benefit of thousands of programmers experience over decades, instead of just your own), unless you happen to know some bit of information that the compiler doesn't, and therfore can't use to optimize the resulting output (which is exceedingly rare). Higher level languages, make programming less, not more, error prone (I don't know where you got that impression, but it isn't correct).

Yes, you would probably not notice the performance difference, the scale isnt large enough, it is still comically bad programming, and accomplishes nothing other than making humans feel falsly more comfortable when thinking about how the results are created.
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Sunday, 21st August 2016, 23:52

Re: Do spell percentages ever lie?

Siegurt wrote:Higher level languages, make programming less, not more, error prone (I don't know where you got that impression, but it isn't correct).


I got that impression from programming on Assembler, Java, Delphi and several other languages I have experience with. I am not expert on C/C++ but I did use it in university and also while creating patches for crawl so it is not that different from other high level languages.
That's Hello world on java

  Code:
public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }

}

http://introcs.cs.princeton.edu/java/11 ... .java.html

That's hello world on ASM for Linux
  Code:
section     .text
global      _start                              ;must be declared for linker (ld)

_start:                                         ;tell linker entry point

    mov     edx,len                             ;message length
    mov     ecx,msg                             ;message to write
    mov     ebx,1                               ;file descriptor (stdout)
    mov     eax,4                               ;system call number (sys_write)
    int     0x80                                ;call kernel

    mov     eax,1                               ;system call number (sys_exit)
    int     0x80                                ;call kernel

section     .data

msg     db  'Hello, world!',0xa                 ;our dear string
len     equ $ - msg                             ;length of our dear string

http://asm.sourceforge.net/intro/hello.html

and that's for MS DOS
  Code:
.model small
.stack
.data
    message   db "Hello world, I'm 16bit Dos Assembly !!!", "$"
.code
    main    proc
        mov   ax,seg message
        mov   ds,ax
        mov   ah,09
        lea   dx,message
        int   21h
       
        mov   ax,4c00h
        int   21h
    main    endp
end main

http://wyding.blogspot.com/2009/04/hell ... embly.html


Yes, you would probably not notice the performance difference, the scale isnt large enough, it is still comically bad programming, and accomplishes nothing other than making humans feel falsly more comfortable when thinking about how the results are created.


Bad programming is when you create double code which does the same thing with marginal speed improvement instead of reusing code.

Blades Runner

Posts: 536

Joined: Friday, 1st April 2016, 18:15

Post Sunday, 21st August 2016, 23:55

Re: Do spell percentages ever lie?

Yeah, reworking the code to convert it to user-friendly code is a waste of time. Most users aren't looking at the code! And if they are, then the only "users" who matter are the programmers. Clear code is important, but complaining about the equations themselves being a bit too complex, why don't we code it worse so it looks better? That's just bad coding.
twelwe wrote:It's like Blink, but you end up drowning.

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Sunday, 21st August 2016, 23:56

Re: Do spell percentages ever lie?

In the 1940s, the first recognizably modern electrically powered computers were created. The limited speed and memory capacity forced programmers to write hand tuned assembly language programs. It was eventually realized that programming in assembly language required a great deal of intellectual effort and was error-prone.


https://en.wikipedia.org/wiki/History_o ... _languages

Blades Runner

Posts: 536

Joined: Friday, 1st April 2016, 18:15

Post Monday, 22nd August 2016, 00:02

Re: Do spell percentages ever lie?

Wikipedia is unreliable, but in this case entirely correct

brainfuck is basically machine language and it is hard as hell to even tell what's going on, let alone debug code written in it. Reductio ad absurdum, melon farmers!
twelwe wrote:It's like Blink, but you end up drowning.

Ziggurat Zagger

Posts: 6454

Joined: Tuesday, 30th October 2012, 19:06

Post Monday, 22nd August 2016, 01:39

Re: Do spell percentages ever lie?

Sandman25 wrote:
Siegurt wrote:Higher level languages, make programming less, not more, error prone (I don't know where you got that impression, but it isn't correct).


I got that impression from programming on Assembler, Java, Delphi and several other languages I have experience with. I am not expert on C/C++ but I did use it in university and also while creating patches for crawl so it is not that different from other high level languages.
That's Hello world on java
...

Proving my point, higher level programming languages like java and c have features like type checking and error checking that aren't available in low level languages like assembly.
Sandman25 wrote:Bad programming is when you create double code which does the same thing with marginal speed improvement instead of reusing code.

That is one form of bad programming, however that doesn't apply here, we have two different things happening here, we have "roll three dice, add them together, then see if they exceed x" then we have "predict how often that will happen and express that as a percentage for the user to see" there is no duplication there at all.

The reason we do the latter is that humans are really bad at intuiting the odds of something happening given x in the former.

Turning user interface code into game logic code is even worse architecturally than code duplication (ideally, they would both use the same base code, and in cases where it makes sense to do so this is done in crawl)
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Monday, 22nd August 2016, 02:14

Re: Do spell percentages ever lie?

Oh, it looks there was a miscommunication issue on my side :(
You mean it is harder to do a mistake in high level languages, right? Of course I agree. For some reason I thought that "more error-prone" is "less likely to make a mistake".
User avatar

Blades Runner

Posts: 546

Joined: Friday, 2nd October 2015, 14:42

Post Monday, 22nd August 2016, 02:14

Re: Do spell percentages ever lie?

@Siegurt:

It's so funny when you talk about programming. You obviously have no idea what you're talking about.

The difference in processing time here is trivial. The spell failure code is invoked maybe a few thousand times in a three hour game, for total CPU time much less than a second. On the other hand, you have a persistent complaint about spell failure with reasonable grounds for skepticism about the correctness of the computation of the probabilities and whether the RNG gives you a statistically random sequence after being processed the way it is in the spell fail roll. The number computed in the spell rate calculation is not a percentage, it is just a number Y that represents a "Y in X" probability. The conversion is done later, not that it matters because obviously the conversion is also a trivial calculation.

Now surely, if you take the number Y above and compare it against 1dX, you will get the probability claimed by the fail rate screens. No one would doubt that. Similarly, while the RNG is not designed to give reasonable quality results for a weird formula like 1d100 + 1d101 + 1d102, it certainly is designed to produce statistically random sequences when reduced modulo a single modulus. You could then confidently say spell failure figures give the correct probabilities and that the numbers used internally are drawn from a legitimate statistically random sequence, the way people do up and down in these threads anyway without giving any real thought to the code they're vouching for.
Last edited by goodcoolguy on Monday, 22nd August 2016, 03:11, edited 4 times in total.
The Original Discourse Respecter

For this message the author goodcoolguy has received thanks:
Sandman25
User avatar

Tartarus Sorceror

Posts: 1891

Joined: Monday, 1st April 2013, 04:41

Location: Toronto, Canada

Post Monday, 22nd August 2016, 02:15

Re: Do spell percentages ever lie?

Sandman25 wrote:For some reason I thought that "more error-prone" is "less likely to make a mistake".


Literally the opposite, unfortunately.
take it easy

For this message the author Arrhythmia has received thanks:
Sandman25

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Monday, 22nd August 2016, 02:19

Re: Do spell percentages ever lie?

Siegurt wrote:That is one form of bad programming, however that doesn't apply here, we have two different things happening here, we have "roll three dice, add them together, then see if they exceed x" then we have "predict how often that will happen and express that as a percentage for the user to see" there is no duplication there at all.

The reason we do the latter is that humans are really bad at intuiting the odds of something happening given x in the former.

Turning user interface code into game logic code is even worse architecturally than code duplication (ideally, they would both use the same base code, and in cases where it makes sense to do so this is done in crawl)


It is still possible that there is an error in that code, humans make mistakes. We have N% function, it can easily be used instead of those three dices which can be removed as unnecessary code.

Advantages:
1) guarantee that code is correct.
2) if some changes are made, they are made in one place. All those wild magic, wizardry, brilliance etc. No need to support 2 fragments of code

Disadvantages:
1) "Slow" code
User avatar

Slime Squisher

Posts: 338

Joined: Wednesday, 20th November 2013, 11:37

Post Monday, 22nd August 2016, 06:07

Re: Do spell percentages ever lie?

Odds wrote:I just miscast Controlled Blink 4 times in a row, at 4% failure (entering a new Pan floor, dropped into the middle of the action. Turned out OK).

That has odds of 1 in 390,625. Or, more likely, there was something at work I didn't understand. So - is there any hidden effect that can make spellcasting success lower than displayed on the spells screen?

If you think there is something hidden that influence your spell failure then just go wizmode, make a copy of your char and do 4 fails in a row. If you can do it again - there is something wrong with spell fail calculations.

Snake Sneak

Posts: 103

Joined: Wednesday, 10th December 2014, 18:51

Post Monday, 22nd August 2016, 20:56

Re: Do spell percentages ever lie?

I have noticed that for Hexes if the monster is wearing some sort of armor and it is not identified and it has MR+ the success percentage will lie. Of course that makes since though since you haven't id the armour.

I can't reproduce it exactly as I'm not sure how to unidentify armor in Wiz mode but I did face sigmund once and it said 60% and unloaded a paralyze wand on him (like 8 shots). Killed him eventually but did not paralyze and found he had MR robe. Went to wizmode and set up the exact same scenario and it showed like 32% MR (or maybe it was 25% I can't recall now).

Swamp Slogger

Posts: 131

Joined: Thursday, 11th August 2011, 14:40

Post Tuesday, 23rd August 2016, 06:00

Re: Do spell percentages ever lie?

Somewhat unrelated to the topic, but has there been any discussion about introducing pseudo-randomness to crawl?

An example from Dota 2 (from a wiki page):

Slardar​'s Bash​ has a 25% chance to stun the target. On the first attack, however, it only has an ~8.5% probability to bash. Each subsequent attack without a bash increases the probability by ~8.5%. So on the second attack, the chance is ~17%, on the third it is ~25.5%, etc. After a bash occurs, the probability resets to ~8.5% for the next attack. These probabilities average out so that, over a moderate period of time, Bash procs nearly 25% of the time.

This was introduced fairly recently (a year or so ago), and most people seem to think it was a positive change.

For this message the author ximxim has received thanks:
runewalsh

Slime Squisher

Posts: 395

Joined: Monday, 28th April 2014, 19:50

Post Friday, 26th August 2016, 16:50

Re: Do spell percentages ever lie?

In a multiplayer game it makes sense to make random things like that more consisted so players don't feel frustrated/cheated when they get bashed or crit 5 times in a row.

In a single-player game like Crawl it probably unbalances things pretty hard in the player's favor though, since most deaths come from repeated bad rolls (on top of bad play, of course!). If the chance for a lich to cast crystal spear twice in a row drops significantly, the chance for that lich to kill the player drops as well.

For this message the author genericpseudonym has received thanks:
Brannock

Return to Dungeon Crawling Advice

Who is online

Users browsing this forum: No registered users and 13 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.