SMB3 Roulette & Card Matching Games Explained

2024 ж. 20 Мам.
345 292 Рет қаралды

Ever wonder why the roulette game in Super Mario Bros. 3 seems so difficult? It's all explained right here.
LINKS
Support the channel on Patreon: / rgmechex
Join the RGMechEx Discord Server: discord.rgmechex.com
Follow RGMechEx on Cohost: cohost.org/RGMechEx

Пікірлер
  • I knew it! I knew there was a random delay in that damned game. My whole life, I've tried to master that game, but there's always been something odd happening with it not slowing and stopping right. I originally thought it was just some frame lag. I feel vindicated now.

    @FluffyTheGryphon@FluffyTheGryphon7 ай бұрын
    • And now that's in virtually every free android match 3 game. Lolz

      @georgeyreynolds@georgeyreynolds7 ай бұрын
    • Last one always felt like chance

      @DarrenDignam@DarrenDignam7 ай бұрын
    • I don't think that was a mistake--it's effectively a slot machine, it's supposed to give you an illusion of control about winning (based on the first two) and then take away your agency (third one).

      @Sauraen@Sauraen7 ай бұрын
    • So if i account for that, i can pretty much win every time

      @2yoyoyo1Unplugged@2yoyoyo1Unplugged7 ай бұрын
    • You can guarantee the first, get the second about 50% of the time, and you can't do anything about the third.

      @Oneiroclast@Oneiroclast7 ай бұрын
  • One hilarious thing is, the Nintendo Power Strategy Guide for Mario 3 included a diagram of all eight possible configurations. So someone noticed this flaw early on.

    @random832@random8327 ай бұрын
    • They decided to market it as a feature, not a bug.

      @Wendy_O._Koopa@Wendy_O._Koopa7 ай бұрын
    • @@Wendy_O._Koopa To be fair, NOA nor Nintendo Power would have not known how the game was programmed, so many "bugs" were featured as tricks and tips out of ignorance of it being unintended

      @xxEzraBxxx@xxEzraBxxx7 ай бұрын
    • @@xxEzraBxxx I still have that Strategy Guide, and the wild thing is (well, _another_ wild thing) that the diagrams aren't screen shots (which back then meant physically using a camera to take a picture of the TV) they're hand drawn. Which means (I'm speculating) that they assumed there were going to be hundreds, thousands, maybe millions of combos; and were writing them down by hand (so as not to waste film). Soon they discovered that there were only eight, and they didn't have to figure out any "tips _or_ tricks," just post those few... only they didn't have pictures. Anyone can draw a Super Mushroom, right? Well, for some reason they're green... like dark green stems and light green caps, and orange and red spots. To be fair SMB3 Super Mushrooms _are_ orange and red... but not like _that._ And the 1up chests? they're just blocks that say 1up. The flowers and stars look alright, the coins for some reason are rings with either 10 or 20 written inside of them. I used to think Sega stole Sonic's rings from my bracelets, but maybe it was from Nintendo Power? _Freaky._

      @Wendy_O._Koopa@Wendy_O._Koopa7 ай бұрын
    • @@Wendy_O._Koopa I highly doubt they would start writing them down by hand or even take photos of it if they thought there would be hundreds of combos. The only way it makes sense to begin drawing them down is if you happened to notice you got duplicates first, or had some suspicion there were a manageable amount

      @ITR@ITR7 ай бұрын
    • @@ITR First of all, you realize that by "writing them down" I mean in some form of shorthand, right? Like FSEF2M-1M2EM1-SFSMFS where E=Extra Life and 1 & 2 equal 10 & 20 coins, etcetera. And, yes I guess it makes sense that they suspected they had a manageable amount; but the best way to find out how many is to just take notes as you go. I know this isn't the original drawing, because it reuses all it's assets, the Mushrooms may look strange, but it's the same strange looking Mushroom each time.

      @Wendy_O._Koopa@Wendy_O._Koopa7 ай бұрын
  • Ever since I was a kid, I knew about the 8 card arrangements. I also thought it was just that they had hard coded those eight boards and the only RNG was to determine which of the eight you got.

    @slightlyevolved@slightlyevolved7 ай бұрын
    • I only ever encountered seven boards. And I had them figured out by myself.

      @niemand7811@niemand78117 ай бұрын
    • Yup. Noticed and noted them all myself. Maaaybe I spent too much time on that game.

      @musaran2@musaran27 ай бұрын
    • Ironically it seems they must've wanted to keep that cause every remake of SMB 3 from then on did keep the 8 configurations and given they were all written from the ground up and it seems unlikely they would deliberately keep unnecessary code with such a glaring bug, but also... the fact that you could memorize the 8 decks is challenging yet fair enough for any casual player and we all generally agreed the roulette minigame was bull, but... given the end of level cards are super easy to match and all you get are lives, it never really bothered us. Yet another case of turning a bug into a feature (hello SMB wall jump)

      @MarioMastar@MarioMastar7 ай бұрын
    • The boards were published. Probably nintendo power.

      @emptiester@emptiester7 ай бұрын
    • ​@@emptiesterI had the published boards on Nintendo power

      @TBPony@TBPony7 ай бұрын
  • As a PBS kid, that opening thank you message put a smile on my face.

    @yodal_@yodal_7 ай бұрын
  • These videos are always right to the point, are laid out in an understandable manner despite their complexity, and never use obnoxious music or flashy images. Please never change.

    @AlexxForest@AlexxForest7 ай бұрын
    • Agreed 💯

      @MLife1000@MLife10007 ай бұрын
    • Yes! Very easy to watch where even if you don't understand math or know how programming works, it still is fairly easy to understand and if you DO know how those work, it's a nice bonus on rewatch. These youtubers make WAY better teachers than actual professors at college.

      @MarioMastar@MarioMastar7 ай бұрын
    • I beg to differ, I wish he instead would create clickbait titles, put his face on the thumbnail with him looking shocked and an arrow pointing to a blurred out section of code. I think something like "The Reason You Never Beat This Minigame!" or "Why You Always Were Terrible At This Popular Game." Those are my favorite videos, this one is also missing a animation of a mouse clicking a like and subscribe button with that sweet sound effect. I'm also really disappointed there wasn't a 2 minute Nord VPN ad and a 4 minute Raid: Shadow Legends ad in the middle of it.

      @Alexander_Grant@Alexander_Grant7 ай бұрын
    • The illustrations are really well done too and often go the extra mile to look smooth or informative, but without drawing too much attention away from the narration. This is such a perfect channel.

      @MusicByproduct@MusicByproduct7 ай бұрын
    • I immediately went to the author's patreon page and contributed some. Please stay like this!!!

      @yutubyuku@yutubyuku7 ай бұрын
  • I wonder if the last 3 cards was actually an easter egg, or if the minigame was originally going to have one fewer column, the shuffling code was written for that, and then they forgot to change it after adding the last column (e.g. maybe when designing the graphics they realized they had more screen real estate than they initially guessed)

    @ericpeterson6520@ericpeterson65207 ай бұрын
    • It would be really odd for them to have one less column, assuming the plan was always to be able to match every card. That might not be the case, of course; but hard to really make any calls on it given it's a pretty odd quirk to begin with.

      @hokostudios@hokostudios7 ай бұрын
    • I was thinking perhaps they were intending on randomizing the number of cards involved in the rotation, which could add a bit of random spice of the number of cards involved is set to something between 2 (doing some swaps) and 18 (cycling the whole set of cards)

      @ferociousfeind8538@ferociousfeind85387 ай бұрын
    • its a pairs matching game so having 3 less cards wouldn't really work since thatd give us an odd number of cards.

      @feronanthus9756@feronanthus97567 ай бұрын
    • @@feronanthus9756 ​ @hokostudios Yeah that's a good point lmao

      @ericpeterson6520@ericpeterson65207 ай бұрын
    • Actually, according to the Cutting Room Floor, the game was originally going to have a 'wild card' this would make sense if it was 15 'cards' and a wild card, then adjusted to 18 by just putting 3 cards at the end

      @novamaster0@novamaster07 ай бұрын
  • Fascinating! I always thought the Card Matching game just used hardcoded sets and wasn't determined by an algorithm. The weird thing is, in New Super Mario Bros. Wii, the equivalent maching game in Toad Houses actually _does_ use hardcoded sets (or rather, they're defined by the level data).

    @Skawo@Skawo7 ай бұрын
    • Interesting

      @Eventlesstew@Eventlesstew7 ай бұрын
    • You are both right, its random but that randomness only allows 8 possible sets,

      @arielgomez4951@arielgomez49517 ай бұрын
    • @@MarioMasta64...this video literally explains that it doesn't.

      @Skawo@Skawo7 ай бұрын
    • ​@@Skawoonly 8 sets are actually created. i even made a tool that helps you win the game with a max of 1 wrong answer so that you can get every item

      @MarioMasta64@MarioMasta647 ай бұрын
    • @@MarioMasta64...but they are not hardcoded. An algorithm creates them. That's the whole point.

      @Skawo@Skawo7 ай бұрын
  • It's entirely possible that they implemented the algorithm, but decided that having true total randomness for the card layouts wasn't what they wanted, and made intentional changes to limit the possible outcomes to just eight sets. It's hard to know what really happened, but it's fascinating to learn they weren't simply hard-coded layouts!

    @RupeeClock@RupeeClock7 ай бұрын
    • Considering their past experience with SMB2 Japan/The Lost Levels being rejected by Nintendo of America and them having to repurpose Doki Doki Panic because the other game was just too damn hard, and how SMB3 is not exactly the easiest of games and is a big one, they may have decided that giving a couple extra easy-to-attain power-ups for your inventory was a nice way of smoothing out the experience a bit. Also, the fact that the N-card game rarely appeared for those who didn’t know exactly how to trigger it made it more difficult… As a player who never had access to Nintendo Power but who had quite a lot of hours of gameplay, I quickly realized there was a limited number of arrangements and, over time, developed my own strategy to identify which of them it was, and figured that starting from the corners was an easy one (stars usually bunch up there). I developed a sort of a “feel” for it, and kind of have a mental model of how they’re structured, so I usually clear the board in a couple of attempts.

      @Mainyehc@Mainyehc7 ай бұрын
    • @@Mainyehc It was more rejected because it was SMB1 but with new graphics, different levels and few new elements (aka "Mission-Pack Sequel") and not necessarily because it was too hard (though it's still a contributing factor, just not the only one). What's even further funny is that SMB2 (the international version) originally was a Mario game before it was repurposed as a promotion to Fuji Television.

      @MarioFanGamer659@MarioFanGamer6597 ай бұрын
    • I had exactly the same thought. Bug or a clever way to limit it to just a few layouts by commenting out a few lines? It appears the feature was completely implemented and changed during play testing.

      @christophermcclellan8730@christophermcclellan87307 ай бұрын
    • @@Mainyehc N-card game appeared at regular intervals [it was just every 80,000 earned points], the white mushroom house and treasure ships were the ones with esoteric activation requirements.

      @random832@random8327 ай бұрын
    • I also imagine this shuffle code routine probably predates SMB3, they reused it, but didn’t need all the features and didn’t bother modifying it, instead choosing to find parameters that produces the 8 variants.

      @jonwallace6204@jonwallace62047 ай бұрын
  • i genuinely have no idea what he ever talks about in any of his videos i just think learning about the inner mechanations of my favorite childhood games is neat

    @idkissausername1667@idkissausername16677 ай бұрын
  • On one hand, your videos make me nostalgic for the good old days of programming in assembly and telling the CPU exactly what to do without any intermediaries. On the other hand, this video shows exactly why programming in assembly isn't so great, and modern programming paradigms with like, unit tests and stuff, results in better quality. :D

    @ToastyKen@ToastyKen7 ай бұрын
    • ahh, the good ol' days...and by good i mean significantly more frustrating...

      @P-nk-m-na@P-nk-m-na7 ай бұрын
    • yeah as someone who struggles to get anything working in Python or Lua, I respect the effort of ASM devs but not necessarily the grind due to how stuff like this happens all the time - like at least modern languages flag syntax errors for example

      @SnoFitzroy@SnoFitzroy7 ай бұрын
    • @@SnoFitzroy Assemblers flag syntax errors too.

      @Skawo@Skawo7 ай бұрын
    • While true, I think the point worth noting is that the goal of modern tools is to try to get logic errors to be present as synatx errors. Or at least more broadly to turn runtime to compile-time errors whenever possible. It's a big part of why I like functional programming.

      @THEmuteKi@THEmuteKi7 ай бұрын
    • Yeah modern programming is good and all, but has your code even only worked when your cpu is cold enough?

      @mazionach@mazionach7 ай бұрын
  • Perhaps the most interesting facet of all is the fact there's a similar dynamic to the Mario 3 card shuffle in New Super Mario Bros Wii's "Power-Up Panels" minigame, with only a single-digit number of possible panel configurations for each Toad House. Perhaps they liked how the limited number of configurations had become compelling, satisfying "insider knowledge" among veteran players, and hoped to replicate that in the Wii title?

    @underrated1524@underrated15247 ай бұрын
    • There may be something to that idea. Japanese gaming culture is very collaborative, and finding and telling people about secrets is a major aspect of it. Some games (like Tower of Druaga or the original Siren) are even intentionally obtuse to foster this kind of collaboration

      @BinaryHedgehog1@BinaryHedgehog16 ай бұрын
  • I feel that the LFSR should be used to determine the number of videos it takes before the LFSR is mentioned again. Just for the sake of consistency.

    @sixft7in@sixft7in7 ай бұрын
    • Good call.

      @strangejune@strangejune7 ай бұрын
    • Lol glad I'm not the only one who had this kind of meta thought about if when he posed the question 😅

      @revenevan11@revenevan113 ай бұрын
  • This channel is right at the edge of my ability to understand, and I love it.

    @maker0824@maker08247 ай бұрын
    • It's 25% something I understand, I work with codes so it's a bit easier to understand, the nes is the basic regarding understanding code

      @HUYI1@HUYI17 ай бұрын
    • Love your pfp! I'm right there with you in terms of understanding level, but I can follow assembly pretty well because of watching Ben Eater and from playing games like TIS-100 (iirc that's what it's called) that use a sort of pseudo-assembly.

      @revenevan11@revenevan113 ай бұрын
  • The shuffle methods actually aren't great even as described, without the bugs. If you arrange just the first 15 cards in 5 columns by 3 rows, the two operations can be described as: triple swap: move all the cards in one column up, taking the top one and looping it back to the bottom. rotate: move all the cards in the leftmost column to the right side of the tableau, then triple swap this column. because of this, there are only 3^5 * 5 = 1215 possible layouts of cards even if done perfectly: you have five columns of fixed content, each in the same circular order but with possibly different starting points, and the list of columns is also always in the same circular order with possibly different starting points. The added three cards at the end throws this pattern a little out of obviousness because the columns in the shuffle method are no longer lined up on the screen.

    @unspeakablevorn@unspeakablevorn7 ай бұрын
    • Much more intuitive explanation as for why the answer is 1215 compared to the way I calculated it (using MAGMA to calculate the order of the generated permutation group, lol).

      @AJMansfield1@AJMansfield17 ай бұрын
    • It strikes me as pointless. Either the purpose is to genuinely shuffle, and repeating a dumb random swap (or draw) does the trick. Or it is to be gameable, and it should show the shuffle or drop other hints.

      @musaran2@musaran27 ай бұрын
    • Thanks for explaining that. Good video, but I thought the maths on the permutations was off.

      @oc-steve@oc-steve7 ай бұрын
    • yeah i noticed this, given that only 15 cards get "shuffled" and the triple swap is between every 5th card, there are 5 fixed sets of triplets that never leave their groups (columns in your description) if the triple swap was between every FOURTH card instead, then triplets would be able to mingle (e.g. cards in positions 1 5 9 could be swapped and then 5 9 13). The rotation of cards then would also create a different triplet at the end (after a single rotation the triplet that contained cards 7 11 and 15 would contain 8 12 and 1 which would not be able to mix otherwise) - it would take many shuffles but at least in theory any card could end up anywhere of course this assumes a correctly coded algorithm and sufficient repeats - i'm not certain on the maths of the combinations here with the set rotations and repeat limits etc. but i'm pretty sure it's a damn sight more possible sets than 1215 picking 3 cards to swap that are each 5 apart in a set of 15 seems like such an obvious basic maths thing that makes me think it was intentionally to limit the possible outcomes

      @kackers@kackers5 ай бұрын
    • @@kackers The word you're looking for is coprime.

      @johnmoser3594@johnmoser35944 ай бұрын
  • So, the first slot you can get correct all the time, easy. The second slot is 19/32 = 59% if you time it right in the middle of the possibility space. The third slot is 16/64 = 25% chance to win, if you're going for the star, with every position being equally likely and no strategy can improve it. So *14.8% chance total*, with perfect timing! It's actually amazing how many people in the comments say they could "get the star every time" as a kid, it really shows that memories get seriously inaccurate if you let them sit for too long 😄 (And this is one reason why gambling is dangerous, you always think you've "figured it out" even when it's purely random...)

    @AzureLazuline@AzureLazuline7 ай бұрын
    • They must be confusing the roulette game, with the end-of-level cards. Ironically stars are the easiest to get in the end-of-level cards.

      @aaendi6661@aaendi66617 ай бұрын
  • I love what you're doing for people who are interested in programming. I'm not one of them so I don't understand much, but I think it's really cool

    @SoushinSen@SoushinSen7 ай бұрын
  • Makes sense for the roulette. I used to get the first two rather routinely, the third was random. I just timed for when the item I wanted (the star) was in the middle. Looking at this, it actually makes sense. The first one is entirely skill based. The second, you'll get it about 59.357% (19 / 32) of the time assuming your timing is anywhere near decent. And the last one is 25% no matter what. So the odds of getting the best item, the star are about 100% * 59.375% * 25% = 15%. So you'll average about .742 lives every time you play the game if you go for the star since it's worth five lives. But if you go for the mushroom, the odds are 100% * 59.375% * 50% = 29.7% since the mushroom makes up half of the slots. However, you only win 2 lives, so the lives per game fall back down to .594. Still best to go for the star.

    @JonSmith-hk1bq@JonSmith-hk1bq7 ай бұрын
  • I wonder if they changed the roulette logic when they ported the game over to All Stars. I feel like it was a lot easier to match the roulette than pure random chance would suggest. Or maybe I just always went for the mushroom because it felt like that was easier to get.

    @digitrev@digitrev7 ай бұрын
    • All stars was the only version I had growing up, I was too young for the NES era. I was positive that the roulette stopped on the icon one step to the right (for the top and bottom parts) and left (for the middle part) of whatever was in the center when you pressed the button.

      @kerbe3@kerbe37 ай бұрын
    • @@kerbe3 I had the same impression as a kid. I remembered the roulette game being more consistent. It would definitely be interesting to see if the code is any different in All Stars, or if this is a Mandela Effect (read: faulty human memory.)

      @michaelcalvin42@michaelcalvin427 ай бұрын
    • all-stars code is nearly 1:1 to the original nes version, apart from the hardware/16bit stuff and other things they added like saving.

      @jokuemt@jokuemt7 ай бұрын
    • If the roulette had really been that easy, you would have been getting your chosen item pretty much every time. Timing games like this correctly is significantly easier than most people realize. For instance, arcades sometimes have this game with a circle of bulbs lighting up one at a time, like the light is racing around the circle. You have to hit a button when a certain bulb is lit up. If you disable the random delay that is inserted after pressing the button, you can quickly learn to get it right every single time. In fact, try picking any light that isn't the jackpot light and stopping on that one every time. You'll find it is remarkably easy. And those games are way faster than this roulette. So unless you were successful nearly every time, my guess is you just had a false impression of how the game worked.

      @EebstertheGreat@EebstertheGreat7 ай бұрын
    • @@EebstertheGreat That's the thing. I definitely remember getting it right nearly every time. But that could be a false memory; I could just be forgetting all the times I got it wrong.

      @michaelcalvin42@michaelcalvin427 ай бұрын
  • I can't get over how great your content is. Not just the great examination of the code, and the outstandingly clear explanation at you go, but the visuals that really bring it all together. I love it!

    @BrownR87@BrownR876 ай бұрын
  • Your videos are awesome as always, but one thing I've always enjoyed in particular is the backgrounds to each video, customized for the style of the game in question, plus the game-accurate fonts used. My favorite of all is definitely the SNES hardware videos; since they're not tied to a game at all, we get this awesome dark gray background with the very specific font used; all reminiscent of the CRT TVs themselves and the fonts they'd use for the OSD. This gives that whole series the feeling of explaining the Retro Game Mechanics of no game at all, seeing the style of the underlying hardware when there really wasn't a particular style of pure SNES hardware design. The font and color were excellent choices, and I loved the entire feeling of that. *spoilers* EDIT: I never knew the 8 layouts of the card game weren't intentional, and those programming oversights are hilarious. Generate a random number and then never actually use it.

    @smcgamer1@smcgamer17 ай бұрын
  • I like to imagine that during late playtesting they found the card game to be highly frustrating and went in last minute to gimp their glorious algorithms on purpose.

    @pskry@pskry7 ай бұрын
    • The triple swaps made me wonder about that... but there's no way that the rotate failing to use the result of the randomizer was on purpose.

      @MrCheeze@MrCheeze7 ай бұрын
    • I'm a software engineer myself. You'd be surprised what we do when the business changes their mind last second.

      @pskry@pskry7 ай бұрын
    • Highly frustrating? Not sure this makes sense. Matching cards is just matching cards

      @wonderguardstalker@wonderguardstalker7 ай бұрын
    • Then just allow more misses, or reduce the number of different cards. Get rid of the coins, say.

      @drachefly@drachefly7 ай бұрын
    • @@drachefly abysmal "solutions"

      @TheJacklikesvideos@TheJacklikesvideos7 ай бұрын
  • Excellent analysis! Fascinating how this kind of overslight regarding the card game slipped into production.

    @Bisqwit@Bisqwit7 ай бұрын
  • I was intrigued at the beginning of the video, because as a kid, I always sucked at remembering the 8 card games, but I used to nail the roulette almost every time. I had to press the button perfectly every time. It felt like a small time window, but it didn’t feel frame perfect. 3 frames makes sense. You had to time your presses exactly right from the start. But you only had one try, if you waited too long to press the button on the 2nd or 3rd segment, there was no chance of re-timing it. Or, I guess I was just some kind of superhuman.

    @jhsevs@jhsevs7 ай бұрын
  • The different card rotating and swapping steps makes me think they had some kind of animation planned but didn't get around to implementing it.

    @Badspot@Badspot7 ай бұрын
  • Wow, I always figured there was some RNG with the timing of the regular spade game, so that part doesn't surprise me too much. However, with the N-spade's board layouts, I always assumed they were hard-coded in as well, and never even considered the possibility that they were the result of oversights in the shuffling routine. That also explains why many of the possible layouts often share certain characteristics, like how the 10-coin cards are often diagonal from each other, and the 20-coin cards are often neighboring each other. And yes, I did notice that the last three cards were always mushroom, flower, star on every layout way back then, when I read a Nintendo Power guide that showed all eight possible layouts. This made it even easier to memorize the patterns and fully clear the N-spade game consistently.

    @SomeGuy712x@SomeGuy712x7 ай бұрын
    • I think that the last three cards being identical on every layout makes it possible to devise a strategy that consistently full clears the card minigame without flipping a non-match for information (meaning that the single mistake the game allows can be used as a defense against misclicks).

      @TurboGhast.@TurboGhast.7 ай бұрын
  • 0:45 I love that sweet reference to PBS's "Thank you" message! You're very welcome!

    @GamingSpirit79@GamingSpirit797 ай бұрын
    • same

      @IAMJARRICO@IAMJARRICO3 ай бұрын
  • I honestly thought the card matching game routine was even simpler than that. I thought there were just a set number of layouts and the game cycled through them. The fact every single card layout was shown in a book sent with my Nintendo Power subscription as a kid convinced me as much. Who knew that that the fact there were so few card layouts that you could print them all in a strategy guide was due to bad coding? Wow.

    @MrMegaManFan@MrMegaManFan7 ай бұрын
    • @mrmega Thank you That’s how an old lady had those card game answers in a notebook I use to copy She loved Mario She stayed up all night playing Mario games on the NES

      @eharris6347@eharris63476 ай бұрын
  • Wonderful explanation - I love how the mistakes interact to so drastically reduce the number of possibilities! It seems strange that nobody noticed the error, after working that hard to get a random shuffle. And I love LFSRs - they sound like they should never work, but somehow can produce a random-looking loop of numbers

    @DavidXNewton@DavidXNewton7 ай бұрын
  • Awesome video. It's always pretty funny to see games misbehaving like this because of oversights from the developers!

    @darvil82@darvil827 ай бұрын
  • Even if the shuffling routine was made perfectly, it would not be very random. Consider the 1st, 6th, and 11th card. If there is a triple swap with any of them, it includes them all. This means that those three cards will always be separated by 4 cards. This is the same for all the 5 triples. Then we get only 3⁵×5 = 1215 unique positions (choose which triple has the first card, and the rotation of each of the five triples). This does not overcount.

    @canaDavid1@canaDavid17 ай бұрын
  • omg so glad I found this channel. I did a little 8 bit programming in the 80s and I'm still fascinated by it. Love your illustrations in real time, with the numbers swinging through their places as the processor moves through the code.

    @TheRealShedLife@TheRealShedLife6 ай бұрын
  • REALLY enjoy these videos! Thanks for all the hard work on these!

    @donchaput8278@donchaput82787 ай бұрын
  • I must have recognized way back when that there were clear differences in timing to get a specific outcome on the roulette but I didn't realize just how bad the variance is. Wow.

    @THEmuteKi@THEmuteKi7 ай бұрын
  • Any day RGME uploads is a great day! The moment I saw the JSR followed by AND I KNEW that was gonna be the problem, I've done that while making homebrew way too many times lol

    @mazionach@mazionach7 ай бұрын
    • To be fair this is a mistake easy to make when you write code to return a value in the accumulator, it's not unlikely they had this in mind and legitimately forgot to also load the value after returning from the subroutine. I know I have made this mistake for that exact reason, haha!

      @VinsCool@VinsCool7 ай бұрын
  • great video! I'm very appreciative of your excellent captions

    @_graybee@_graybee7 ай бұрын
  • man i just love these videos. they remind me why i got into coding, it's such an interesting way of problem-solving and i love imagining the thought process of the people writing these games.

    @sierranicholes6712@sierranicholes67127 ай бұрын
  • Back in the day, I didn't think the roulette game was all that hard. I almost always could get the star (and it's 5ups). You just had to know exactly when to stop the wheels. (On a CRT, that was easy being there's no video lag.) In spite of the few patterns that existed, I never was that good at the card matching game.

    @georgef551@georgef5517 ай бұрын
  • man i love these kinds of videos, especially when they contain some kind of fixable programming oversight/mistake. wonder what other NES/Gameboy/etc games have stuff like that

    @proxy1035@proxy10357 ай бұрын
  • Great video, hope you show more related with SMB3, i love this game, and I am learning ASM

    @haodkuma9449@haodkuma94497 ай бұрын
  • 10:24 I was learning how shuffling algorithms work a while ago, and came across the Fisher-Yates shuffle. The problem is that it cannot generate EVERY possible permutation using pseudo-random number generator if the number of possible RNG seed states (2^n, where n is the number of bits) is less than NumberOfItems factorial. This means, for example, if you use a 16-bit RNG, you cannot have more than 65536 possible arrangements.

    @ghb323@ghb3237 ай бұрын
    • Another problem is that even if you have more RNG states than the number of arrangements, it actually has to exceed the number of arrangement by "at least several orders of magnitude" else certain permutations happens at a higher probability than others. This is according to Wikipedia on Fisher-Yates shuffle on Pseudorandom generators. I can't link it here because youtube's anti-spam/scam is false-positive prone and will delete my comments.

      @ghb323@ghb3237 ай бұрын
    • When doing n factorial and you increase n, it grows "exponentially fast", thus you need a massive memory if you are shuffling a large number of items.

      @ghb323@ghb3237 ай бұрын
    • @@ghb323 I'd mention that factorial doesn't just grow "exponentially fast" but in reality, it grows even faster than that because at some point, the numbers added to the factorial are larger than the base. That being said, I doubt shuffling a number of items requires a lot of memory or at least any more than double the size of the list.

      @MarioFanGamer659@MarioFanGamer6597 ай бұрын
    • @@MarioFanGamer659 Yeah, that’s why I wrapped it in quotes. Wikipedia stated it grows faster than exponentiation.

      @ghb323@ghb3237 ай бұрын
    • @@MarioFanGamer659 You could use hardware RNG, but be careful that this relies on physical phenomenon and is subject to degradation and could eventually be in a state it outputs uneven distribution of random numbers(some values occurring more often than others). On emulators, they may falter since they themselves might use PRNG to emulate the hardware RNG or use the computer’s rng.

      @ghb323@ghb3237 ай бұрын
  • These discussions are so informative. I wonder if you could show us in any NES baseball game how the game decides where the ball ends up when you’re batting :)

    @7thangelad586@7thangelad5867 ай бұрын
  • I love how you put the subtitles to the side when there's something to see that would normally be under it.

    @rando.m.e@rando.m.e7 ай бұрын
  • I love the editing! Thank you!

    @MemoGGG16@MemoGGG167 ай бұрын
  • I can't believe the 8 arrangements weren't hard-coded, wow. Mind blown.

    @Tharronis@Tharronis7 ай бұрын
    • Algorithms are computationally cheaper than hard coding.

      @emptiester@emptiester7 ай бұрын
    • @@emptiester Not always. Case in point: if your algorithm is bugged and produces fewer configurations than you were planning to generate, so hardcoding eight arrangements would take less data.

      @oldvlognewtricks@oldvlognewtricks7 ай бұрын
    • @@emptiester "computationally cheaper" doesn't usually mean "less memory", which is almost always the only benefit of using an algorithm instead of hard-coding.

      @vibaj16@vibaj167 ай бұрын
    • True but honestly i suspect that they made it properly, but ended up changing their minds and tweaking it to allow a manageable set. This just strikes me as intentional.

      @blender4464@blender44647 ай бұрын
  • Great presentation, interesting and infuriating at the same time - I always blamed myself when I failed on the roulette stage.

    @AAjax@AAjax7 ай бұрын
  • Brilliant animation with the cards. Great work!

    @sofyankarim@sofyankarim7 ай бұрын
  • Absolutely fantastic breakdown! Insane how much work was lost because of that error!

    @jansenart0@jansenart07 ай бұрын
  • Learning so much about the OG SMB3. Nice to know the mechanics of the card-match and roulette games haha Do you know if the code is any different for the SM: All-Stars or SMA4 variants? An explanation or mini-follow up video would be awesome ^^

    @checkitout134@checkitout1347 ай бұрын
    • All-Stars code is nearly identical to the NES version, the games in All-Stars are essentially direct ports with some tweaks and of course new sprites and sound. No idea about Mario Advance 4, though I'd assume it's a port of the All-Stars version but I don't know that. Edit: Just checked TCCF, Advance 4 is a direct port of All-Stars, so it should still be the same unless Nintendo specifically decided to change it.

      @legoboy7107@legoboy71076 ай бұрын
  • Props to you already using the new patreon logo! Regardless of how people feel about it (I’m personally not the biggest fan of the blob) that is the kind of attention to detail I’ve come to expect from this channel

    @JMPDev@JMPDev7 ай бұрын
    • Time flies, already another one? Last change was in 2020

      @Liggliluff@Liggliluff7 ай бұрын
  • That card shuffle/folding animation was oh so good. Chef's kiss

    @GalacticRod@GalacticRod7 ай бұрын
  • I love the LFSR videos. Its fun to see how different each implementation is

    @ipaqmaster@ipaqmaster7 ай бұрын
  • I would be interested to know if it works the same in Super Mario All-Stars and/or Super Mario Advance 4. Also, you probably get this a lot, but the visuals in your videos are downright amazing. Like, there's really big impressive things where you script it to display information in ways that are really intuitive to interpret. But it also goes down to minute details like the way you show the XOR in the LFSR explanation, having the lines, er, "line" up with the parts of the XOR symbol.

    @sedme0@sedme07 ай бұрын
    • All-Stars should be identical, the games in that collection are just direct ports of the NES code with some tweaks, SMB3 having probably the fewest tweaks of them all. No idea about Advance 4 but if it's a port of the SNES version like what I'd expect then it would probably still be the same, but I don't know for sure that it is a direct port. Edit: Actually, just looked it up on TCRF, Advance 4 IS a direct port of the All-Stars version, even STILL having NES leftovers. So it's probably the same there too.

      @legoboy7107@legoboy71076 ай бұрын
    • @@legoboy7107 Interesting. I didn't realize that the CPU in the Super Nintendo used an expanded version of the 6502 instruction set. However, GBA uses ARM, which means it'd have to be rewritten entirely from scratch, I think. At that point, they very well may have made minor tweaks to the behavior of the code that are unnoticeable to most players.

      @sedme0@sedme06 ай бұрын
    • @@sedme0 That's a good point, I didn't think about that. SNES to GBA ports were pretty common, but yeah I guess under the hood they would have to make more substantial tweaks just to get the games to run due to the different CPU, which could very well alter things like this; certainly way more than what they'd have to do to go from NES to SNES, namely almost nothing.

      @legoboy7107@legoboy71076 ай бұрын
  • I find this interesting in the fact as a kid, I could pretty much time the roulette to give me a Star almost every time. I was never able to figure out the N-Spade patterns though. 🤔

    @nonix81@nonix817 ай бұрын
  • Fun fact: even if (just) the first fix was applied to the shuffle logic as explained at 18:09 , there would not be 15^3 = 3375 possible outcomes as a result, but only 225. The second change at 18:21 would increase this to a mere 1050 instead of 216000. That's because the triple-swap is symmetric to rotations of multiples of 5, i.e. triple-swap + rotate 5 has the exact same outcome as rotate 5 + triple-swap. So the first case effectively ends up with 15 cases of rotation plus 2 triple-swaps at arbitrary offsets with 5 cases each (order does not matter, thus cases total and not 25) (plus the third triple-swap at fixed offset of 0), thus 225 total. The second case is a bit more complicated but similar. Only the last suggestion would increase the number of cases as intended - to 88990.

    @kabuto3907@kabuto39077 ай бұрын
    • Fun fact: tRump lost the election

      @Michael_Beanflip@Michael_Beanflip7 ай бұрын
  • Great job with the explanation and animations!

    @robert36902@robert369027 ай бұрын
  • That's weird, I found the roulette felt really consistent and I won it a lot.

    @IanZamojc@IanZamojc7 ай бұрын
    • Yeah the roulette was consistent for me too and the card matching was never a strong suit

      @AshleyTMDW@AshleyTMDW7 ай бұрын
    • @@AshleyTMDW”strong suit” I see what you did there

      @rruhland@rruhland7 ай бұрын
    • If the 3rd wheel is effectively random, then you will win 1/3rd of the time at least if you consistently get the first 2 wheels. It's probably confirmation bias.

      @QuasarEE@QuasarEE7 ай бұрын
    • @@QuasarEE Perhaps, but it just didn't feel as unwinnable as the video claims it is.

      @IanZamojc@IanZamojc7 ай бұрын
  • 0:20 With the 3 part roulette, I found the first to be random. But in actuality, I always managed to match the second if I hit one early...press the button on star and i would get the mushroom every time. For the final slide, there was a pixel error where the two slides met...6 pixels would flash in succession. Press the button when the pixel lined up and it worked every time. You can actually see it on screen. So yes there was randomness, but defects in the game made it easier.

    @mrgreatbigmoose@mrgreatbigmoose7 ай бұрын
  • That card-shuffling animation you made was _very_ smooth.

    @cycloneblaze@cycloneblaze7 ай бұрын
  • I didn't know the card shuffle game was supposed to be pure random. I wrote them down out of curiousity, and I had a hunch they were a set, and I did get a set, but I only found out now they did some extra work with the card shuffle game. It's really fascinating how games and applications were programmed back in the day, nowadays we high level programming languages, but watching videos of how the old program code works, it's like you're thinking how the machine would see the numbers, instead of just translating your concept into text that can be translated into compiled code.

    @sea4874@sea48747 ай бұрын
  • The roulette game may have been more random than what it seems, but if you have good timing you can consistently win. I remember as a kid hitting A immediately when the game starts and then hit A just slightly before the previous image stops. It lines up 3 mushrooms, but hey it's better than not winning. I'm sure theres a way to time the star but I never cared to figure it out.

    @MartyNES1@MartyNES17 ай бұрын
  • (8:05) I assume that is to add the human element. The game will continue to randomise until the player continues. So you have the pressing the button to the map and dialogue adding randomisation. Having the second and third wheel not affected by the timing you press the button does have an affect on using save states, and that's kinda interesting.

    @Liggliluff@Liggliluff7 ай бұрын
  • Even if the order of triple swaps and rotations was completely arbitrary, the algorithm could still only generate 1215 permutations. To see this, let us examine the possible moves: Rotate (ROT) Triple swap from position 1 (TS1) Triple swap from position 2 (TS2) Triple swap from position 3 (TS3) Triple swap from position 4 (TS4) Triple swap from position 5 (TS5) Let us notice that in the following table, any sequence on the left side of an arrow produces the exact same permutation as the one right of it: ROT-TS1 -> TS2-ROT ROT-TS2 -> TS3-ROT ROT-TS3 -> TS4-ROT ROT-TS4 -> TS5-ROT ROT-TS5 -> TS1-ROT ROT-ROT-ROT-ROT-ROT -> TS1-TS2-TS3-TS4-TS5 Let us take an arbitrary sequence of moves. If we find a subsequence that is in the left column of our table, we will replace it with the corresponding sequence in the right column. For example, the sequence TS1-TS3-ROT-ROT-TS1-ROT will become TS1-TS3-ROT-TS2-ROT-ROT after we apply the rule ROT-TS1 -> TS2-ROT. Let us note that no matter what rule we apply, the number of ROT moves will either decrease, or a ROT move will move right in our sequence. As such, if we apply the rules recursively, we will eventually be left with a sequence where no rule can be applied anymore. This sequence will still produce the same permutation as the original. What will our sequence look like after we can no longer apply any rules? It will consist of a number of triple swaps followed by at most 4 ROT moves. This is because if there was a ROT move before a triple swap or if there were more than 4 ROT moves at the end, a rule could be applied. We will finish by realising that the order in which we perform triple swaps doesn't actually matter. TS1-TS2 will produce the same effect as TS2-TS1, for example. As such, the only thing that matters is how many times we have performed each type of triple swap. Furthermore, performing the same triple swap three times does nothing. As such, any arbitrary sequence of moves may be reduced to the following, in this exact order: No more than 2 TS1 moves. No more than 2 TS2 moves. No more than 2 TS3 moves. No more than 2 TS4 moves. No more than 2 TS5 moves. No more than 4 ROT moves. There are a total of 3^5 * 5 sequences of this form, or a total of 1215. You may take some time trying to convince yourself that they do not contain duplicates. I believe this can most easily be seen by examining where the first 5 cards end up after any arbitrary shuffle. As such, the video from around 12:20 is wrong. One shuffle can only produce 1215 outcomes. Furthermore, a single shuffle will actually produce every possible outcome with an equal probability. The subsequent shuffles are completely pointless. But the video is right in saying that there are a lot of duplicates.

    @andrasfogarasi5014@andrasfogarasi5014Ай бұрын
  • To quote a certain coolkid: That's a hell of a mystery no one thought was a mystery and didn't even really need solving but damn if it didn't just get solved so nice work.

    @GGCrono@GGCrono6 ай бұрын
  • Do you know if the All-Stars version of the roulette is any different? Anecdotally, it always felt easier to me, but I don't know if that's just confirmation bias.

    @Goombachi@Goombachi7 ай бұрын
    • mario 3 all stars is nearly 1:1 the code of the nes version, its probably identical honestly

      @capnkatie@capnkatie7 ай бұрын
  • So wait, if the second and third bars' slip amounts are frozen while playing, is there any correlation that would allow you to predict how much the third bar will slip from how far the second bar slipped?

    @BagOfMagicFood@BagOfMagicFood7 ай бұрын
    • not really, because the info that is now in the second rng slot(second bar) is generated from the info that is now in the third slot (third bard) and the fourth slot, and even then the second bar only use 5 bits of the second slot rng value. Even if you knew the 5 bits, you can't use this info without the fourth slot values to try to get the third slot values

      @jeromefournier5233@jeromefournier52337 ай бұрын
  • Just discovered this channel. I too always wondered why I could never master the timing of that roulette game. But it all makes sense now. Yes, the delay of the last row was noticeably longer. Mind blown by the "not so random" card matching game. Like others, I feel it was on purpose though.

    @slicendyce2@slicendyce25 ай бұрын
  • I had always assumed that the 8 arrangements were hard coded! I guess you learn something new every day.

    @marblemaster1@marblemaster17 ай бұрын
  • What's funny about this is that I never learned the matching game layouts as a kid, so never cared for that game, but I could fairly consistently win the slot game. Regardless of how the code should make it unpredictable, it usually is a fairly simple timing minigame. Stop the first real when the picture you want is in the center. Stop the second just before the picture you want is fully centered. Stop the third just as the picture you want is leaving the screen. The RNG does beat it sometimes, but this method served me very well as a child.

    @ShelbyAQD@ShelbyAQD7 ай бұрын
  • i played SMB3 once on the NSO emulators and checked out mentally right after failing the spinny minigame. It was so far off of a match I actually couldn't believe I did so poorly. Feels good knowing this specific instance isn't just me being bad at video games for old people!

    @SnoFitzroy@SnoFitzroy7 ай бұрын
  • I think it's a crime that this channel only has 196k subs. I find all these videos really interesting despite not really knowing how to code.

    @Kylefassbinderful@Kylefassbinderful7 ай бұрын
  • 3:18 🏳️‍⚧️

    @lilylyons8885@lilylyons88857 ай бұрын
  • The video I didn't know I needed. Brilliant.

    @RetroSho@RetroSho7 ай бұрын
  • Thank you, very interesting video. I also want to say that I can see that you are not using clickbaity titles and thumbnails and the videos are very to the point without stupid jokes and trying to mix-in the ad with the video content. This is very much appreciated even though it puts you at a disadvantage in the toxic world of youtube algorithm. Thanks for staying true to quality.

    @grussser@grussser7 ай бұрын
  • thank you for the great explanation!

    @ericsbuds@ericsbuds7 ай бұрын
  • thank you for making the subtitles not clash with the any of the actual text

    @thezipcreator@thezipcreator7 ай бұрын
  • There was a time when I was young when I had all the card layouts mesmerized and I was pretty good at the match game too. We had an official SMB3 Strategy guide that had them all too, wish I still had that.

    @AkaBigWurm77@AkaBigWurm777 ай бұрын
  • Really interesting and informative vid, it’s crazy how two separate mistakes combined just enough to ruin the whole rng process for card matching

    @wigglebot765@wigglebot7657 ай бұрын
  • Just having this for my own purposes, at 3:49, "Roulette_Run" is Roulette_Run in program 22, at 8:18, "Randomize_Roulette" is right after JSR Read_Joypads and before PRG022_CF7C, at 13:07, "Card_Shuffle" is Card_Shuffle in program 22, and at 15:50, "Randomize" is Randomize in program 30.

    @TheNoSwearGuy@TheNoSwearGuy7 ай бұрын
  • bro that intro brings me back... AND ALSO I KNEW IT! THERES A DELAY BEFORE IT STOPS

    @IAMJARRICO@IAMJARRICO3 ай бұрын
  • Also, I forget if i've said before, but I see and appreciate your use of dyslexic-friendly fonts in your title and end screen

    @HmmmmmLemmeThinkNo@HmmmmmLemmeThinkNo4 күн бұрын
  • Hi Retro! These videos are so good.

    @General12th@General12th7 ай бұрын
  • I love these old school video game breakdowns. When I was a kid I'd spam the A button on these card games and I'd get 2-up the vast majority of the time. When I tried to do it again last year when I was humoring speedrunning it and practicing/needing lives I just could rarely re-create my childhood experience.

    @AtomicBLB@AtomicBLB6 ай бұрын
  • Fascinating to know the code behind both mini-games. For the roulette wheel, I always thought that it would determine your chances of a win based on the top wheel -- so if you got a mushroom, the chances were much higher compared to if you got a star, and that the game would just "give" you the prize if you rolled a win no matter when you pressed the button as opposed to the delay and such involved. And likewise, I thought there really were just eight arrays of cards that were chosen at random instead of broken code that made a true shuffle fail to operate properly.

    @Wyrenth@Wyrenth7 ай бұрын
  • I have positively zero reason to doubt this because you've looked at the actual code, but I always thought the roulette was all down to timing! I had a rhythm down that would win it what I thought was far more often than not, but that could have been just confirmation bias. Seeing the bare bones of it here, it doesn't seem like there's any way my timing was that good, nor would the timing I had correlate to one specific result!

    @batlrar@batlrar7 ай бұрын
  • It's wild that within the past week or two I got curious about the permutations and what the optimal selections are to identify which board layout you're on. I'm going to speak about these card locations as spreadsheet cells, as that will be easiest for text. If you start with A2, it's the only cell that contains all 6 cards across the eight boards, meaning that as long as you don't see a 10 or 20 coin, you'll immediately know what board you're on. If you reveal a 10 coin, immediately select F2, because on both layouts with a 10 coin at A2, the other 10 coin is at F2. From there, the closest card that will confirm what board you're on is E1, with all 5 other cards around it being identical between both boards. If you reveal the 20 coin, A3 will be a 50/50 shot of being a 20 coin or a star, confirming which board you'll be on. From there, simply know the layout of all 8 boards, and you're golden.

    @cliftonchurch6039@cliftonchurch60397 ай бұрын
  • your animation is astounding.

    @DigiTheInformer@DigiTheInformer7 ай бұрын
  • Yet another fantastic video! I love seeing the assembly code, guess these bugs are just natural to occur given how it was directly programmed by humans. Mad respect to all antique assembly programmers!

    @glitchy_weasel@glitchy_weasel7 ай бұрын
  • Now I know why hearing the sound of the mini-game at 8:08 caused me 36-years-old anxiety

    @aquietdragon5671@aquietdragon567123 күн бұрын
  • Thank you for explaining the lfsr! I can finally make one.

    @Poyo77750@Poyo777503 күн бұрын
  • I noticed that delay on the roulette game, and proved it by recording some gameplay on VHS. It wasn't until I could show actual timestamps on the machine that my friends finally believed me. Also with the card flipping game, you actually need to flip over 3 cards before you can be 100% sure which table you're looking at. A lot of the cards are in the same positions on multiple tables. My go-to is to always start with the bottom two cards in the left column, you can narrow it down to one of two tables. Then place your third choice at the bottom of the second column and you know which one you have.

    @adamb89@adamb896 ай бұрын
  • Great video! Nice to see the different ways LFSR are used to make the classic games easier or harder than it seems. I just noticed a little inaccuracy in your video: The shuffle algorithm is much worse than you said - because a shift moves a triplet to a triplet there are only 3645 possible arrangements of the cards that can be achieved by the theoretical algorithm with 15-card rotations, no matter how many times you repeat it, and the common bits of the consecutive outputs of the LFSR and the fact that even triplets of 18 cards go to one another after some numbers of shifts would mean that even after your corrections the algorithm would still have orders of magnitude less possible outcomes than you said. Also, the variance (in the mathematical sense) of a discrete uniform random variable with n possible values is not n but (n^2 - 1)/12. Other than that, it was a really good and enjoyable video, thanks!

    @roeesi-personal@roeesi-personal4 ай бұрын
  • That shuffling animation was so smooth

    @funniflow@funniflow7 ай бұрын
  • That's fascinating. Now I want to see the same thing for the SMB2 slot machine game. I mastered that one to where I could nearly always get 5UP, nothing, 5UP, nothing etc., and it's such an odd pattern I always wondered why it worked out that way.

    @MindWandererB@MindWandererB7 ай бұрын
  • I used to do a clacking maneuver with my fore and index fingers. When i got the timing right, it was a star every time lol Good nostalgic video.

    @zeldafreak1975@zeldafreak19756 ай бұрын
  • Love the video as always! Even as a kid I always thought the roulette game was rigged, and this finally explains why it's always easier to get the first two matches than the third one. The match game was easy though, because I just used the guide in Nintendo Power every time. 😁

    @ScottDotDot@ScottDotDot7 ай бұрын
  • Okay so I used to watch PBS Kids a LOT when I was little, and ooooohh my god the “Viewers like you, Thank you!” I swear is ripped directly from those childhood memories

    @jakint0sh@jakint0sh5 ай бұрын
  • The 2^3 version of the matching game can be won without misses, and the board identified in 3 moves or less. The 14th card (column 2, row 3) will match to either a shroom or flower (both of which are known to be in the lower right), or unique boards for each of the possible 1up, 10 and 20. For the 2nd draw, if still unknown, the 13th card is a star 80% of the time, but a known 10 the other 20%. Third, the 7th card is unique among the 4 remaining boards, and thus each indicates the remaining possible boards.

    @jansenart0@jansenart04 ай бұрын
  • Unbelievable production value wow

    @pm2453@pm24536 ай бұрын
  • That explains so much. I could always get the first two segments, but that last one screwed me every time. Now I know why.

    @rich1051414@rich10514147 ай бұрын
  • When I was a kid I was pretty sure the card matching was fixed sets as once I found a couple locations I knew where the rest were. And for the roulette if you match the top 2 there is a sliver at the bottom of the second one, match it and win everytime.

    @RighteousImp@RighteousImp6 ай бұрын
KZhead