Super Mario World - Random Number Generation

5 okt 2016
290 664 visningar

How does random number generation work in Super Mario World? It's all explained right here.
Twitter (updates):
Patreon (support):
Discord (discussion):
Learn more assembly instructions: Coming soon!
SMW Yoshi Clips Explained:
SMW Powerup Incrementation Explained:

  • I was currently looking into implementing the code myself and I noticed there slipped in a mistake in the Java code shown in the video. You are XORing the same array value with itself, which results in all zeros. It should be rng[0] ^ rng[1], right?

    BombastischBombastisch18 timmar sedan
  • 4:22 what language is used?

    Spükii TVSpükii TV18 dagar sedan
  • Me: hearing EOR instead of XOR Me: * insert suprised pikachu face *

    RagerQueue487RagerQueue48724 dagar sedan
  • Is the on-screen code at 4:57 pseudocode or an actual language?

    OheadOheadMånad sedan
  • I understand subpixels as a luck factor, since it's just down to a game having more precise movement than the graphics allow the player to (normally) manipulate. But I don't get speed oscillation

    Wulfhere CyningWulfhere CyningMånad sedan
  • I feel like i’m watching a video for school, but in a good way

    I can’t Think of a nameI can’t Think of a nameMånad sedan
  • Wait...Magikoopa is a GIRL?

    Darkness LightDarkness Light2 månader sedan
    • Well kamek isn't idk about that specific magikoopa

      hexxhexxMånad sedan
  • Speedrunners should be watching this so they can truly understand RNG so they don't spam the use of the word as their excuse for failures.

    Darkness LightDarkness Light2 månader sedan
  • Nah bro it stands for American Sign Language

    TheZestfall 1stTheZestfall 1st3 månader sedan

    Patrick WangPatrick Wang3 månader sedan
  • Jesus loves you, so consider him today! You don’t know how much time you have left, so don’t put it off until tomorrow.

    WittyWitty4 månader sedan
  • Urchins can also blink in practice in SMW, though.

    Simo HeinonenSimo Heinonen4 månader sedan
  • Wow this makes me a lot smarter

    Evan a or random guy who dose not upload HaywardEvan a or random guy who dose not upload Hayward6 månader sedan
    • Well this would be needed for one part of my dream to come true

      Evan a or random guy who dose not upload HaywardEvan a or random guy who dose not upload Hayward6 månader sedan
  • Why aren't the other SMW videos available anymore?

    JamieVegasJamieVegas6 månader sedan
    • @Retro Game Mechanics Explained Awesome! Love the content.

      JamieVegasJamieVegas6 månader sedan
    • Are you talking about the ones shown at the end of the video? They are on my other channel--made before RGME existed!

      Retro Game Mechanics ExplainedRetro Game Mechanics Explained6 månader sedan
  • Still patiently waiting on the "Learn More Assembly Instructions" link in the description. Though you're still producing great content, so I'm willing to wait as long as it takes. Plus, it's not as if there aren't other resources on the 65816/5A22 that explain the instructions and much more.

    Nothing\Nothing\7 månader sedan
  • Hey. I know this is an old video. But the java program is displaying only a lot of zero's. I changed the last line of tickRNG to: rng[2+y] = (byte) (rng[0] ^ rng[1]); And it worked perfectly. I hope it helps

    Mark Devlin DungoMark Devlin Dungo7 månader sedan
  • I love this. Assembly is still the dark arts for many people, and it's often brushed over or dumbed down, so to have it explained this way is very helpful. More please!

    Nebula RainNebula Rain8 månader sedan
  • This man has an exceptional "lecturer" voice! 🙌👍

    Gmwilkie GeorgeGmwilkie George8 månader sedan
  • I have an arabian girlfriend... i think i can hear her "S" is ticking...

    ArathokArathok8 månader sedan
  • I thought magikoopa was a dude.

    DrewPicklesTheDarkDrewPicklesTheDark8 månader sedan
  • my original impression from the thumbnail was that there is a tiny asian in the cartridge that solves a rubiks cube repeatedly, and the random number is how many milliseconds it takes to solve it each time

    John WeberJohn Weber8 månader sedan
  • I know this is off topic, but his videos are so cleanly edited.

    Emerson EEmerson E8 månader sedan
  • Nice

    everyoneeveryone8 månader sedan
  • I played the game long enough to know some of those events ARE NOT RANDOM!

    UnrealVideoDukeUnrealVideoDuke8 månader sedan
  • Wait, I thought magi-koopas were male and just Kamek was female?

    Matthew JonesMatthew Jones8 månader sedan
    • @Matthew Jones Kamek is male. Kamella is the female one. But yeah, I’ve definitely always considered Magikoopas male by default. So, other than that bit of trivia, you just voiced my sentiments 👍🏻.

      Simo HeinonenSimo Heinonen4 månader sedan
  • i have never ever even thought about checking candle animations and lava splash. This is kind of wild since the snes allowed for a kind of limited ammount of code

    Paulo ManganoPaulo Mangano8 månader sedan
  • Im taking an intro to machine code class, and somehow this is all clicking in my head!

    LaFrance Daniels IIILaFrance Daniels III8 månader sedan
  • aw i wanted to see the first two luck based events lol is/will there be another vid abt that

    badman jonesbadman jones8 månader sedan
  • Bit stands for Bit test asdasd

    James BlaserJames Blaser8 månader sedan
  • this is too compleceted for me

    Babu and Buba BrosBabu and Buba Bros8 månader sedan
  • 10:08 For some reason I find this hilarious.

    NoriMoriNoriMori8 månader sedan
  • Nice.

    PiggieFatNosePiggieFatNose8 månader sedan
  • Does anyone know how to find his speed running channel?

    thecianinatorthecianinator8 månader sedan
  • "Asl = Arithmetic Shift Left" Me: "Asl = Age Sex Location"

    Spencer oximinaSpencer oximina8 månader sedan
    • A simple lute

      Tarskybull BemeTarskybull BemeMånad sedan
    • Anglo-Saxon Literature

      Kadir GaripKadir Garip2 månader sedan
    • A sS funnLy meme

      Ariel SproulAriel Sproul3 månader sedan
    • American Sign Language

      Neosi AxiomNeosi Axiom8 månader sedan
  • I’m too stupid to understand these videos, but still am entertained.

    MrJibakuMrJibaku8 månader sedan
    • @Nothing\ You are welcome my friend. I will continue to spread positivity

      ShadowPersonOfTheUnknownShadowPersonOfTheUnknown2 månader sedan
    • @ShadowPersonOfTheUnknown Thank you. I very much appreciate your genuine compliment. Such things are rare on SEworld comments, or the internet in general. So it's quite a welcome change. Keep spreading that positivity, bro. Cheers. =D

      Nothing\Nothing\2 månader sedan
    • @Nothing\ I have to agree with Evan or a random guy that dose not upload Hayward (lol). You're quite knowledgeable, and that's not sarcasm.

      ShadowPersonOfTheUnknownShadowPersonOfTheUnknown2 månader sedan
    • Me too. Some of these I can understand though.

      Cheep Chomp GamingCheep Chomp Gaming3 månader sedan
    • @Nothing\ I fully agree. Practice, and *ONLY* practice makes perfect. No-one’s born a blacksmith.

      Simo HeinonenSimo Heinonen4 månader sedan
  • @6:10 It should be (note the index 0): rng[2+y] = (byte) (rng[0] ^ rng[1]); instead of: rng[2+y] = (byte) (rng[1] ^ rng[1]);

    JosaphJosaph9 månader sedan
  • Me, knowing nothing about coding or computing, absorbing close to no information: Omg...The RNG...

    PixxPixx10 månader sedan
  • All of the constant RNG calls call the RNG on 2^n frames.

    Isaac TIsaac TÅr sedan
  • 11:47 Pac-Man?

    Zoey PeteZoey PeteÅr sedan
  • I think that the best RNG would be produced by a mic, temperature, and light sensor combo. Although the mic itself would be pretty good, but all it takes is the internet to crack that kind of RNG, so maybe software RNG based off of the inputs would be a better option.

    Redstone TechRedstone TechÅr sedan
  • I wanna learn more about assembly

    Pika Pika!Pika Pika!År sedan
  • Magikoopa is female?

    Blade the CatBlade the CatÅr sedan
    • That's my thought exactly.

      Gabe PuratekutaGabe Puratekuta8 månader sedan
  • Arithmetic Shift Left (ASL).... Was this mispronounced (arithmetic as in math) or is it just a different *arithmetic"?

    Joseph CalandriaJoseph CalandriaÅr sedan
  • I wonder, couldnt the RNG-seed just get updated after every frame as well by taking values from other registers? Like Marios position, powerup state or a combination to avoid running into a predictable state?

    BenBenÅr sedan
    • @Minjae Song sadly true..

      BenBen9 månader sedan
    • @Ben They totally could have done that but some reason that "some value" is always zero, as we know :\

      Minjae SongMinjae Song9 månader sedan
    • @Minjae Song hm... different alternative could be that at each level start, you seed your RNG with some values that you have been tracking.

      BenBen9 månader sedan
    • Ben Probably devs thought that's too much work AND performance drop for some inconsequential effects in the game. Even though the RNG seems cheap computationally, calling it every frame would make them not-so-cheap, especially with our poor 65C816

      Minjae SongMinjae Song9 månader sedan
  • how do you edit your vídeos?

    KcirehKcirehÅr sedan
  • Hello, could you make an assembly tutorial for beginners? I know it is not exactly related to your channel, but it still is. For example you could teach us program mos 6502 processors since many consoles used those back in the 8 bit times

    Universe 123Universe 123År sedan
    • @Retro Game Mechanics Explained Thank you so much, this will surely help a lot of us to understand everything better. 👍

      Universe 123Universe 123År sedan
    • Yes, this has been the plan ever since I started the channel. I've recently started working on it, but it may be a longer while until it is released since I want to have at least one unit complete before uploading them, as opposed to uploading them as I make them (to ensure the flow and progression is correct).

      Retro Game Mechanics ExplainedRetro Game Mechanics ExplainedÅr sedan
  • 1:00 3rd slot is nice

    I is dedI is dedÅr sedan
  • What is the middle game at 13:21 (the one that looks like a Yoshi FPS)?

    Christopher HorneChristopher HorneÅr sedan
    • @Retro Game Mechanics Explained Cool, thanks for the response! I somehow missed that one. I vaguely remember hearing about it but never played it.

      Christopher HorneChristopher HorneÅr sedan
    • Yoshi's Safari

      Retro Game Mechanics ExplainedRetro Game Mechanics ExplainedÅr sedan
  • Learn more assembly instructions [edit: wasn't made] and youtube removed the annotations feature :(

    omer dassaomer dassaÅr sedan
    • btw, I really liked the videos you did end up making and found them really intresting. So no pushing mm.

      omer dassaomer dassaÅr sedan
    • Oops, that what I meant to point out, but somehow i forgot to write the whole sentence XD.

      omer dassaomer dassaÅr sedan
    • To be fair, I still haven't made the video it was meant to link to...

      Retro Game Mechanics ExplainedRetro Game Mechanics ExplainedÅr sedan
  • Your understanding into the details on this is mind blowing. I'm impressed!

    Shaun ClarkeShaun ClarkeÅr sedan
  • This is surprisingly similar to DooM, but DooM does a preset deck style rng of a pre generated table of numbers instead of pulling from an actual equation everytime

    SmokecallSmokecallÅr sedan
  • cool video bros

    Jackson LeeJackson LeeÅr sedan
  • why they didn't use the user input as a source of entropy to seed the PRNG? For example, every time the user presses a button, the current value of the internal H/V counter latch is captured and sent to the PRNG

    Gianluca G.Gianluca G.År sedan
    • @Retro Game Mechanics Explained I see. Anyway, very accurate and in-depth explanations on your videos, very well made, congrats!

      Gianluca G.Gianluca G.År sedan
    • Well in this case, it's not possible since controller button presses don't generate interrupts--the controller doesn't tell the CPU that a button was pressed, rather the CPU checks on the controller when it needs to. But in general, latching the H/V counters is possible. I believe Yoshi's Island does this, just during the generation routine instead of on a button press.

      Retro Game Mechanics ExplainedRetro Game Mechanics ExplainedÅr sedan
  • 1:02 Nice Nice Nice Nice

    TwinPlayzTwinPlayzÅr sedan
  • RNG in TF2's fighting mechanics is bullshit.

    King HOTCOCOKing HOTCOCOÅr sedan
  • 13:23 What's the game in the middle. Is that a Super Mario Kart ROM hack? Edit: The game is called Yoshi's Safari. It's a SNES Super Scope On-Rails Shooter.

    Timothy FliskTimothy FliskÅr sedan
    • It's called yoshi's safari

      RuebnRuebnÅr sedan
  • Never knew Kamek was a she.

    Timothy FliskTimothy FliskÅr sedan
  • My boss calls the RNG to determine whether or not I get a raise, it never calls back tho.

    LeviathanRXLeviathanRXÅr sedan
    • I dug through reality and broke the wrong block, now I'm laid off. oops

      LeviathanRXLeviathanRX4 månader sedan
    • Does he also call RNG to determine, whether or not he fires you?

      Simo HeinonenSimo Heinonen4 månader sedan
    • It sounds like it's calling to the wrong area in the ROM. You might need to pipe through the floor to reach the ROM and break the block that keeps returning as a 0 for a raise. I warn you though, if you aren't careful you'll corrupt reality.

      BlazingShadowSwordBlazingShadowSword8 månader sedan
  • Part 2?

    ceilingchair28ceilingchair28År sedan
  • Category: *_P e o p l e a n d b l o g s_*

    Cj HumphreyCj HumphreyÅr sedan
    • In video about numbers and software.

      Val OchVal OchÅr sedan
  • Is Magikoopa canonically female? I always assumed male, with that Merlin the Magician get-up

    Bryan LiguoriBryan LiguoriÅr sedan
  • Nerd! .... Absolutely beautiful analysis

    Mic kMic kÅr sedan
  • 0:56 69 XD

    Moadot720Moadot720År sedan
  • I really appreciate your channel. Love how you get into the details

    Leet HacksLeet HacksÅr sedan
  • My god man, you're a mad genius.

    MagoArcadeMagoArcadeÅr sedan
  • I turned on captions just to see if RNG would be read as orangy

    Monica TMonica TÅr sedan
    • Me and Orangey are gonna go get stoned Bubs

      thecianinatorthecianinator8 månader sedan
    • Lol

      YolwoocleYolwoocleÅr sedan
  • Despite Super Mario World supposedly being rushed, they sure did put a lot of effort into those birds on Yoshi's House.

    ??????År sedan
  • I actually challenged myself by replicating this in Minecraft 1.14.2

    Spükii TVSpükii TVÅr sedan
  • Rng example the Dino torch

    Jackson GamingJackson GamingÅr sedan
  • I'm not sure if your formula at 5:26 works when the 7th bit of T_n is set. Evaluating floor((255-2*T_n)/32) mod 2 when the 4th bit of T_n is not set and the 7th bit is set comes out to 1 when it should be 0, floor((255-256)/32) = floor(-1/32) = -1 = 1 mod 2. And if both the 4th and 7th bit is set, floor((255-288)/32) = floor (-33/32) = -2 = 0 mod 2. Unless I'm reading it wrong and it's round towards zero / truncate?

    IronLotusIronLotusÅr sedan
  • Just .... awesome, thanks.

    M BM BÅr sedan
  • 11:47 Pac-man!

    Quinn 78Quinn 78År sedan
  • I am the only person that appreciates this, but thanks for using an actually possible Rubik’s cube position in the video. 1:03

    Xavier GillmerXavier GillmerÅr sedan
  • Resetting the RNG at the end of each level seems like kind of an odd choice to me.

    Jean-Philippe ParadisJean-Philippe ParadisÅr sedan
    • Until you consider that SMW was made to be a game, not an engine. Things like the Super Koopas have to be placed exactly the same at the start of some levels - same with the boo clouds.

      Endy MallornEndy Mallorn8 månader sedan
  • I like the intro sounds, glitched extended 1up sound from SMB3

    idabomb00idabomb00År sedan
  • Thanks for the assembly code from the SMB3 rom! It's great to see deep explanations for this cool stuff!

    David LoucksDavid LoucksÅr sedan
  • What is the real purpose of the RNG function returning two random values? Why would you need two results for every call when most calls only need one value?

    marscalebmarscalebÅr sedan
  • This reads like a scientific paper, this is really incredible.

    Joseph BushJoseph BushÅr sedan
  • So... is it: Yellow koopa - random turn-arounds Green koopa - no turn-around Red koopa - turn-around when approaching a ledge Blue koopa - when hit, spawns a strong koopa that kicks shells. Rainbow koopa?

    CoolwoobyerCoolwoobyerÅr sedan
    • Rainbow Koopa? You mean what happens when an unshelled one gets into a yellow shell?

      Gabe PuratekutaGabe Puratekuta8 månader sedan
    • No, the yellow koopa has randomised turns

      CoolwoobyerCoolwoobyerÅr sedan
    • If i remember right the yellow koopa follows you

      biddy foxbiddy foxÅr sedan
  • Everybody knows RNJesus controls RNG

    Kars The Ultimate Life FormKars The Ultimate Life FormÅr sedan
  • But first we need to talk about parallel universes Kappa

    Facehunter2003Facehunter2003År sedan
  • talk about sonic 1 finall boss random pistons

    redgamer21redgamer21År sedan
  • Wait a minute... FISHBONES CAN BLINK?!

    The Tomato WatcherThe Tomato WatcherÅr sedan
    • @iBrow no, watch the video closely... They use a different method than the wall-traversing enemies, and you can SEE them blink

      The Tomato WatcherThe Tomato WatcherÅr sedan
    • no. he said only the hot heads can blink, but the others still call rng because they share a bit of the code with hot heads

      iBrowiBrowÅr sedan
  • 0:58 *laughs at 69*

    RubyPiecRubyPiecÅr sedan
  • Next time, can you do something on subpixels? Thx!

    DaFuriouS [GD]DaFuriouS [GD]År sedan
  • There was alot more random things in this than I expected, and most of them are completely pointless lol.

    TheJadeFistTheJadeFistÅr sedan
  • I didn't know the yellow koopa even turned around lol.

    TheJadeFistTheJadeFistÅr sedan
  • Oh boy, I can't wait to learn more assembly instructions!

    MullkawMullkawÅr sedan
    • We need to learn reality-assembly to call the assembly video

      Ariel SproulAriel Sproul3 månader sedan
    • Guess you can, or, must, because that still hasnt happened.

      j259abcdj259abcd6 månader sedan
  • 13:37 Well, I have a question: Those gambling machines with video poker (which you see a lot in Las Vegas) - are they truly random? Is that an example of hardware-based? Because I assume that they would legally have to be in order to be considered “fair”. Thanks, ~J.J.

    J.J. The GreatJ.J. The GreatÅr sedan
    • Things like slot machines get regular inspections to ensure they are operating as they should. So the answer to your question is yes. It would depend on the implementation on whether it was hardware- or software- based, but I would guess that if it were software-based, it would be much more complex than what was shown in this video.

      Retro Game Mechanics ExplainedRetro Game Mechanics ExplainedÅr sedan
  • It's impossible for the rubik's cube at 1:28 to be in that state - and it just so happens the piece that you remove is the incorrect one :P

    Josell MarianoJosell Mariano2 år sedan
  • old are you.....??? This is a panty dropper if I ever saw one!

    pointedspiderpointedspider2 år sedan
  • You could also use the system clock to generate the seed bytes. That would still be psuedorandom but would be much more difficult to find repeats.

    Daniel John KirbyDaniel John Kirby2 år sedan
  • The implementation of RNG routine, with the XOR and the repeated values resembles the structure of some hardware entities called Linear Feedback Shift Registers, or LFSR. These are widely used for pseudo random number generation in programmable hardware devices, such as FPGA. Could you confirm? Btw Great video!

    Jose Luis GermanJose Luis German2 år sedan
  • I understand so little of these videos... But I watch them nonetheless.

    BlaineC1972BlaineC19722 år sedan
  • I have no idea how this makes sense but I still want to watch??

    MegwareMegware2 år sedan
  • 6:13 Uncuddled curly braces; shame, great shame.

    Morahman7vnNo2Morahman7vnNo22 år sedan
  • How about Unix-esque entropy?

    Gustavo RehermannGustavo Rehermann2 år sedan
  • uses a 3x3 for a metaphor for the randomness me, a cuber: THAT AIN'T RANDOM!!!!!!

    PixylPixyl2 år sedan
  • Oh boy! ASM tutorial coming soon!

    whiz 85whiz 852 år sedan
  • True RNGs require additional hardware, and hardware costs money per cartridge, while PRNG has a constant cost independent of how many copies you sell

    sundhaug92sundhaug922 år sedan