RNG

  Рет қаралды 283,313

UncommentatedPannen

UncommentatedPannen

8 жыл бұрын

I explain all about how RNG works in SM64. RNG is a short stored at 0x00C7A962. When an object calls RNG, the RNG value is inputted into the RNG function, which then outputs a new RNG value. This new RNG value is given to the object to use and also replaces the old RNG value. RNG starts at 0 when the game is turned on, and then goes through a sequence of 65114 values before repeating. (Note that RNG is not reset to 0 when you change save files.) Thus, 422 of the 65536 potential RNG values can never be achieved.
Big thanks to Tyler Kehne for telling me all about how RNG works and giving me the RNG function code. Also thanks to Peter Fedak for looking into some RNG behavior for me, and thanks to Kaze for answering some of my RNG questions.
To download the list of the 65114 RNG values in sequential order, click here:
drive.google.com/file/d/0B3JC...
To download the list of the 422 unreachable RNG values in numerical order, click here:
drive.google.com/file/d/0B3JC...

Пікірлер: 974
@welcoe
@welcoe 8 жыл бұрын
"only 65114 possible coin trajectories..." What? 65,114 coin trajectories not enough for you??
@YoshiFawful64
@YoshiFawful64 8 жыл бұрын
+Ethan White Well, when you contrast it to 65114^3 (which, to be precise, is 276 072 485 701 544), it's a pretty small number.
@welcoe
@welcoe 8 жыл бұрын
+YoshiFawful64 I know. It was a joke. 😜
@MikeyTaylorGaming
@MikeyTaylorGaming 8 жыл бұрын
+Ethan White Don't worry dude, 37 people understood your Joke ;)
@welcoe
@welcoe 8 жыл бұрын
+MikeyTaylorGaming That's a lot more people than I expected. I expected like maybe 2 or 3.
@Rain0T
@Rain0T 8 жыл бұрын
+Ethan White There can never be enough coin trajectories.
@DouglasZwick
@DouglasZwick 7 жыл бұрын
The goomba's "so, umm..." made me laugh out loud.
@TempestKrimps
@TempestKrimps 5 жыл бұрын
lel me too
@ThisAlias
@ThisAlias 4 жыл бұрын
LoL
@jacobw1780
@jacobw1780 3 жыл бұрын
same
@dawidplata6116
@dawidplata6116 3 жыл бұрын
give me time
@JettJamesGD
@JettJamesGD 3 жыл бұрын
Dawid Plata 8:36
@Tirgo69
@Tirgo69 8 жыл бұрын
i wanted to play mario not get my masters in computer engineering
@dmas7749
@dmas7749 7 жыл бұрын
I'm not big on Mario but I love the vids. Fuck me if I can actually wrap my head around everything at once, despite being actually pretty damn smart.
@jaundicedmisanthrope7817
@jaundicedmisanthrope7817 7 жыл бұрын
did you call yourself pretty damn smart?
@dmas7749
@dmas7749 7 жыл бұрын
I believe I did.
@jaundicedmisanthrope7817
@jaundicedmisanthrope7817 7 жыл бұрын
100% of the people that call themselves smart are idiots.
@dmas7749
@dmas7749 7 жыл бұрын
Whatever
@ronamadeo
@ronamadeo 8 жыл бұрын
Welcome to Pannenkeok University-KZbin's premiere game programming school! This will be on the test later so take notes.
@tankdempsey87
@tankdempsey87 4 жыл бұрын
top 10 spoken sentences before horrible tragedies
@lexo632
@lexo632 4 жыл бұрын
It is on the test.
@9600bauds
@9600bauds 8 жыл бұрын
Shit man. I'm waiting until he uses this to kick dust in the castle for 7 minutes, then uses perfectly manipulated RNG to get a goomba exactly where he needed it or something.
@TylerKehne
@TylerKehne 8 жыл бұрын
You must not have seen the THI ABC videos.
@neekk040
@neekk040 7 жыл бұрын
holy shit snarby, the rare ocurrence of another SK player popping up!
@planetearth2249
@planetearth2249 5 жыл бұрын
RNG function: Stop! I'm exhausted! Mario: C'mon! I just need to get that goomba right where i need it!
@wagnerjunior5935
@wagnerjunior5935 5 жыл бұрын
@@neekk040 Sex jokes not allowed!
@florix1057
@florix1057 5 жыл бұрын
@@neekk040 SK doesnt exist wym
@plushifoxed
@plushifoxed 8 жыл бұрын
and if you hack the game to always use value 2401 you unlock luigi
@Zalied
@Zalied 8 жыл бұрын
it be interesting to see how the game runs with a limited RNG value.
@qwertyuiopthepie1070
@qwertyuiopthepie1070 7 жыл бұрын
That'd be really entertaining to watch, actually. Not sure if it's possible to 'lock' the RNG variable, though.
@JamUsagi
@JamUsagi 7 жыл бұрын
It wouldn't be too difficult to lock the RNG value, since the code seems to be self-contained. Just replace all that calculation with a quick "input = 2401".
@aurelia65536
@aurelia65536 7 жыл бұрын
Jeesaf Oceanleft *IMAGINE THE COINS*
@GiuseppeGaetanoSabatelli
@GiuseppeGaetanoSabatelli 7 жыл бұрын
Couldn't you just use a GameShark to keep RNG constant? In the same way it keeps live or health constant? You just need to know the address for RNG.
@maxamaxa194
@maxamaxa194 8 жыл бұрын
So you could influence when a bomb-omb blinks, when a spinner moves, and the angle a coin flies at, by kicking up dust from marios shoes?
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
exactly
@maxamaxa194
@maxamaxa194 8 жыл бұрын
hmmm, its very Buddhist
@dabs4270
@dabs4270 4 жыл бұрын
Mario's dust is more powerful than the master sword from legend of zelda lol
@EmanueleX
@EmanueleX Жыл бұрын
this is now the main strategy of the most recent A press saves lol
@BlarggOMighty
@BlarggOMighty 8 жыл бұрын
Good lord, imagine what this guy could do to Smash
@nikodemus0552
@nikodemus0552 8 жыл бұрын
+SPUTNIK. Fucking true.
@gillfortytwo
@gillfortytwo 8 жыл бұрын
His brother is Borp lol
@sporkralfio9350
@sporkralfio9350 7 жыл бұрын
Good guy, imagine what this lord could do to Smash*
@BlarggOMighty
@BlarggOMighty 7 жыл бұрын
spork ralfio
@anastasiadunbar5246
@anastasiadunbar5246 7 жыл бұрын
+spork ralfio You're a big guy guy, imagine what this lord could do to Bane*
@vanderkarl3927
@vanderkarl3927 7 жыл бұрын
I want a mod that makes RNG cycle between those two lonely values: 22026 and 58704. It'd be interesting to see the effect each value had on RNG calls, and also to see how a game with a cycle of 2 RNG values would work.
@SpikeOriundo
@SpikeOriundo 8 жыл бұрын
I don't know what should I do next... Let's call RNG! 58464 Wait, the fuck do I do with this number?
@SSDARKPIT
@SSDARKPIT 7 жыл бұрын
Convert it to binary then...
@thebottlewithoutalix2806
@thebottlewithoutalix2806 7 жыл бұрын
ok i need numbers for xyz values x: 61416 ok y: 61436 srsly z: 16342 ok now rgb r: 62416 g: 46251 b: 63425 calculation: 00e16e ok
@purrplaysLE
@purrplaysLE 7 жыл бұрын
I will call 10 RNGs! 48248 9236 21734 61930 41934 33917 19327 57289 18421 37290 ... is this my code now?
@dekrain
@dekrain 6 жыл бұрын
r1 = getRNG() r2 = getRNG() r3 = getRNG() x = r1 & 0xFF y = r1 >> 8 z = r2 & 0xFF r = r2 >> 8 g = r3 & 0xFF b = r3 >> 8
@thegreatautismo224
@thegreatautismo224 6 жыл бұрын
0-65535 - Watch the Commentated Watch for Rolling Rocks in x0.5 A Presses
@jongyon7192p
@jongyon7192p 8 жыл бұрын
I'll not bog this comment down with how much I LOVE MATH, but somehow my favorite part of the video was the freaking goomba comic instead. Did nobody comment about that? I need to see that animated!
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
lol yeah I wanted to make the point that RNG just gives you a number - it doesn't actually tell you what to do. Everything calling RNG needs to make some sort of rule for how it should react to different RNG values
@The_mario_fan
@The_mario_fan 8 жыл бұрын
Pannen, you seem to make this so easy to understand! I've learned so much in 12 and a half minutes. I'm glad you continue to make these videos.
@federicopassuello8701
@federicopassuello8701 Жыл бұрын
But did you actually never stopped to easier read the explanations?
@Charcoal190
@Charcoal190 8 жыл бұрын
"A Bob-omb calls RNG on every frame in order to determine whether or not it should blink its eyes" Sounds like something you'd hear in a documentary or something
@Charcoal190
@Charcoal190 8 жыл бұрын
"And here, we see a little Bob-omb, trying to decide whether or not it should blink its eyes."
@romajimamulo
@romajimamulo 8 жыл бұрын
+Domilego4 You think it would be using a timer
@PlushSM64
@PlushSM64 8 жыл бұрын
>Not using Bowser dance animation as an example of RNG .-. We want to know what RNG values make him dance :(
@TylerKehne
@TylerKehne 8 жыл бұрын
RNG < 80085
@PlushSM64
@PlushSM64 8 жыл бұрын
+Tyler Kehne So 1/8 rigjt
@PlushSM64
@PlushSM64 8 жыл бұрын
+Plush right*
@guessibetterchangethis
@guessibetterchangethis 8 жыл бұрын
+Plush Considering only numbers 0 through 65535 are allowed, 100% chance!
@PlushSM64
@PlushSM64 8 жыл бұрын
+beester87 Yea I'm confused
@MikeyTaylorGaming
@MikeyTaylorGaming 8 жыл бұрын
Yet another amazing Explanation from this Channel. I absolutely love the detail that you put into the 0 A press commentaries!
@MikeyTaylorGaming
@MikeyTaylorGaming 8 жыл бұрын
Crat Strat Coz I love Glitch explanations and commentaries!
@EaZea
@EaZea 6 жыл бұрын
MikeyTaylorGaming this isn't a GLITCH, random number generation is intended
@helloguys7550
@helloguys7550 4 жыл бұрын
Yes
@helloguys7550
@helloguys7550 4 жыл бұрын
And it is complex
@jongyon7192p
@jongyon7192p 8 жыл бұрын
I can simplify the RNG function to be visible in 1 row. First off: xor 0101 (a) 0011 (b) 0110 (a^b) The ^ means to xor in this case. I know it usually means square/cube/blah but that's what the code uses. Also, think of xor like this. You have a 0 or 1. If a 0 is introduced to it, the number doesn't change. If a 1 is, then it changes, 0 -> 1, or 1 -> 0. So we start with the input RNG value, with 16 bits. I call each bit 0~9, A~F, so they're not numbers, but variables, each signifying the 16 positions of the 2 bytes. [0123 4567 89AB CDEF] Okay, now the first 4 steps are all simple, so I'll just show what the S1 value looks like after everything: (1) !8 !9 !A , !B !C !D !E , !(8^F) 9^0 A^1 B^2 , C^3 D^4 E^5 F^6 (The 1 in parentheses is an actual 1. Don't worry, it'll go away soon, so just deal with the confusion for now.) Here, you know what the (^)s mean, but the (!)? Those are the "NOT" functions. If x=0, then !x=1. If 8=1, !8=0. One more thing to note, the last digit of the current S0 is (7), the 7th bit of the original input RNG value we had. Next, we need to decide between choosing 1FF4 and 8180, as step 5 says. I show if 7=0, 1FF4, 0001 1111 1111 0100 if 7=1, 8180, 1000 0001 1000 0000 =00! !!!1 1!!! 0!00 This is was aligned in notepad, but not here, I guess... I put a space every 4 bits to make it easier to see, like how I put commas every 4 bits in other places I write out the 2 bytes. What I tried to do here is find bits that don't change depending on 7, and there were plenty of that. So, = means that bit is equal to 7. If 7 is 0, it's 0. If 7 is 1, it's 1, you get the point. Now ! means what I mentioned earlier, it's the NOT function. Those bits are opposite of 7. First, I apply the bits that are independent of 7, so those are easier to do. ? !8 !9 ? , ? ? ? !E , !(8^F) ? ? ? , C^3 ? E^5 F^6 And then I add the parts you would have to xor by 7 or !7. ---------------------------------------------- !7 !8 !9 A^7 , B^7 C^7 D^7 !E , !8^F !9^0^7 !A^1^7 !B^2^7 , C^3 !D^4^7 E^5 F^6 ---------------------------------------------- And there it is! Dunno if it's as simplified as it could be, but I tried. There were parentheses, but I removed them cuz the result should be the same without them. Also, I noticed some mistakes in the last few minutes as I was typing this, so maybe if there are more mistakes, pls tell me!
@SuperM789
@SuperM789 2 жыл бұрын
nerd
@jongyon7192p
@jongyon7192p 2 жыл бұрын
@@SuperM789 that IS a mistake
@warmCabin
@warmCabin 8 жыл бұрын
I'd like to see the game with the 560A failsafe removed, and the RNG set to it. Unblinking bob-ombs, only 2 coin trajectories...would goombas just plod around in little circles?
@natnew32
@natnew32 3 жыл бұрын
And freeze the global timer for good measure.
@sm64guy28
@sm64guy28 6 жыл бұрын
No intros, no outros : best channel in all universes (Including parralel ones)
@quinn7894
@quinn7894 Жыл бұрын
(including vertically parallel)
@justlolatthisworld7917
@justlolatthisworld7917 2 жыл бұрын
0:37 "2 bytes, each with 255 values: between 00 and FF inclusive" Actually, each byte has 256 values, not 255. Just like you said, they're from 0 to 255 inclusive (00 to FF inclusive), which is 256 total values. I know that this was just a simple oversight and my comment may seem unnecessary but my pedantic attention to detail sometimes gets the best of me! Thank you Pannen for all that you do. You have provided me with countless hours of genuine learning of game mechanics in a straightforward way that makes it accessible to comprehend what is going on under the hood in my favourite game of all time. Cheers from the UK mate!
@Timohtep
@Timohtep 8 жыл бұрын
I love the fact that you use Powerpoint for your animations. Takes me back to a simpler time.
@KamilDrakari
@KamilDrakari 8 жыл бұрын
Good work on that RNG function Nintendo...
@ParaSpikyHyperGoomba
@ParaSpikyHyperGoomba 8 жыл бұрын
Also, those little animations you do are adorable.
@SuperShadow
@SuperShadow 8 жыл бұрын
So you're saying the simplest RNG movement is actually 4 slots, AKA one QRNG?
@TylerKehne
@TylerKehne 8 жыл бұрын
Don't even start lol
@slashedleaf
@slashedleaf 7 жыл бұрын
you can bet your scuttlebugs that this would have been a thing if the video was commentated
@JumboDS64
@JumboDS64 7 жыл бұрын
exactly what i was thinking
@romantistcaveman
@romantistcaveman 8 жыл бұрын
It's blowing my mind thinking about how this is just one value stored among millions(?) in a relatively older game. Even programming something like Super Mario 64 from scratch today seems daunting as all Hell.
@JasonGodwin69
@JasonGodwin69 7 жыл бұрын
It's beautiful. How would illegal RNG numbers added by codes/mods affect the game?
@UncommentatedPannen
@UncommentatedPannen 7 жыл бұрын
It wouldn't look like anything special
@Bladethird
@Bladethird 7 жыл бұрын
To elaborate. Well, if the code was running normally, you would never notice for 2 major reasons. 1. At 5:59, you see a picture the rng values and where the next one goes. The Purple ones are illegal, since nothing would lead to them. But notice that while nothing would lead into the illegal values, they all will go back into the legal values eventually. The game cycles through 65113 values in 9 minutes (540 seconds), or 120 values per second. If you set it to value [65114]46497, it would cycle back into the legal numbers in 3.5 seconds. You'll be back to legal numbers before you can do anything interesting. 2. Even if you did (say by hacking it in right before breaking a block), the illegal numbers are just rng numbers like the legal numbers. It would be a pattern of coins that you have never seen before, but to a flesh and blood human being like you, it would still look like a random scattering of coins. It would look random to you just like all the other rng numbers. The fact that this specific random would never occur normally doesn't change the fact that its random. The only reason this would be useful if say you need a very specific rng value, but I can't imagine why. None of the code presented in the video reacts interestingly if given an illegal rng value. Either because of modulo or divide by 65536.
@SuperNuclearBoss
@SuperNuclearBoss 7 жыл бұрын
Bladethird divide 130 by deaf and what do you get Lol
@Tsouki67
@Tsouki67 7 жыл бұрын
It wouldn't look like anything special, sure, but your TAS would have a very significant chance of not being valid when read to the modded game, as some objects could have a different property after the same inputs.
@GrayBlood1331
@GrayBlood1331 5 жыл бұрын
Except for the two cycle. I would love to see that!
@theSato
@theSato 8 жыл бұрын
This kind of stuff is so interesting. I've noticed more and more people have found you, I've seen your name and references to you a bit in Twitch the last couple weeks. I'm glad you're getting the recognition! :D I do wish you would do more audio commentary because it is a bit hard for me to read on-screen text from my bed, but this is just a minor complaint - I'm grateful you are making videos at all. ^^
@NathanielBandy
@NathanielBandy 8 жыл бұрын
I don't have a clue what you said but it sounds like you're very intelligent.
@SkicoNow
@SkicoNow 8 жыл бұрын
Hey, I didn't know you watch these videos!
@SuperFromND
@SuperFromND 8 жыл бұрын
I was hoping you'd know who Pannenkoek was.
@omaewamoushindeiru5010
@omaewamoushindeiru5010 7 жыл бұрын
talk about looking stupid lol
@LinksYTLink
@LinksYTLink 6 жыл бұрын
Nathaniel Bandy lol
@meganox937
@meganox937 6 жыл бұрын
256th like!
@chrism5215
@chrism5215 8 жыл бұрын
This was really interesting, thank you. I love your videos, especially ones like this that go deeper into the workings of the game (and potentially show ways the game can be manipulated that aren't immediately apparent).
@Peanut_Arbuckle
@Peanut_Arbuckle 8 жыл бұрын
imagine dedicating your whole life to Mario 64.......
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
:)
@0x20pirate
@0x20pirate 8 жыл бұрын
+Crippling Depression Imagine dedicating the majority of a 12 minute video explaining very tedious entry-level comp sci concepts
@lozganon64
@lozganon64 8 жыл бұрын
Behold
@Fynmorphover
@Fynmorphover 8 жыл бұрын
pls delete this comment, it's insulting.
@trinalmage9446
@trinalmage9446 8 жыл бұрын
+0x20 wow thats rood
@thegreatautismo224
@thegreatautismo224 6 жыл бұрын
>Basic Science >Rocket Science >Aperture Science INTRODUCING LEVEL 4 - PANNENKOEK SCIENCE
@midleno8364
@midleno8364 6 жыл бұрын
now the GLaDOS behavior is decided by what RNG value comes out
@buhbo3250
@buhbo3250 4 жыл бұрын
I may just be underestimating the power of older systems, but the fact that it can call so much RNG so rapidly using such a complex system is amazing to me.
@smellyfishstiks
@smellyfishstiks 3 жыл бұрын
re-watched this, still so good. the bitwise math is really interesting how to makes such a "random" result using the way numbers are stored.
@Spiralviper
@Spiralviper 8 жыл бұрын
This is a pretty ingenious way to generate random numbers! Something we take for granted on a daily basis is actually an incredibly complex system. Now I'm curious to see how this RNG compares to how modern games handle it. Very informative video as always! I nearly jumped out of my seat when I saw this uploaded. I loved every second of it!
@K2JMan
@K2JMan 8 жыл бұрын
Hmm, I would've thought player input would've been a direct parameter to the RNG function, but I guess the dust is a reasonable way to get more unpredictability from the game.
@PowerStreak
@PowerStreak 8 жыл бұрын
Your vids are mad in a wonderful way. I don't program but you do find ways to make it fascinating! Kudos.
@rafaelarevalo8047
@rafaelarevalo8047 8 жыл бұрын
Your level of dedication and knowledge is endlessly fascinating to me. Good stuff.
@ImSquiggs
@ImSquiggs 8 жыл бұрын
Fascinating video, as always. I love the code for the generator, it's cool to see how they did it. I've also never heard of a bijection before. Neat!
@DragonDePlatino
@DragonDePlatino 8 жыл бұрын
Great video! I've recently gotten into roguelike programming and it's interesting seeing how some older consoles handled RNG. Without a system timer, you have to be really creative with those bitwise operations!
@rodneylives
@rodneylives 7 жыл бұрын
Even with a timer, it can be a bad idea to rely on it for general randomness, since the player can then manipulate the starting state by deciding when to start the game. This was the basis for a brilliant NetHack exploit, demonstrated on a public server no less, described here: taeb-nethack.blogspot.com/2009/03/predicting-and-controlling-nethacks.html
@DragonDePlatino
@DragonDePlatino 7 жыл бұрын
John Harris Of course, but that's an extreme edge case. Only a small fraction of players would have a technical undertanding of PRNGs and an even smaller fraction would go through the trial-and-error process of manually seeding the PRNG.
@gambit133
@gambit133 8 жыл бұрын
Your videos are inspiring. I notice the amount of detail in your graphics and editing. Well done.
@MrBorderlands123
@MrBorderlands123 8 жыл бұрын
Just found this on reddit and I gotta say this is awesome! Very well done and explained, hope to see more vids from you these are seriously great.
@leocorn58
@leocorn58 7 жыл бұрын
Can I just say, thank you for this series. I've always wanted to learn coding and how it can apply to game design and development, but it's been a difficult task to get into. These videos are making it a little easier to wrap my thick, dumb brain around these ideas.
@NickTF2
@NickTF2 8 жыл бұрын
This seems like a ridiculously complex way to make a bomb-omb blink every couple of seconds.
@shanewolf38
@shanewolf38 7 жыл бұрын
Wow, beautiful explanation! I didn't expect the RNG function to have a cycled output like it does, that's pretty insane. Awesome function, awesome video! Thanks! :D
@NicD
@NicD 7 жыл бұрын
I find this series of videos incredibly informative and entertaining. And as a game desginer, I can *almost* justify the lost work time.
@Syntherios
@Syntherios 8 жыл бұрын
will this be on the test?
@wispy9859
@wispy9859 6 жыл бұрын
yes
@JovianCloudfarmer
@JovianCloudfarmer 6 жыл бұрын
Did you pass?
@QuinGracia
@QuinGracia 6 жыл бұрын
Syntherios Yes! Now, I caught you cheating. You get an F
@couldntsetpass2901
@couldntsetpass2901 4 жыл бұрын
Alas, it actually is (The ABC Trials)
@greob
@greob 8 жыл бұрын
This is fantastic, very well made and easy to underestand! How did you manage to know about the functions' code used by the game though? If this is reverse-engineering, how does one end up with the exact code? Did someone manage to decompile the game somehow?
@TylerKehne
@TylerKehne 8 жыл бұрын
Yes
@MrBorderlands123
@MrBorderlands123 8 жыл бұрын
+Tyler Kehne Do we love our decompilers folks? We have the best decompilers, truly wonderful people!
@Mike-gs7eo
@Mike-gs7eo 8 жыл бұрын
+Njul the logic can be reversed by disassembling the cpu instructions from a rom dump
@greob
@greob 8 жыл бұрын
Mike Scott Thanks Mike. Very interesting!
@MrBorderlands123
@MrBorderlands123 8 жыл бұрын
Njul No problem.
@videopsybeam7220
@videopsybeam7220 7 жыл бұрын
These videos are going to be such a boon to my programming studies. Thanks!
@JediJess1
@JediJess1 8 жыл бұрын
I've been wondering about that for a very long time. thank you for explaining that! I really enjoyed that!
@kentronator
@kentronator 6 жыл бұрын
0xAA55 is actually a boot sector value that a BIOS looks for upon startup. I'm not sure if this applies to the N64, but it applies with many, many computers. This may be a coincidence that this value is found in the RNG function, but such a specific value of 65,536 values... it makes me think.
@NFITC1
@NFITC1 3 жыл бұрын
5:14 Most interesting to me. Maybe the devs didn't realize their PRNG function is a bijection. Since they're manipulating bits rather than performing mathematic operations it would be hard to programmatically verify that.
@Peter_Cordes
@Peter_Cordes Жыл бұрын
Good PRNG functions usually are. If not, they couldn't have a maximal period (they wouldn't cycle through each possible value for their internal state). Of course that's necessary but not sufficient; this PRNG doesn't have a maximal period; some starting points lead to short cycles, which aren't part of the sequence of values reachable from other starting points. The common classic PRNG functions, LCG (Linear Congruential Generator x = (x*a + c) % m) and LFSR (Linear Feedback Shift Register), do have maximal periods when their constants are properly chosen. (An LFSR's period is 2^n-1 since it can't include 0; an input of 0 produces an output of 0. All other inputs produce a different output. And LCG's period is m for well-chosen a and c. m can be a power of 2 to make the modulo cheap.) They're not very good PRNG functions by modern standards, especially if you return their entire internal state as the result of each call. (And LCG can be less bad if you return the high 32 bits out of 48, for example.) Still not good compared to xorshift128* or xoroshiro128** which are also fast, and have much better randomness, as well as long periods. (Covering all but 1 value of their 128-bit or 256-bit internal state space, so they're also bijective. Unless the one normally-unreachable value doesn't map to itself.)
@galaxy0710
@galaxy0710 5 жыл бұрын
I love the detailed way you analyzed this game.
@roxor99999
@roxor99999 8 жыл бұрын
One small correction (I think). Since some RNG values are skipped the speed values are not uniformly distributed like you say at 11:24.
@quinn7894
@quinn7894 Жыл бұрын
Almost uniform. Even though only 65114 out of 65536 RNG values are actually used, that's still 99.3% of all RNG values, so there's hardly any difference. He also mentioned at 8:49 that there are occasional gaps between RNG values.
@Seth_Hezekiah
@Seth_Hezekiah 8 жыл бұрын
So. How many times did you hit the a button on your keyboard to make this?
@gdfauxtrot
@gdfauxtrot 8 жыл бұрын
He could've possibly ignored the key entirely by CTRL+C/CTRL+V'ing it from somewhere for the text portions, plus using the video editing UI shortcuts with the mouse. Pure skill. Hell, who needs the key to begin with? I sure didn't use it in this response. c:
@Seth_Hezekiah
@Seth_Hezekiah 8 жыл бұрын
Lol
@SuperFromND
@SuperFromND 8 жыл бұрын
I didn't re@lize you never used the @ key.
@marktopman1487
@marktopman1487 7 жыл бұрын
0.5 times
@esotericVideos
@esotericVideos 6 жыл бұрын
Pannen lives life holding down the a button.
@OwenEvans
@OwenEvans 8 жыл бұрын
I watch every video you post. I'm glad you get the recognition you deserve! Your videos are always so entertaining. You should do voice overs for the videos! It works well and your voice suits the videos.
@windowsforvista
@windowsforvista 8 жыл бұрын
Fantastic video! These were all of the questions I had but was too afraid to ask :)
@farout_tech
@farout_tech 8 жыл бұрын
I was looking for a pseudo-RNG formula for my own game, and I found this to be just the sort of thing I needed. Had to roll my own implementation though, since Lua 5.1 does not have bitwise operators and it uses doubles for numbers (ie. can't tell it to use shorts). A bit of a hack job, but I got it running swimmingly. Thanks for posting the video!
@NXeta
@NXeta 8 жыл бұрын
why couldn't they teach computer science with sm64, I would be 10x more interested
@romajimamulo
@romajimamulo 8 жыл бұрын
+NX berry because sm64 is coded horribly
@romajimamulo
@romajimamulo 8 жыл бұрын
+Matthew Etter please don't...
@MrBorderlands123
@MrBorderlands123 8 жыл бұрын
+Romaji Hmm?
@romajimamulo
@romajimamulo 8 жыл бұрын
+Matthew Etter please don't use the word "retarded". especially in scenarios like this one
@MrBorderlands123
@MrBorderlands123 8 жыл бұрын
Romaji Lol and why should I not use that word?
@ParaSpikyHyperGoomba
@ParaSpikyHyperGoomba 8 жыл бұрын
Praise RNGesus
@murtaza6464
@murtaza6464 8 жыл бұрын
Hey, this was a great video as most of yours are, but I thoroughly enjoy your commentated ones more. Please make more where you speak! its so much more interesting.
@jacobwashington7658
@jacobwashington7658 7 жыл бұрын
I enjoy your videos, so much information in the game. I could use these for game design later on in life.
@Yoshistar81
@Yoshistar81 7 жыл бұрын
I LOST THE RUN TO RNG DUDE!
@Lugmillord
@Lugmillord 8 жыл бұрын
Really interesting! Goes directly into my favorites. I always wondered how the RNG function in SM64 works. But I actually thought that some of Mario's variables would be used for the calculation. A repeating cycle of 65k numbers isn't really random at all. Are there some noteworthy situations you can get with illegal state RNG values? (I guess not, since the lowest and highest possible number are in the cycle, unless the function using it is unusual) I really like your visualizations. awesome job :) And now I get how you found those special coin RNG effects you did some months ago. You can let a program scan the cycle's variables and compare equidistant values in the cycle that are used for the same purpose but different coins.
@jewel_
@jewel_ 8 жыл бұрын
+Lugmillord "A repeating cycle of 65k numbers isn't really random at all." yep! most random generation in any computer isn't random at all, even the random generation on your average program probably uses a cyclic random, though far far larger a cycle than 65k. A step up is something that uses user inputs to provide some input and wiggle the data around a little, like you're suggesting. Another step up is something like linux's "dev/random" which uses device drivers and atmospheric noise to seed the generator. Finally, the highest end (commercial) random generation uses actual physical devices that collect radiation from the air, typically. Though some people have had funny methods in the past, such as aiming a webcam at a lava lamp and sampling the image, or a physical machine that rolled hundreds of dice per second and used that.
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
Yup! I wanted to tear down the veil of mystery surrounding my "Extreme RNG" video. No longer will RNG be some mysterious, elusive concept!
@jongyon7192p
@jongyon7192p 8 жыл бұрын
+Jewel Ots What programs do those things?! I must know! Maybe the RNG could cycle every frame, but go down by a random from 1~65535, and whenever something calls an RNG, depending on its result, the RNG changes even more. But then maybe it could read off of a random byte in the whole program and use what happens to be there! ...I don't know computer science... I like RNG that pretends to be complex, but is actually entirely manipulable by humans.
@jewel_
@jewel_ 8 жыл бұрын
+DeRockProject &amp; the Attack of the Really Long Channel Name "but go down by a random from 1~65535" ah, you see, but how do you get that random value? Computers have no way to get true non-cyclic non-deterministic random values at all, without external help from hardware or noise such as user input.
@jongyon7192p
@jongyon7192p 8 жыл бұрын
Jewel Ots Get that from, dunno, mario's subpixel position. There's always a way to get a random enough number.
@BrunoValads
@BrunoValads 8 жыл бұрын
What a nice work! Now I think SMW deserves an RNG explanation video too
@knaveightt
@knaveightt 7 жыл бұрын
This was a fantastic, and detailed explanation! Thank you!
@zeretex
@zeretex 7 жыл бұрын
I noticed that when in the castle Mario didn't call RNG when you were jumping. I was under the impression that when Mario jumped that it was RNG that decided which of his 3 little jumping voice clips plays. This obviously though seems to be not the case, do you know what does decide which of Mario's voice clips play when jumping?
@MFG1243
@MFG1243 7 жыл бұрын
Isn't the most recent Ludum Dare to not use RNG? That'd be cool to see in SM64.
@tompengelly8030
@tompengelly8030 5 жыл бұрын
My word this was so accessible for me. Thank you for this!!
@94winteg
@94winteg 8 жыл бұрын
Awesome video, extremely interesting to see how a classic game works under the hood!
@Architector_4
@Architector_4 8 жыл бұрын
Ooh colored thumbnail! What this could be? :ooooo
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
lol yeah I thought that shot looked the prettiest, so I went with it!
@Kimairan
@Kimairan 8 жыл бұрын
How can someone be this obsessed with SM64?
@0rderSol
@0rderSol 7 жыл бұрын
In Actuality, You could construct a class where the students play Mario 64, then learn all the aspects of it, since the core subject is interesting, the learning will be more engaging.
@galaxy0710
@galaxy0710 5 жыл бұрын
But they can still do that after getting children.
@PapayaJordane
@PapayaJordane 7 жыл бұрын
Thanks for teaching such awesome programming mechanics.
@recursory
@recursory 7 жыл бұрын
This is such an excellent video. How did you get the background to learn these kinds of things? Do you study computer science or programming? Discrete mathematics? All of your videos are so wild.
@1krubby
@1krubby 8 жыл бұрын
Thanks for the video! How's the ABC been going? It's been quite a while since the last breakthrough.
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
There's a lot of SM64 things I could work on right now. 'keok videos are the easiest and funnest, so I choose to work on them. ABC videos have gotten very complex and not so fun, so I tend to put them off. In other words, you could say I'm taking the path of least resistance with my SM64 videos. Once I finish all the 'keok videos on my to do list, I'll probably get back to ABC
@1krubby
@1krubby 8 жыл бұрын
pannenkeok2012 Ahh, I see. Good luck then. Don't feel any need to rush out videos that aren't fun to make just because your last one got a lot of views, you enjoying the challenge is the most important part.
@temshop5757
@temshop5757 8 жыл бұрын
is this gonna be on the test?
@noyz-anything
@noyz-anything 6 жыл бұрын
Yes. Make sure to brush up on the Study of Walls, Floors, and Ceilings. Principal Pancake won't tolerate any shenanigans.
@QuinGracia
@QuinGracia 6 жыл бұрын
Noyz Gaming Omg hilarious
@goldenwarrior1186
@goldenwarrior1186 3 жыл бұрын
Lol it actually kinda is (in the form of the ABC trials)
@Rogeryoo
@Rogeryoo 3 жыл бұрын
Wow, the RNG function is a bijection? That can't be a coincidence, someone had to think about it in great detail. I feel like one of these could easily fail to be "subjective" (not sure what the the English word is, but it's the other part of injective to make it be a bijective). That's really amazing.
@ilmionomenonloso
@ilmionomenonloso 8 жыл бұрын
Fantastic video, as usual. Perfectly explained! I have only one curiosity about the "illegal" values of the RNG: you said that if you force them manually with some hack, you cause the game to enter a state in which it could never be. What are the actual consequences of this? The game still works? If so, we should see enemies and coins following routes they never usually do?
@jdaster64
@jdaster64 8 жыл бұрын
Fantastic video; I'll have to show this to the guys on the Paper Mario speedrunning / TAS Discord. The function it uses is interesting, though; the Mario RPGs mostly use simple LCGs for their random number generators (save for Superstar Saga, which uses the standard MT-19937 Mersenne Twister). Wonder why SM64's RNG is so nonstandard...
@Really_Tall
@Really_Tall 8 жыл бұрын
+llproductions2006 Hi jdaster :P
@romajimamulo
@romajimamulo 8 жыл бұрын
+llproductions2006 proably because SM64 was developed in a cave by imps
@timmyp9408
@timmyp9408 8 жыл бұрын
+llproductions2006 I have no other game around this time period to base this on, but my guess is because there's so many things across the entire game that rely on it, the devs decided to make a "base" RNG counter and have everything rely off of that, without being too predictable, hence one entity taking multiple goes at RNG before the result.
@abcdefghilihgfedcba
@abcdefghilihgfedcba 8 жыл бұрын
+llproductions2006 Banjo Kazooie’s RNG looks pretty non-standard to me, too. I’d like someone who understands it to make a similar video on it… anyway, they have in common being Nintendo 64 games. Maybe that’s the reason?
@mralh
@mralh 8 жыл бұрын
computer science baby hell ye
@marcgomez8391
@marcgomez8391 7 жыл бұрын
I'm only a bit acquainted with computer science and programming, but this was surprisingly easy to follow, as well as entertaining.
@Tashiro64
@Tashiro64 8 жыл бұрын
wow thanks for this, I already know a lot about how mario 64 works, but this is awesome to learn ! nice job !
@GodlikeGER
@GodlikeGER 8 жыл бұрын
Damn I was hoping you would show on how to abuse this function and manipulate it, maybe next video :p
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
How does one "abuse" the RNG function?
@jongyon7192p
@jongyon7192p 8 жыл бұрын
+pannenkeok2012 ACE the RNG value into 999,999,999, a value impossible normally AND even by cheating, making the coin fly into space. /s
@00ChaosSaber00
@00ChaosSaber00 8 жыл бұрын
+pannenkeok2012 It is possible to "abuse" knowledge of how randomness is generated and RNG's initial value along with scripted frame-perfect inputs to produce a provably optimal scripted speedrun of the game or to discover and reproduce interesting exploitable bugs. This may have already been done. I don't follow speedruns all that much.
@jongyon7192p
@jongyon7192p 8 жыл бұрын
NopeNopeNope Every TAS does this, of course. If it doesn't, it's not optimized enough. I imagine you basically just have to wait 1 or 2 frames before taking some action, like make a coin come out of a box. Or in pannenkoek's case, wait like 3~15 frikkin minutes.
@QuinGracia
@QuinGracia 6 жыл бұрын
Absolute It is impossible, since it is always called on each frame, and it is hard to do in the castle
@orangy57
@orangy57 8 жыл бұрын
Also, why isn't there any commentary in this video? I know how you usually don't put your voice in, but it's so soothing to hear.
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
This channel has never done commentary. If I had to commentate all the videos on this channel, I wouldn't have gotten around to this video for months. See question 6 of bit.ly/pannenkeok2012FAQ
@StudKingBar
@StudKingBar 8 жыл бұрын
Can I just say that, as a fellow comp sci nerd, I'm still super impressed. Hacking games takes a lot of patience, especially when it comes to reverse-engineering shit. Double especially for shit like this where the behavior isn't really intuitive at all. Well played dude, I'm gonna have to binge watch your stuff now.
@TheCapinToast
@TheCapinToast 8 жыл бұрын
Please commentate more often. I love to learn, but some of us can't retain information as well through writing alone. Not to mention your voice is perfect for this kind of thing.
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
This channel is a hub for non-commentated videos. If you want commentated videos, stick to my main channel. You can read more about it on question #6 of bit.ly/pannenkeok2012FAQ
@TheCapinToast
@TheCapinToast 8 жыл бұрын
+pannenkeok2012 Thank you. If I'm being honest, I never noticed the difference between the two.
@acrid8952
@acrid8952 7 жыл бұрын
How did you reverse engineer the game's code and convert it to C? I would love to look at this game's source.
@randomcatdude
@randomcatdude 6 жыл бұрын
Pure assembly.
@Mizu2023
@Mizu2023 2 жыл бұрын
Assembly decompiled into C/C++. Not fully accurate due to the original ROM assembler not caring about function and variable names.
@YoshiFawful64
@YoshiFawful64 8 жыл бұрын
At 0:30, shouldn't the second-to-last line say there's 256 values, rather than 255, since it's from 00 to FF?
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
oh snap, you're right! better place an annotation there
@agnastthrower5212
@agnastthrower5212 7 жыл бұрын
Dude you need more fame you put a lot of good work in these videos.
@robp7406
@robp7406 8 жыл бұрын
i love ur commentaries. please make more.
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
There have never been any commentated videos on this channel. See question 6 of bit.ly/pannenkeok2012FAQ
@elairyx
@elairyx 5 жыл бұрын
4:00 Math class test: Find da pattern 😂
@MysteriousJojo
@MysteriousJojo 8 жыл бұрын
Is this the only game you own or something?
@TIJEY-BEG
@TIJEY-BEG 5 жыл бұрын
Really interesting to see what actually happens in the game. Even when I cannot understand every detail at a glance.
@TheExarion
@TheExarion 8 жыл бұрын
Is it weird that this video got me thinking about free-will? Also, maybe a very specific RNG could be the answer to that $1000 upwarp bounty. Amazingly well-done video btw.
@jacobsullivan8512
@jacobsullivan8512 8 жыл бұрын
So a box spawning 65114 coins would only have one possible outcome of where they all fly off to?
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
Theoretically yes. But the game can only have 240 objects at once, so that would cause the game to crash
@FabbrizioPlays
@FabbrizioPlays 8 жыл бұрын
That's some quantum physics shit.
@4545guillermaso
@4545guillermaso 8 жыл бұрын
There are still 65114 combinations though, it's not only one. It depends on the RNG value before breaking that block.
@exylic
@exylic 8 жыл бұрын
@Mario L, They have several combinations of orders, but all coins would start in the same spot, so no matter the value (unless it's hacked to after the 65114th) they'd have one path since the RNG loops
@want-diversecontent3887
@want-diversecontent3887 7 жыл бұрын
Mario L All of the RNG states give the same results. 65514 coins with all possible trajectories.
@linkVIII
@linkVIII 8 жыл бұрын
What the hell? Why am I not subscribed anymore. How could youtube do me so wrong
@eduardolarrymarinsilva76
@eduardolarrymarinsilva76 8 жыл бұрын
+linkviii You are subscribed, for some stupid reason some channels will stop displaying as such if you haven't visited them in a long time, but only sometimes. I hate it.
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
You may be confusing this account for my main account: bit.ly/pannenkeok2012FAQ
@linkVIII
@linkVIII 8 жыл бұрын
+pannenkeok2012 ok cool. I looked through past videos and pretty sure I seen some of them though so still confused why I wasn't subscribed. completely agree with the pain of making a good voice commentary. Mood is a big factor.
@QuiVeutUneMerguez
@QuiVeutUneMerguez 8 жыл бұрын
+linkviii For what it's worth, I checked after reading your comment and I wasn't subscribed either.
@ShadowStar1224
@ShadowStar1224 8 жыл бұрын
What video editing software do you use? This presentation with its animations and coloration of important aspects is absolutely top notch!
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
PowerPoint 2010 and Sony Vegas Pro 13.0
@ShadowStar1224
@ShadowStar1224 8 жыл бұрын
Thanks!
@strongmanlin
@strongmanlin 8 жыл бұрын
Wow this video is really well done!
@UncommentatedPannen
@UncommentatedPannen 8 жыл бұрын
thanks! It's been on my to do list for months, and so I finally decided to tackle it
@iP0STcomments
@iP0STcomments 8 жыл бұрын
I didn't understand a word that was said but I still loved it
@NinjarioPicmin
@NinjarioPicmin 5 жыл бұрын
honestly Yahooo is pretty hard to understand
@glooom6355
@glooom6355 8 жыл бұрын
what's the song that starts at 0:23
@Bulba413
@Bulba413 8 жыл бұрын
+Mr. M (Felipe) yes its file select
@TheRealDman765
@TheRealDman765 8 жыл бұрын
+glooom If you've never played Mario 64, why are you even watching this?
@SkicoNow
@SkicoNow 8 жыл бұрын
+TheRealDman765 Because why not?
@spootot
@spootot 8 жыл бұрын
delude - madstorm
@glooom6355
@glooom6355 8 жыл бұрын
TheRealDman765 do u wanna beat my ass sweetie? i knew it sounded familiar, i was just wondering the title so i could look it up hun
@martinsoto4662
@martinsoto4662 5 жыл бұрын
That was an amazing explanation
@The8bitbeast
@The8bitbeast 8 жыл бұрын
Great Explanation! It would be interesting to see if there's any bias in the spinners or other objects since the "fixed" RNG is not surjective.
HP
14:57
UncommentatedPannen
Рет қаралды 654 М.
How Holding Objects Really Works
12:01
UncommentatedPannen
Рет қаралды 197 М.
[Vowel]물고기는 물에서 살아야 해🐟🤣Fish have to live in the water #funny
00:53
Маленькая и средняя фанта
00:56
Multi DO Smile Russian
Рет қаралды 4,1 МЛН
Normal vs Smokers !! 😱😱😱
00:12
Tibo InShape
Рет қаралды 99 МЛН
Koopa the Quick Manipulation using Bowling Ball Clones
4:34
UncommentatedPannen
Рет қаралды 374 М.
Why Some 1-Ups Don't Flicker Before Disappearing
11:46
pannenkoek2012
Рет қаралды 492 М.
NES Scrolling Basics featuring Super Mario Bros. - Behind the Code
17:25
Displaced Gamers
Рет қаралды 116 М.
Pitch Conservation & Yaw Velocity Conservation
15:15
UncommentatedPannen
Рет қаралды 66 М.
Coin Counter Frame Cost/Leniency
7:09
UncommentatedPannen
Рет қаралды 45 М.
A New Impossible Coin
9:15
UncommentatedPannen
Рет қаралды 1,6 МЛН
Why Stomping Wigglers Glitches Super Mario World
20:48
Retro Game Mechanics Explained
Рет қаралды 260 М.
SM64 - The Science of Cloning
28:48
pannenkoek2012
Рет қаралды 347 М.
Knockback Grinding Softlocks
10:43
UncommentatedPannen
Рет қаралды 93 М.
Bling Bang Bang Born fight: Aaron Vs Zane #minecraftshorts
0:13
BigBlockCraft
Рет қаралды 4,4 МЛН
Body Symbol Game With Sonic And Shadow
0:23
Intalord
Рет қаралды 3,9 МЛН
COMPARE - GTA V Run Now Oh No #shorts
0:21
Socola Funny
Рет қаралды 8 МЛН
Кто самый маленький Бравлер?
0:43
YMNUK
Рет қаралды 1,2 МЛН