*Check the description for extra notes and details, and for the list of background music throughout the video.* There are subtitles provided, and also one (telegraphed and silent) jumpscare at 4:41. Any questions are welcome, but this video is the best general explanation I could create. *FAQ:* *Q:* _What's MB2/Mystery Box 2 Jack-O-Bonnie?_ *A:* Mystery Box 2 (MB2) is a move in FNaF World that swaps out your party members with 4 random ones. Scott made a slight miscalculation, and the maximum character number was 41, which didn't even exist when the game launched. It being so rare meant it never got patched, and after update v1.2 dropped, Jack-O-Bonnie became character #41. *Q:* _Why are the probabilities powers of 2?_ *A:* They're simplified fractions of 4/65536 and 2/65536; as the way it's setup, the probabilities of all the random stuff in Clickteam Fusion are out of 65536. They just happen to be powers of 2 though, they could've been 3/65536 or 10/65536. *Q:* _Did the Android glitch also affect iOS?_ *A:* No, it was exclusive to Android. You can actually verify this by trying to find old videos of Golden Freddy on Android vs. iOS. It's not that hard to find people finding it on iPhone, while every video on Android just shows the 1/9/8/7 Easter egg. *Q:* _Is that The Cure - Close To Me playing?_ *A:* Yeah? Kinda, it's a SiIvaGunner rip that uses the FFPS soundfont: ua-cam.com/video/r6-R2GAskWo/v-deo.html
Hell yeah brother. Keep those misinformers (me) in check! So wild that the odds people have been working with for so long were sometimes so dramatically off!
I'm sorry, it only generates 16-bit integers??? That's incredible. I remember seeing the unreasonably high odds of some of the easter eggs and frankly being shocked that we still saw them in content creator playthroughs as often as we did. Guess that explains a lot. The Android bug stands out to me significantly, as well. When I documented all the old mobile ports, I did so using iOS figuring there wouldn't be any substantial differences other than the microtransactions. I did notice that it took me significantly longer to get Golden Freddy to show up in FNaF 1's old port, but I just attributed that to possibly being because of faster nights, or just from bad luck. Because of that, I never believed any of the claims that Golden Freddy didn't exist on Android for a single second, since, y'know...everyone was really eager to guess randomly back then. Thank goodness we don't do that now, huh? Imagine if everyone guessed at something big like, for example, Fire Escape Ending requirements! Great video as always, and thanks for setting the record straight! (Also, using the negative overflow bug in FFPS to help explain the concept was honestly really slick. I need to start taking notes from your content it seems, lol)
You would have been right to use either port for any of the games after FNaF1, as they use the exact same MFA, just using different Clickteam exporters. But hold on, when did you document the old mobile ports 😅 Anyway, I tried to make the video mirror my own process of figuring out the why and how of it all. When Folmic mentioned a potential error with the RNG, that FFPS glitch was what I immediately went to, and I'm glad it translated well {:}
It was a while back, nothing public or interesting haha. I was mainly interested in seeing if it really was impossible to deter Foxy in the FNaF3 port, and that spiraled into checking a whole bunch of things. That was back when the tools to fully do that for the later games weren't public, so I felt a sort of obligation to notate all those things. Now that others can do it and there are great content creators that can uncover that information for everyone, I'm just always excited to see what the experts find lol. Looking forward to the next videos!
i mean whats he gonna do? run a million simulations to see if the events occur at teh expected probability? in the end it was still prettttty rare if not as comically rare as anticipated
@@passtheyaoi Check the documentation for the methods? Random is one of those methods I always check, it varies a lot between languages, it's nice to know the range they work in sometimes.
@@Cinkodacs Clickteam does not have good documentation; searching for documentation on the RNG function only gives you the right thing 7 results down. And all it'll really tell you is the "maximum value" is 65535, but not much more (though the max is still more than I would expect from their documentation lol). It's not weird to just assume a game engine can generate random numbers larger than 5 digits.
that's true, but i think as he playtested and saw these overflow werent affecting much at all, theres nothing else to do beside cracking the head to see if some rare png will appear in the game, either way would make it rare, not worth it
To be fair integer overflows are a bit of a rare error, and it doesn't happen very often, if I see a function not working I am more likely to think I messed an array access than an integer overflow, and because the game still mostly works fine it's hard to realize that something is even wrong Most modern programming languages will warn you when an integer overflows tho, rust for example will just crash
It's amazing how(roughly) 33% of Fnaf jank in these early games is "either a debug-thing scott forgot to disable or a poorly thought out hotfix for something else", 33% is "Scott made a typo/forgot to set upper bounds" and the other 33% are "Clickteam just kinda sucks enginewise". Perfectly balanced, as all things should be. Lol. At least it didn't impact anything actually important this time.
Huh. Explains how RWQFSFASXC actually appeared this frequently (there are quite a few people who saw it multiple times, wouldn't expect that if it was actually a 1/1000000)
Yep. I was happening to discuss with Folmic a case where someone got him twice, and the crazy odds I had calculated (~1 in 107501). He mentioned that Tru3P1ay3r alleged that there was some limit of ~40k with Clickteam RNG, but we quickly figured out it was actually an overflow, which adjusted the odds to ~1 in 36.
without code on base and comparing, the odds is that you flip your monitor on and off more often on fnaf 2 than you check cam 2b on fnaf if i explained bad: in fnaf 2 by default you flip over you cam on and off several times, more than in fnaf 1 average night, due the freedom of no energy usage, and as the gamr forces you because puppet everytime otherwise: clickteam fusion buggy messy uggy
my headcanon for the FFPS stat glitch is that this restaurant was actually a money laundering scheme, with the 20 visitors paying thousands in tips each. Henry destroys the restaurant at the end because the IRS found out about the scheme, burning all of the money and killing both him and Mike in the process. Can't believe henry would do such a thing 😔
Or maybe, since it has a negative entertainment value, weird rich folks came in, passed out because of how boring this place was, and got robbed by the staff.
this is kind of just a guess, but the reason that the games are capped to 16-bit numbers MIGHT be related to how Clickteam originated from a VERY, VERY OLD LINEAGE of game creator software, all the way back to Klik & Play. Klik & Play was literally built to run on *Windows 3.x*, which was indeed 16-bit! given that the underlying engine hasn't really been updated TOO much nowadays (clickteam has been surprisingly keen on backwards compatibility with project files), it makes sense that the standard variables are still in 16-bit.
That does seem to be potentially why, as the limitation dates back to at least 2006, though the implementation does use 32-bit integers. Overall, I don't see why the RNG wasn't updated to 32-bit in the decades since, as the only way that'd break backwards compatibility is if the program relied on undefined behaviour.
yay an opportunity for pedantry 🎉 It's actually still called an overflow even if it's going in the negative direction. Underflow is a term that specifically applies to floating-point numbers that are too small to be represented, and turn into 0.
@@itztaken wow thanks for that! Man this was a massive learning experience lmao. I first heard of overflow glitches because of Pokemon RBY's EXP overflow glitch with level 1 Pokemon in the Medium Fast EXP Group (you normally can't get level 1 Pokemon in RBY, but glitches lmao.). If a level 1 Pokemon in that EXP group gained less then (I think it was) 64 or 63, it'd overflow and level the Pokemon up to level 100 instantly
Absolutely love the "you could use char, but... please don't" note at 7:38. For context, char (short for "character" as you might guess) as a data format is an unsigned 16-bit data type which *can* technically be used to store numbers, but what it's *actually* intended for is storing *text,* or more specifically individual letters, as the name implies. Programming languages tend to treat textual data types very differently from numerical ones, so actually *using* a type like "char" for storing numbers would require some type-conversion gymnastics, hence the "please don't". (It's interesting to point out regarding this subject that Java actually doesn't support unsigned *anything* for numbers. Every numerical data type is signed!)
@@1e1001 At the very least it's what Java and a couple other languages use! I obviously can't speak to what char is in every language (some don't even *have* char as a data format), but I can't say I'm surprised some follow different standards. Hell, what's considered an "integer" can vary between languages.
Lol this is the hardest golden freddy and shadow bonny roast i've ever seen "you're so rare that you are no longer rare" they've been quiet like a body since this video dropped
My mind would be blown seeing shadow bonnie on people's playthroughs knowing it was a 1 in a million chance, but now I know it was more common than golden freddy
1/16,000 is still quite rare, being struck by lightning in a lifetime is 1/15,300 But yes makes way more sense than 1,000,000 because I’ve seen him and I KNOW I’m not lucky enough to see a 1,000,000 chance
@@TheRandomWolf only difference is that shadow bonnie has a chance every time you lift down the camera, which is bound to happen a lot. Although golden freddy is every second so he may be more common after all
Videos like this are so fantastic. Excellent reminder of why I'm subscribed to you. A level of depth you don't really see with other content creators. Keep it up. Really love the videos
For those who still don't understand, even though the code says it's 1/100000, the software it runs on cannot do that number so the chances are lower because it loops over.
Thanks! I have a really hard time understanding any computer or programming terms. I tried to make sense of the video but just found myself getting lost due to most of the things having a context to them that I had no clue about. Like what is the difference between a 32 bit integer and a 16 bit integer?
Honestly, it would be 5000 IQ move as a game designer / programmer to code a "rare" event to happen more often than stated even in the code. That way a lot more people playing the game get the excitement of experiencing a super rare event.
My brain didn't immediately make the leap to "every random number in all Fnaf games is an unsigned short as well" so you might have wanted to mention that when transitioning from pizza simulator to golden freddy. But awesome video still! I love learning video game math.
I remember like, 7-8 years ago I was trying to find the decompiled source of fnaf and managed to find it *eventually* after a ton of searching (i was like, 10). super cool to see this kind of analysis! well done
The editing. The smooth keyframing. The assets to make with what game is being talked about. 3:17 Bro spelt out his name, and every letter had a sound effect. It's amazing.
A really genuinely excellent video. Love how the practical/technical physical implementations actually changed odds by a large amount. The explanation with FFPS's bug was great and your content isn't over-fluffed particularly, love it. Also big fan of the muted, telegraphed jumpscares, lol
This video is a damn revolution!! Could I use the data and information from the video to make a Spanish version for my channel? I would love to make something like this possible, I don't think I can reach your level of editing tho
Yeah, sure! I think it's some pretty interesting stuff, but I should say though, I'm always a bit wary of information degradation in the FNaF community. Especially for the technical information, FNaF UA-cam has felt like a game of broken telephone. For this video in particular, it was very important to me that the script and visual presentation would make it as easy as possible to grasp the concepts and reasoning behind it (it's a rather large claim after all). So, if you need any clarification or additional details, I'd be glad to help.
Interesting how the biased odds go to 32768 which is close to the 32767 which is the 16 bit signed integer limit. I was curious about how big the RNG function was especially when dealing with overflow. Clickteam Fusions' engine is surprising! Funny how the Android port was just broken due to the Java/C++ Differences.
It's the first time I see a video on this topic after starting to learn c++ in uni and it took me this long to finally understand fnaf rng, worth it tbh
While negative revenue provides seemingly unlimited revenue, I like to imagine that negative health and safety similarly provides AMAZING health and safety, curing the attendees of pre-existing conditions they had before arriving, and causing legal teams to pay your fees to fight their own case against themselves, because with health that good, there's no way you're liable for anything.
Wow that was actually much more interesting than I first expected, I'm not really into fnaf but I'll always take a video talking about video games statistics, I really appreciate the quality of this video and I thank you for putting a jumpscare warning, way too few channels do this kind of stuff
Oh, this is a delightful video ! I found your channel after checking Tech Rules' community tab yesterday, for fun, and seeing their post from last year about your videos. I'm very glad I followed the link to your channel and checked it out ! Your videos are well-made and well-explained :D Hope you're having a nice day !
I just did the pizzeria sim glitch, night 1 was fine. Don’t try it in nights 2 and onwards. I’ve been sitting here for 5 minutes as my returning visitors skyrockets past 30K 😂
Here I was thinking seeing shadow bonnie was one of the rarest things that’s happened to me… ever, for years. Well that’s some pretty smart research, and is incredible interesting, especially for games that I was 100% sure we had completely cracked
Here's another fun fact: There's actually terms for this exact type of bug. We call them interger underflow and interger overflow respectively. Both result in the same outcome, but underflow occurs when the number is less than the minimum interger limit, and overflow occurs when it's more than the maximum integer limit.
It's actually still called an overflow even if it's going in the negative direction. Underflow is a term that specifically applies to floating-point numbers that are too small to be represented, and turn into 0.
This reminds me of the nuclear Gandhi glitch from the Civilization series. In one of the earlier games, the exact same negative number glitch happened, and when the programming generated a similarly massive number, Gandhi always went nuclear despite his commitment to peace. It’s become such a meme now that even in later games that avoided the glitch, the team still references “Nuclear Gandhi.” Civ 6 even gives him an 80% chance of having the secret agenda “Nuke Happy,” where the AI seeks to develop nuclear weapons and likes/dislikes others who do/don’t
I wonder if Scott actually knew about this limitation of Clickteam, or if he knew but didn't bother with the specific value of things occuring so he just put in a really large number and assumed it'll be rare from there
It's obvious he didn't know of this limitation, though he did know of the 999,999,999 limit that counters normally have in Clickteam, as evidenced by the Random(999999999) in SL's Breaker Room.
@5:50 65535 MOD 100 = 35, so in this case, a shorten RNG range will have an output of 0-35 occurring more often than 35-100. Range 0-35 will each integer be 1/656 chance while 36-100 will each integer be 1/655 chance. Calculated by dividing 65535 by 100, which gives out 655.35, or 655 remainder 35. We have 655 complete ranges of 100-size, with an incomplete range size of 36. Because Modulo outputs a number strictly lower than the denominator, the numbers in the lower part of the range happens more often.
Like your style of fnaf videos, I wish this one was longer. I waited months to the point I forgot tho UA-cam recommends came in clutch ill be subscribing and I hope to see more from you.
2:16 It could also be that it's reinterpreting a signed int as an unsigned int. A 1 on the most significat bit in a signed number means a negative prefix. That reinterpreted into a unsigned turns out to be a number with it's most significat bit set at 1.
Ive actually encountered golden freddy a handful of times (and even have him on a you tube video) so when people told me hes 1 in 100k i said theres no way hes this rare and their response was always like "you just got really lucky". I knew there was more to this though.
2:11 "Depending on the programming language that's either gonna result in an error, or wrapping the number to the maximum" For those curios, the reason the number wraps around has to do on how binary and integers work. Both a unsigned short and signed short are in reality 16 bits (or two bytes) of data that represent a number, positive whole numbers for the unsigned, and negative or positive for the signed. In the case of the signed short, the last bit represents whether it is a negative number (if the bit is 1), os positive (if it's 0), in the case of the unsigned variant, however, that las bit represents 2¹⁵. This is the reason it "wraps around", when you use a negative you are telling the computer to interpret the last bit as the sign, however, if you tell it to interpret that same number as unsigned, it will add 2¹⁵ to your number. Note: There are actually three ways negative numbers: magnitude method : The last bit (known as the most significant bit, or MSB for short), represents the sign, a 0 means positive, and a 1 means negative. 1's complement method : the MSB signals the sign, and all the bits of a number are inverted for negative numbers (1's become 0's and vice versa). 2's complement : It is just 1's complement, but adding 1 to the result. This one is the most commonly used for two reasons: 1- makes calculations easier, and 2, unlike the other methods, there only exist one value for 0, although this sounds obvious, in 1's complement there exists two zeros, 0 and -0 because both binary numbers 00000000 and 11111111 are valid representations of zero.
mmm, more like unsigned short and short, maybe more easily called u16 and s16 (for unsigned-16 and signed-16), store a whole number in 16-bits. signed numbers are able to represent negative numbers by moving the upper half of numbers (everything between 32768 and 65535 in this case) to be negative numbers (-32768 to -1), this method (used by pretty much every computer) is called *2's complement* . it's used because it makes maths really easy and without needing to explicitly check for sign changes, for example 0 - 1 would be 65535_u16 which is -1_i16, the correct answer. pretty much nobody uses 1's complement, and sign-magnitude is pretty much only used for floating point numbers (because that's what ieee-754 dictates)
@@1e1001 I forgot about mentioning 2's complement because I was more concerned about explaining the general concept of a number "wrapping around" than anything. But you are correct. As a side note, I've never actually seen anyone use s16 to refer to signed numbers, but actually i16 even though s16 might make more sense because both unsigned and signed are integers.
I’m glad we got an answers how the games work and thanks for the showing good quality of math. Sometimes doing the math helps out to understand the game better. In steam to this day is still 1.35, I could be wrong but I did remember playing FNAF 1 recently.
Just wanna say, as someone who is a massive wimp and is only interested in the coding jank of FNAF and pretty much nothing else, I really appreciate that you both warn of an incoming jumpscare and mute/lower the volume. I really love your videos on the series!
1 ÷ 100.000 = 0.00001 1 - 0,00001 = 0.99999 The chances of NOT getting Golden Freddy (in FNAF 1) are that of 99.999% every second. You're only getting the chances of surviving the following seconds AFTER the already limited chance of having survived the previous second. A night in FNAF 1 lasts for 8 minutes and 55 seconds, or 535 seconds. You need to elevate 0,99999 to the power of 535, and then multiply the result by 100 to get the final probability (in percentage) of NOT getting Golden Freddy across the whole night, which are a little over ~99.46%. Then you just subtract the result from 100% and you get the probability of getting Golden Freddy across a whole night, which is little under ~0,54%, or 1 in a little over 187. (100÷(100-((0,99999^535)×100)) = ~187,4153991048) When you take into account how many people played FNAF, as well as the fact that each player can play multiple nights, Golden Freddy appearing isn't as unlikely as it might initially seem by the "1 in 100000" figure. And remember, that is just the chances of him appearing for each ONE individual night. Most players will play multiple nights. When you account for playing 5 whole nights in a row, the odds of Golden Freddy appearing increase to a little under ~2.64%, or 1 in a little under 38. 5 nights × 535 seconds per night = 2675 seconds. (100÷(100-((0,99999^2.675)×100)) = ~ 37,8852198051) So, around 1 in every 38 players who play the time equivalent of 5 whole nights will encounter Golden Freddy. Meaning Golden Freddy is a LOT more likely to appear than people might initially think.
At 3:17, it is mentioned that there is a random(1,000) chance for Golden Freddy A.I. to be present on Nights 2 & 3, and while this is true, this is irrelevant for Night 3 as a later line of code will automatically deactivate Golden Freddy at the beginning of a night in the base game (I.E. Nights 1-5). This also ends up affecting Nights 4 & 5, which have random(100) chances for Golden Freddy A.I. to be present, only for said odds to be irrelevant for the same reason. Night 2 isn't affected because unlike Nights 3-5, the random function is ran when you reach 1AM, not when the night begins. Edit: Yes I'm aware the video creator has another video that explains this, this comment is meant for people watching this video that didn't watch the other one where this was explained.
This integer underflow effect is also what caused Ghandi to go nuclear in the old civilization game. His aggression started at one, and when he eventually established democracy, it reduced his aggression by two, making it wrap all around to 255 out of 10.
Very very interesting, I love seeing the technical aspects of stuff like this gone in-depth! Out of curiosity, do the fnaf world lower tier reapers and unscrew 2 have different odds?
Lower tier reapers don't have lower odds, they just shoot less often. Unscrew odds are 1/30 and 1/600 for enemies and bosses, while Unscrew 2 is 1/20 and 1/500.
Not on Steam, Scott has not patched anything in a very long time, and the only recent patches were to bugs with the application as a whole. I don't know about the ports, maybe? Most glitches are still present in the ports, but I do know they have patched a couple.
*Check the description for extra notes and details, and for the list of background music throughout the video.*
There are subtitles provided, and also one (telegraphed and silent) jumpscare at 4:41.
Any questions are welcome, but this video is the best general explanation I could create.
*FAQ:*
*Q:* _What's MB2/Mystery Box 2 Jack-O-Bonnie?_
*A:* Mystery Box 2 (MB2) is a move in FNaF World that swaps out your party members with 4 random ones. Scott made a slight miscalculation, and the maximum character number was 41, which didn't even exist when the game launched. It being so rare meant it never got patched, and after update v1.2 dropped, Jack-O-Bonnie became character #41.
*Q:* _Why are the probabilities powers of 2?_
*A:* They're simplified fractions of 4/65536 and 2/65536; as the way it's setup, the probabilities of all the random stuff in Clickteam Fusion are out of 65536. They just happen to be powers of 2 though, they could've been 3/65536 or 10/65536.
*Q:* _Did the Android glitch also affect iOS?_
*A:* No, it was exclusive to Android. You can actually verify this by trying to find old videos of Golden Freddy on Android vs. iOS. It's not that hard to find people finding it on iPhone, while every video on Android just shows the 1/9/8/7 Easter egg.
*Q:* _Is that The Cure - Close To Me playing?_
*A:* Yeah? Kinda, it's a SiIvaGunner rip that uses the FFPS soundfont: ua-cam.com/video/r6-R2GAskWo/v-deo.html
Telegraphed?
Time travel comment
@@mattybrunolucaszeneresalas9072 I think he means that he warns you about it happening ahead of time
@@crystaljiang5976 I see
what jumpscare? without any sounds its looks like goofy fan animation, that what i called scary.
Hell yeah brother. Keep those misinformers (me) in check! So wild that the odds people have been working with for so long were sometimes so dramatically off!
hey man, love your videos!
How dare you misinform the foolish viewers (me)!
Yo backseat, whats good
backseat didnt you figure out golden freddy on the fnaf 1 playthrough
so thats how you got golden freddy twice...
I'm sorry, it only generates 16-bit integers??? That's incredible. I remember seeing the unreasonably high odds of some of the easter eggs and frankly being shocked that we still saw them in content creator playthroughs as often as we did. Guess that explains a lot.
The Android bug stands out to me significantly, as well. When I documented all the old mobile ports, I did so using iOS figuring there wouldn't be any substantial differences other than the microtransactions. I did notice that it took me significantly longer to get Golden Freddy to show up in FNaF 1's old port, but I just attributed that to possibly being because of faster nights, or just from bad luck. Because of that, I never believed any of the claims that Golden Freddy didn't exist on Android for a single second, since, y'know...everyone was really eager to guess randomly back then. Thank goodness we don't do that now, huh? Imagine if everyone guessed at something big like, for example, Fire Escape Ending requirements!
Great video as always, and thanks for setting the record straight!
(Also, using the negative overflow bug in FFPS to help explain the concept was honestly really slick. I need to start taking notes from your content it seems, lol)
You would have been right to use either port for any of the games after FNaF1, as they use the exact same MFA, just using different Clickteam exporters. But hold on, when did you document the old mobile ports 😅
Anyway, I tried to make the video mirror my own process of figuring out the why and how of it all. When Folmic mentioned a potential error with the RNG, that FFPS glitch was what I immediately went to, and I'm glad it translated well {:}
It was a while back, nothing public or interesting haha. I was mainly interested in seeing if it really was impossible to deter Foxy in the FNaF3 port, and that spiraled into checking a whole bunch of things.
That was back when the tools to fully do that for the later games weren't public, so I felt a sort of obligation to notate all those things. Now that others can do it and there are great content creators that can uncover that information for everyone, I'm just always excited to see what the experts find lol. Looking forward to the next videos!
man i miss your content. Glad that you're still active as a viewer. Hope you're okay and healthy✨
I never expected to see tech rules here I love your channel
omg tech rules moment?? love your stuff!
THANKS FOR GAME RARITY SCREENSHOTS IM ON MY WAY TO BECOME THE 2ND TAKEN++ MEMBER
I’m so plus’d up rn
What
@@Bradleybus he plus'd up
what is even taken++????
is this an ad segue
I love how Scott made all these games and never realised his software keeps integer overflowing
i mean whats he gonna do? run a million simulations to see if the events occur at teh expected probability?
in the end it was still prettttty rare
if not as comically rare as anticipated
@@passtheyaoi Check the documentation for the methods? Random is one of those methods I always check, it varies a lot between languages, it's nice to know the range they work in sometimes.
@@Cinkodacs Clickteam does not have good documentation; searching for documentation on the RNG function only gives you the right thing 7 results down. And all it'll really tell you is the "maximum value" is 65535, but not much more (though the max is still more than I would expect from their documentation lol). It's not weird to just assume a game engine can generate random numbers larger than 5 digits.
that's true, but i think as he playtested and saw these overflow werent affecting much at all, theres nothing else to do beside cracking the head to see if some rare png will appear in the game, either way would make it rare, not worth it
To be fair integer overflows are a bit of a rare error, and it doesn't happen very often, if I see a function not working I am more likely to think I messed an array access than an integer overflow, and because the game still mostly works fine it's hard to realize that something is even wrong
Most modern programming languages will warn you when an integer overflows tho, rust for example will just crash
It's amazing how(roughly) 33% of Fnaf jank in these early games is "either a debug-thing scott forgot to disable or a poorly thought out hotfix for something else", 33% is "Scott made a typo/forgot to set upper bounds" and the other 33% are "Clickteam just kinda sucks enginewise". Perfectly balanced, as all things should be. Lol.
At least it didn't impact anything actually important this time.
What other things have been impacted?
@@gregorymirabella1423 fnaf 3 night 6 ventilation errors that occur naturally
the extra 1% is going to shit yourself
Huh. Explains how RWQFSFASXC actually appeared this frequently (there are quite a few people who saw it multiple times, wouldn't expect that if it was actually a 1/1000000)
Yep. I was happening to discuss with Folmic a case where someone got him twice, and the crazy odds I had calculated (~1 in 107501). He mentioned that Tru3P1ay3r alleged that there was some limit of ~40k with Clickteam RNG, but we quickly figured out it was actually an overflow, which adjusted the odds to ~1 in 36.
Got them two nights in a row once and I KNEW the code was wrong
without code on base and comparing, the odds is that you flip your monitor on and off more often on fnaf 2 than you check cam 2b on fnaf
if i explained bad: in fnaf 2 by default you flip over you cam on and off several times, more than in fnaf 1 average night, due the freedom of no energy usage, and as the gamr forces you because puppet everytime
otherwise: clickteam fusion buggy messy uggy
my headcanon for the FFPS stat glitch is that this restaurant was actually a money laundering scheme, with the 20 visitors paying thousands in tips each. Henry destroys the restaurant at the end because the IRS found out about the scheme, burning all of the money and killing both him and Mike in the process. Can't believe henry would do such a thing 😔
it was a glitch but now it's a scheme
Or maybe, since it has a negative entertainment value, weird rich folks came in, passed out because of how boring this place was, and got robbed by the staff.
truly the most terrifying of all fnaf characters is the IRS
this is kind of just a guess, but the reason that the games are capped to 16-bit numbers MIGHT be related to how Clickteam originated from a VERY, VERY OLD LINEAGE of game creator software, all the way back to Klik & Play. Klik & Play was literally built to run on *Windows 3.x*, which was indeed 16-bit!
given that the underlying engine hasn't really been updated TOO much nowadays (clickteam has been surprisingly keen on backwards compatibility with project files), it makes sense that the standard variables are still in 16-bit.
That does seem to be potentially why, as the limitation dates back to at least 2006, though the implementation does use 32-bit integers. Overall, I don't see why the RNG wasn't updated to 32-bit in the decades since, as the only way that'd break backwards compatibility is if the program relied on undefined behaviour.
I wasn't expecting to understand how overflow glitches work in detail, thanks!
yay an opportunity for pedantry 🎉
It's actually still called an overflow even if it's going in the negative direction. Underflow is a term that specifically applies to floating-point numbers that are too small to be represented, and turn into 0.
@@itztaken wow thanks for that! Man this was a massive learning experience lmao. I first heard of overflow glitches because of Pokemon RBY's EXP overflow glitch with level 1 Pokemon in the Medium Fast EXP Group (you normally can't get level 1 Pokemon in RBY, but glitches lmao.). If a level 1 Pokemon in that EXP group gained less then (I think it was) 64 or 63, it'd overflow and level the Pokemon up to level 100 instantly
If your name is markiplier then your chances increase
Absolutely love the "you could use char, but... please don't" note at 7:38. For context, char (short for "character" as you might guess) as a data format is an unsigned 16-bit data type which *can* technically be used to store numbers, but what it's *actually* intended for is storing *text,* or more specifically individual letters, as the name implies.
Programming languages tend to treat textual data types very differently from numerical ones, so actually *using* a type like "char" for storing numbers would require some type-conversion gymnastics, hence the "please don't". (It's interesting to point out regarding this subject that Java actually doesn't support unsigned *anything* for numbers. Every numerical data type is signed!)
16-bit char? i've only ever seen 8 (ascii/iso-8859-1) or 32 (full unicode)
@@1e1001 At the very least it's what Java and a couple other languages use! I obviously can't speak to what char is in every language (some don't even *have* char as a data format), but I can't say I'm surprised some follow different standards. Hell, what's considered an "integer" can vary between languages.
@@Hexagonaldonut c++: hold my beer
Lol this is the hardest golden freddy and shadow bonny roast i've ever seen "you're so rare that you are no longer rare" they've been quiet like a body since this video dropped
My mind would be blown seeing shadow bonnie on people's playthroughs knowing it was a 1 in a million chance, but now I know it was more common than golden freddy
1/16,000 is still quite rare, being struck by lightning in a lifetime is 1/15,300
But yes makes way more sense than 1,000,000 because I’ve seen him and I KNOW I’m not lucky enough to see a 1,000,000 chance
@@TheRandomWolf only difference is that shadow bonnie has a chance every time you lift down the camera, which is bound to happen a lot. Although golden freddy is every second so he may be more common after all
@@Speed-TV i think it still runs the RNG every second and then waits to spawn it when the camera drops
@@GrubThompson i know
@@GrubThompson Does it just set the result when it happens or does it only spawn when the RN is right when you flip down?
Love these breakdowns, they help clear up common misconceptions and are amazingly edited
Videos like this are so fantastic. Excellent reminder of why I'm subscribed to you. A level of depth you don't really see with other content creators. Keep it up. Really love the videos
For those who still don't understand, even though the code says it's 1/100000, the software it runs on cannot do that number so the chances are lower because it loops over.
Why did u write this comment lmao
*chances are better
*The chances are higher.
@@TospikKing For those who still dont understand
Thanks! I have a really hard time understanding any computer or programming terms. I tried to make sense of the video but just found myself getting lost due to most of the things having a context to them that I had no clue about. Like what is the difference between a 32 bit integer and a 16 bit integer?
Honestly, it would be 5000 IQ move as a game designer / programmer to code a "rare" event to happen more often than stated even in the code. That way a lot more people playing the game get the excitement of experiencing a super rare event.
I love that idea lol
You'd have to do it carefully though if you wanted it to be reasonably rare and not way too common or something wild
Updating the wikia pages as I type this, sourcing this video. I was not aware it could work this way, well done!
My brain didn't immediately make the leap to "every random number in all Fnaf games is an unsigned short as well" so you might have wanted to mention that when transitioning from pizza simulator to golden freddy. But awesome video still! I love learning video game math.
1:47 I figured the whole “Clickteam doesn’t support other types of numbers” thing already kinda implied that
@@swiftfated yeah same as other commenter, they were made in the same engine so the same function isn't going to magically change.
I will never stop being entertained by the catastrophic results of games receiving numbers slightly outside of expected ranges.
Your content is great! I love how this part at 3:11 also acts as a document for random events in the fnaf games, nice to see it all detailed
As someone who is really interested in technical fnaf I find this video really interesting! I'm really hyped for the fnaf glitches video!
Kube Jumpscare??
Honestly without Markiplier's encounter, I think genuinely FNAF as a whole wouldn't have taken off so hard.
I remember like, 7-8 years ago I was trying to find the decompiled source of fnaf and managed to find it *eventually* after a ton of searching (i was like, 10). super cool to see this kind of analysis! well done
The editing.
The smooth keyframing.
The assets to make with what game is being talked about.
3:17 Bro spelt out his name, and every letter had a sound effect.
It's amazing.
A really genuinely excellent video. Love how the practical/technical physical implementations actually changed odds by a large amount. The explanation with FFPS's bug was great and your content isn't over-fluffed particularly, love it.
Also big fan of the muted, telegraphed jumpscares, lol
This is outstandingly comprehensive! The description is amazing lol.
This video is a damn revolution!! Could I use the data and information from the video to make a Spanish version for my channel? I would love to make something like this possible, I don't think I can reach your level of editing tho
Yeah, sure! I think it's some pretty interesting stuff, but I should say though, I'm always a bit wary of information degradation in the FNaF community. Especially for the technical information, FNaF UA-cam has felt like a game of broken telephone. For this video in particular, it was very important to me that the script and visual presentation would make it as easy as possible to grasp the concepts and reasoning behind it (it's a rather large claim after all). So, if you need any clarification or additional details, I'd be glad to help.
It's insane how this answer was right under everyone's noses as well lmao
Great video :)
Interesting how the biased odds go to 32768 which is close to the 32767 which is the 16 bit signed integer limit.
I was curious about how big the RNG function was especially when dealing with overflow. Clickteam Fusions' engine is surprising!
Funny how the Android port was just broken due to the Java/C++ Differences.
It goes to 32768 because it's 2/65536.
Let’s all agree that Golden Freddy’s jumpscare is the definition of unexpectedness but it’s at peak.
It's the first time I see a video on this topic after starting to learn c++ in uni and it took me this long to finally understand fnaf rng, worth it tbh
I love your editing! It’s so well done!
you can really tell that it improved a bunch over his past few videos!
While negative revenue provides seemingly unlimited revenue, I like to imagine that negative health and safety similarly provides AMAZING health and safety, curing the attendees of pre-existing conditions they had before arriving, and causing legal teams to pay your fees to fight their own case against themselves, because with health that good, there's no way you're liable for anything.
I love giggling to myself about these kinds of under/overflow glitches in games they're always the funniest
Wow that was actually much more interesting than I first expected, I'm not really into fnaf but I'll always take a video talking about video games statistics, I really appreciate the quality of this video and I thank you for putting a jumpscare warning, way too few channels do this kind of stuff
It was creepier to see Golden Freddy NOT jumpscare people.
this is such an awesome video, you've done it yet again, Taken!
*0:07** do I see part of backseat's video there?*
Oh, this is a delightful video !
I found your channel after checking Tech Rules' community tab yesterday, for fun, and seeing their post from last year about your videos. I'm very glad I followed the link to your channel and checked it out ! Your videos are well-made and well-explained :D Hope you're having a nice day !
I just did the pizzeria sim glitch, night 1 was fine. Don’t try it in nights 2 and onwards. I’ve been sitting here for 5 minutes as my returning visitors skyrockets past 30K 😂
Here I was thinking seeing shadow bonnie was one of the rarest things that’s happened to me… ever, for years.
Well that’s some pretty smart research, and is incredible interesting, especially for games that I was 100% sure we had completely cracked
Here's another fun fact: There's actually terms for this exact type of bug. We call them interger underflow and interger overflow respectively. Both result in the same outcome, but underflow occurs when the number is less than the minimum interger limit, and overflow occurs when it's more than the maximum integer limit.
It's actually still called an overflow even if it's going in the negative direction. Underflow is a term that specifically applies to floating-point numbers that are too small to be represented, and turn into 0.
This reminds me of the nuclear Gandhi glitch from the Civilization series. In one of the earlier games, the exact same negative number glitch happened, and when the programming generated a similarly massive number, Gandhi always went nuclear despite his commitment to peace. It’s become such a meme now that even in later games that avoided the glitch, the team still references “Nuclear Gandhi.” Civ 6 even gives him an 80% chance of having the secret agenda “Nuke Happy,” where the AI seeks to develop nuclear weapons and likes/dislikes others who do/don’t
Unfortunately, that's just a rumour and wasn't real, India just focused on science and usually ended up researching nukes first.
@@itztaken The meme still pretty funny though, you gotta admit
Growing up is realizing early FNAF was held together by duct tape
Wow! Love videos like this that look into the deeper parts of how the games function. Well done!
As someone who's super jumpy over jumpscares, thank you so much for the countdown, very appreciated
I had a mini panic attack when the mario 64 music came on following the "let me explain"
0:24 Tj Henry Yoshi having PTSD
I wonder if Scott actually knew about this limitation of Clickteam, or if he knew but didn't bother with the specific value of things occuring so he just put in a really large number and assumed it'll be rare from there
It's obvious he didn't know of this limitation, though he did know of the 999,999,999 limit that counters normally have in Clickteam, as evidenced by the Random(999999999) in SL's Breaker Room.
That is very interesting and funny to see how such a little technical limitation can change so much!
It's cool to see the game break by the engine and not Scott himself😭. Great vid tho
@5:50 65535 MOD 100 = 35, so in this case, a shorten RNG range will have an output of 0-35 occurring more often than 35-100. Range 0-35 will each integer be 1/656 chance while 36-100 will each integer be 1/655 chance.
Calculated by dividing 65535 by 100, which gives out 655.35, or 655 remainder 35. We have 655 complete ranges of 100-size, with an incomplete range size of 36. Because Modulo outputs a number strictly lower than the denominator, the numbers in the lower part of the range happens more often.
Love your visual style. Editing was top notch
Really well made vid man! You've got the editing skills of a master, and it really made this a good watch!
5:09 what’s Mystery Box Jack-O-Bonnie?
I can only assume getting jack o bonnie when using the move mystery box
At least there wasn’t some Mario 64 pendulum manipulation type stuff
it felt like it in the moment
Man I can’t believe that Cassidy and the other one show up more often just because they both skipped math
I love deep explanations of code like this - thanks for your curiosity :)
That short Super Mario 64 File Select inclusion had me rolling. I swear, everyone's taken inspiration from Pannenkoek at this point.
Like your style of fnaf videos, I wish this one was longer. I waited months to the point I forgot tho UA-cam recommends came in clutch ill be subscribing and I hope to see more from you.
I love the alternative description LOL, like so true
In FNAF 1, there’s actually a one in three gorrilion chance that Freddy does the Gangnam style (real)
I saw that happen once
This happened to Markiplier but he had to take the video down for copyright 😔
Neat analysis video! Thanks for uploading!
2:16 It could also be that it's reinterpreting a signed int as an unsigned int. A 1 on the most significat bit in a signed number means a negative prefix. That reinterpreted into a unsigned turns out to be a number with it's most significat bit set at 1.
Ive actually encountered golden freddy a handful of times (and even have him on a you tube video) so when people told me hes 1 in 100k i said theres no way hes this rare and their response was always like "you just got really lucky". I knew there was more to this though.
I don't really care about FNaF, but hot dog I love a good breakdown of broken video game code.
I didn’t expect a study in why simulated RNG is bad from a FNAF video.
Greatest Five Nights at Freddy’s channel on the platform.
2:11 "Depending on the programming language that's either gonna result in an error, or wrapping the number to the maximum"
For those curios, the reason the number wraps around has to do on how binary and integers work.
Both a unsigned short and signed short are in reality 16 bits (or two bytes) of data that represent a number, positive whole numbers for the unsigned, and negative or positive for the signed.
In the case of the signed short, the last bit represents whether it is a negative number (if the bit is 1), os positive (if it's 0), in the case of the unsigned variant, however, that las bit represents 2¹⁵. This is the reason it "wraps around", when you use a negative you are telling the computer to interpret the last bit as the sign, however, if you tell it to interpret that same number as unsigned, it will add 2¹⁵ to your number.
Note: There are actually three ways negative numbers:
magnitude method : The last bit (known as the most significant bit, or MSB for short), represents the sign, a 0 means positive, and a 1 means negative.
1's complement method : the MSB signals the sign, and all the bits of a number are inverted for negative numbers (1's become 0's and vice versa).
2's complement : It is just 1's complement, but adding 1 to the result. This one is the most commonly used for two reasons: 1- makes calculations easier, and 2, unlike the other methods, there only exist one value for 0, although this sounds obvious, in 1's complement there exists two zeros, 0 and -0 because both binary numbers 00000000 and 11111111 are valid representations of zero.
mmm, more like
unsigned short and short, maybe more easily called u16 and s16 (for unsigned-16 and signed-16), store a whole number in 16-bits. signed numbers are able to represent negative numbers by moving the upper half of numbers (everything between 32768 and 65535 in this case) to be negative numbers (-32768 to -1), this method (used by pretty much every computer) is called *2's complement* . it's used because it makes maths really easy and without needing to explicitly check for sign changes, for example 0 - 1 would be 65535_u16 which is -1_i16, the correct answer. pretty much nobody uses 1's complement, and sign-magnitude is pretty much only used for floating point numbers (because that's what ieee-754 dictates)
@@1e1001 I forgot about mentioning 2's complement because I was more concerned about explaining the general concept of a number "wrapping around" than anything. But you are correct.
As a side note, I've never actually seen anyone use s16 to refer to signed numbers, but actually i16 even though s16 might make more sense because both unsigned and signed are integers.
@@1e1001 how does it make maths easier?
Fnaf is so complex in every aspect that the golden freddy RNG chance was theorized like the gravity theory
So by that logic, the hardest UCN night is 49/20 with a -1 Jack-O-Chica 🤔
The editing is REALLY GOOD
Great vid! I love your content!
I’m glad we got an answers how the games work and thanks for the showing good quality of math. Sometimes doing the math helps out to understand the game better. In steam to this day is still 1.35, I could be wrong but I did remember playing FNAF 1 recently.
Just wanna say, as someone who is a massive wimp and is only interested in the coding jank of FNAF and pretty much nothing else, I really appreciate that you both warn of an incoming jumpscare and mute/lower the volume. I really love your videos on the series!
This altered RNG makes the odds of seeing golden freddy in a run go from 2.63% or whatever it is, all the way up to 7.84%. Almost triple toe odds
Thanks for explaining this very clearly so someone who has zero coding experience (like me hehe) could understand it fairly well :D
Integer underflow causes so many cool glitches
Thank you Pannenkoek
no problem will
this is goddamn good video dude! i love it!❤
0:42 as the game developer, yup. Sometimes you gotta do this and hope nobody notices.
1 ÷ 100.000 = 0.00001
1 - 0,00001 = 0.99999
The chances of NOT getting Golden Freddy (in FNAF 1) are that of 99.999% every second. You're only getting the chances of surviving the following seconds AFTER the already limited chance of having survived the previous second.
A night in FNAF 1 lasts for 8 minutes and 55 seconds, or 535 seconds. You need to elevate 0,99999 to the power of 535, and then multiply the result by 100 to get the final probability (in percentage) of NOT getting Golden Freddy across the whole night, which are a little over ~99.46%.
Then you just subtract the result from 100% and you get the probability of getting Golden Freddy across a whole night, which is little under ~0,54%, or 1 in a little over 187.
(100÷(100-((0,99999^535)×100)) = ~187,4153991048)
When you take into account how many people played FNAF, as well as the fact that each player can play multiple nights, Golden Freddy appearing isn't as unlikely as it might initially seem by the "1 in 100000" figure.
And remember, that is just the chances of him appearing for each ONE individual night. Most players will play multiple nights.
When you account for playing 5 whole nights in a row, the odds of Golden Freddy appearing increase to a little under ~2.64%, or 1 in a little under 38.
5 nights × 535 seconds per night = 2675 seconds.
(100÷(100-((0,99999^2.675)×100)) = ~ 37,8852198051)
So, around 1 in every 38 players who play the time equivalent of 5 whole nights will encounter Golden Freddy. Meaning Golden Freddy is a LOT more likely to appear than people might initially think.
I thought it was odd for some eastereggs to supposedly be suuuper rare..yet be ungodly common to see 😅 I guess now I know why!
Thanks for the video
At 3:17, it is mentioned that there is a random(1,000) chance for Golden Freddy A.I. to be present on Nights 2 & 3, and while this is true, this is irrelevant for Night 3 as a later line of code will automatically deactivate Golden Freddy at the beginning of a night in the base game (I.E. Nights 1-5). This also ends up affecting Nights 4 & 5, which have random(100) chances for Golden Freddy A.I. to be present, only for said odds to be irrelevant for the same reason.
Night 2 isn't affected because unlike Nights 3-5, the random function is ran when you reach 1AM, not when the night begins.
Edit: Yes I'm aware the video creator has another video that explains this, this comment is meant for people watching this video that didn't watch the other one where this was explained.
Great analysis. Why they would make these implementation choices is an amusing mystery.
Not a programmer or anything. Was extremely easy to understand thank you!
This integer underflow effect is also what caused Ghandi to go nuclear in the old civilization game.
His aggression started at one, and when he eventually established democracy, it reduced his aggression by two, making it wrap all around to 255 out of 10.
Unfortunately, that's just a rumour and wasn't real. India just focused on science and usually ended up researching nukes first.
7:36 Minecraft: Hold it! You got it all messed up!
so clickteam uses modulo for generating an integer in a range instead of a proper uniform distribution? cool
Another banger, another banger from ItzTaken
@@TheBadDeadFox hombophobic
The 5 frame delay does that the object apearing and the stats going up happens at the same time, its a super nice detail
Very very interesting, I love seeing the technical aspects of stuff like this gone in-depth!
Out of curiosity, do the fnaf world lower tier reapers and unscrew 2 have different odds?
Lower tier reapers don't have lower odds, they just shoot less often. Unscrew odds are 1/30 and 1/600 for enemies and bosses, while Unscrew 2 is 1/20 and 1/500.
great video :) was easy to follow as a guy who knows 0 coding and failed highschool math
I have never played a fnaf game but I still find this type of content very interesting.
I have a question, do you think the pizza sim glitch will ever be patched? I don’t know if these games get frequent patches im just wondering
Not on Steam, Scott has not patched anything in a very long time, and the only recent patches were to bugs with the application as a whole. I don't know about the ports, maybe? Most glitches are still present in the ports, but I do know they have patched a couple.
Me: just trying to enjoy my day happily as a FNaF nerd.
This guy:
Never stop these types of videos
true
man the shadow bonnie one is so goofy literally everyone thinking they are getting stupidly lucky and it's just so goofy