I wonder if those birds were supposed to show up in more places and get more screen time, thus justifying the extra effort that went into them. Or maybe it was late in development and some programmer had a free hour to burn just for fun.
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!
Honestly, you can't explain assembly to non technical laypeople without dumbing it down a lot, its extremely abstract. As far as 99.9% of humanity is concerned assembly doesn't even exist and how computers work is literally the dark arts. What I'm saying basically there's no way to talk about assembly other then to go all out or dumb it down completely. People will either know what you're talking about or be completely clueless.
11:54 What?!?!?! I am mindblown!! In all the years I have been playing this game, I have never, ever seen a 1-up come out by Kamek! I didn't even know that was possible!
@@ryanvandoren1519 it's just a colloquialism, I for one have no idea what an "exclusive or" is and it's never explained in the video, but I know I'm not stupid. I'm just stupid at watching this video. I still like it though
Do you have any programming experience at all? If not then you are not stupid. If you had been coding for 20 years and still didn't understand this, then "maybe" you would be stupid.
Stupidity and ignorance are two very different things. And I assure you, you are not stupid. You simply don't understand what's being said. But believe me when I say you're capable of understanding it one day. Just don't worry so much about understanding it and just learn what you can when you can, but keep trying to learn. Never stop trying because you won't learn if you don't try. Just look up things you don't understand one thing at a time, and take as long as you need to understand them. If you find there's something else you need to know in order to understand what you've looked up, then take a step back and look that up. Don't worry about your end goal, just enjoy the journey and keep at it. I'm in the process of learning this stuff myself, so here are a few topics to get you started. 6502 CPU, there's a good primer called EASY6502 which depending on your skill level, may or may not be helpful. But you will find it helpful at some point. Hexadecimal and binary numbers are the best place to start if you're completely new to this stuff. Logic gates/logical operations, like NOT, AND, OR, NAND, NOR, and XOR would be the next step. Windows comes with a calculator with a programmer mode that will let you play with these operations on hex and binary numbers once you understand them better. There's also a free program called logisim that will let you play with logic gates and make logic circuits so you can play with them and see how they work. It also lets you make more complicated digital circuits to the point where you can start to make parts of a CPU or even an entire CPU if you know enough. It's a great tool for learning about this stuff. CPU registers would probably be the next logical step after learning that stuff. This stuff alone should take you quite some time to get comfortable with. But like I said, don't be afraid to look stuff up. Consult multiple sites, videos and resources if you don't understand one. Take your time and be patient. And don't give up. Before you know it, you'll be learning about stuff you never would have imagined you would understand. Even if you just learn binary and logic gates it will probably give you a huge boost to your self esteem and your confidence in your ability to learn. Some of this may be helpful. Some of it may be useless to you. Some may not even interest you. Or none of it may interest you. But I hope you at least get something out of this post I've made. It's probably a bit all over the place, but my hope is it can at least get you started in the right direction. Finally, if you're looking for a video series to understand CPUs from a hardware level, Ben Eater has a great series here on UA-cam where he builds a CPU from the ground up using electronics and chips etc. It can be very helpful in understanding assembly language to understand how a CPU works like that as well. Best of luck to you in your endeavour. Enjoy the journey and be patient and persistent. I know I've already said that, but it's the most important advice I can give you. Cheers.
Looking forward to this series! I'm loving how many TAS-ers / glitch-hunters are doing this sort of fully-fleshed out explanation of glitches and game mechanics these days! Also, I love the "extended 1-up sound" in the intro.
Well, that's my weekend viewing sorted. Thanks for the list. I' sure you've saw them but for anyone who hasn't DotsAreCool and SethBling also have some good stuff. It's Mario specific but also discusses how the SNES works.
I agree. It's wonderful how many resources on this sort of thing are popping up on UA-cam. I wasn't aware of the other channels you mentioned though. So thanks for that. I'll be sure to check them out.
This wasn't just a good gaming video, this was a fantastic computer science video. *Subscribed!* The breakdown of the assembly and pseudo-code functions was really good and I especially loved the graphs of the random outputs and how you highlighted the important parts of the data via color and animation.
That was a good video about SMW's RNG. Actually taught me which address to use in order to make the seed different ~ One of the sprites I made ticked the RNG every frame Mario is on the ground. Since it's a more dynamic element, it works well to make it less of a pattern.
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.
BTW, if anyone was interested, the PHY and PLY instructions are to PusH the Y register onto the stack and PulL (pop) to pop the stack top into Y. This is the RNG subroutine saving the value in Y while it uses the register for other purposes, then restores the value of Y prior to going back to where the subroutine was called.
2:16 "Click here to learn more assembly instructions" The hover-over text says "Coming soon!" and I'm looking forward to it! I know i could probably find this information elsewhere online but I enjoy how you explain things :)
I learned 6502 assembly back in the 1980s when it was cool. I am so glad to see more people taking an interest in assembly again. You can do fantastic things with it.
The "Random number generator" creates a pseudo-random number based on a complex set of values (the "seed," I think) that has a tendency to change constantly. Unless there's something hardware-related, computers are actually incapable of creating random numbers.
@@Chaos89P yeah. the "random" number generators are just a very convoluted mathematical calculation based on a "seed" value.....if you always use the same "seed" the "random" number will always be the same. usually what you do is set the seed to the current time-stamp of the computer clock. that will create a better random number than a static seed, of course nothing beats a good hardware random number generator....but aint nobody got time for that!
Man, the RNG use was really smart in this world, the blinking and bird movement implementation and was mindblowing. I am very sure the guy in charge of the bird movement made first the movement to be based on certain cycles and he hated it and made something that really resembled nature. Awesome video.
I really liked this. I was especially impressed with the production values. The only thing I wasn't able to understand is what Bit Test actually does; I came in with no prior knowledge of how assembly works, and at this part, I felt I needed at least a little. I don't know if I'm outside your target audience, but if I am, the clarity of your explanations is pretty excellent, as I was able to understand everything else even without prior knowledge.
After watching a few times, I think what it does is use an AND gate on each bit of the two numbers you're using (so 1 AND 1 is 1, but everything else is 0), and if the new number is all 0s, Z gets set to 1.
Effectively, Bit Test is checking if the two values have any set bits in common. To be precise, BIT just checks if (Accumulator value) AND (Operand value) = 0 If yes, set Z-flag. If not, clear Z-flag. I'm assuming you know how the 'logical AND' operator works (he did explain it for a split second in the video). Basically it puts a 1 in each bit which had a 1 in both operands. The accumulator is always implied to be the first operand.
Cool new channel! As a modern newbie programmer I find it educational and inspiring to hear specifics of how old games worked. Also nice having suspicions from my childhood confirmed
That's a pretty weird RNG... Not using true randomness is not just a cost issue. A lot of game design benefits from the predictability of a pseudo-random generator over a true random generator for instance. For example, Consider recording a replay of what the player was doing. For this to work, you have to replicate EVERYTHING correctly. You could record the state of all of the game objects for every frame, but that would take up huge amounts of storage. But, if all the game objects have deterministic state, then all you need is the starting state and the player inputs, which takes up much less space. This is possible if the game is entirely based on predictable deterministic logic... Or... If you use a pseudo-random number generator. (since this is actually deterministic for a given seed) It looks too like it's setting the seed to an exact starting value too. Which... Means the sequence of things in the level is kind of predictable in some ways That's an odd choice. See, when developing PC demos I found the most common technique to get a 'random' outcome is to use the system clock. Even though the Pseudo RNG function isn't random, it seems fairly random as long as your seed value keeps changing. The system clock has the virtue that barring someone messing with their clock (or the clock running for longer than it was designed to), the seed will never be the same, so 'random' events will truly seem random, even though they aren't, because the seed used is never the same twice. Unfortunately, an old console like the snes has no system clock. So... You have to come up with a different way of creating the initial seed values... And so far, I haven't actually been able to think of one that works consistently... Which... May well explain why SMW just gives up and sets it to 0 every time a level loads...
Outside of using a predictable number generator for determinism.. there is never ever ever ever such a thing as a real random number generated by a computer (yet.. maybe once we go quantum)
I came up to a "better random" by making a clock based on VBLANK interrupt cicles, so the user will never be able to press start at exactly same time ever, and three different random routines based on which number was on clock. But nowadays, with very cheap RTC circuits, it would be possible to save the daytime in the SRAM
@@martinhowser4094 There is one way, machines with a requirement for very strong cryptography like military grade communications hardware can be equipped with a hardware random number generator that samples some type of physical quantum phenomenon, such as decay of a radioactive substance, or noise on a photoelectric circuit caused by unpredictable arrival of photons. These are obviously far too expensive for a games console.
Well done. I look forward to seeing more videos. Your Super Mario 3 video convinced me to subscribe. Seeing more videos with assembly in them make me want to stick around. And I love retro and game mechanics.
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.
This video, to me, is a great example of "never played it, never thought about it." However, my brain's craving for MORE KNOWLEDGE ABOUT MORE THINGS ON STUFF has me fascinated.
There are a couple other ways to really make an RNG function ... random. You can read the noise from one of your sound card's audio channels and use that as the seed, or you can read the unfiltered mouse input or the gamepad's unfiltered analog sticks. Heck, there are even servers around the world picking up cosmic radiation and used that to supply a seed for RNG functions to use. And i don't think you can go more random that cosmic noise :D
Those options weren't available to Nintendo when building the GBA. Besides, aside from the mistake of resetting RNG at level start, this game handles randomness pretty well.
True, or any other kind of timer that runs continually from system boot, which is something that's been used on pretty much every system in the world ever (the earliest i can point to is the built in BASIC of the Sinclair ZX80, and the successor models of course, where using the RANDOMIZE command sets the 16-bit RNG seed to the number of video frames since power-on, repeating every 20 minutes or so in 50hz regions). However, this is specifically about SMW randomness, and as stated, it resets the seeds to zero at the start of each level, so your only actual source of entropy is how many times the RNG has been called in that particular level before the call in question...
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
If you’re wondering: No, that rubik’s cube in the thumbnail is not possible. The colour scheme is correct, but the white-green-red corner and white-green-orange corner have a flipped colour scheme
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
Same here but it's because I think they are very hard to understand. I wouldn't say that I'm dumb but these clips make me feel like an idiot :D Nevertheless I'm always impressed how someone can break these codes and explain stuff I'd never understood! :D
Nice vid. Would be interesting to see some statistical analysis on the rng, like a distribution plot, compared to a modern prng. I know some classic games have notoriously bad rngs.
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
It’s kind of the same, but instead of the character’s precise *POSITION,* you’d be interested in the character’s precise *SPEED.* Consider needing to cross a gap that’s 23 units wide. Let’s say, for the sake of simplicity, that your jump lasts for 5 frames, and your speed oscillates between 4 and 5 upf (units per frame), every frame. Now, if your speed = 5 upf on the first frame of your jump, your speeds throughout the jump will be: 5-4-5-4-5; so, your jump will carry you 5 + 4 + 5 + 4 + 5 = 23 units; so, you *WILL* cross the gap. If, on the other hand your speed on the first frame is 4 upf, your speeds throughout the jump will be: 4-5-4-5-4; so, your jump will carry you 4 + 5 + 4 + 5 + 4 = 22 units; so, you *WON’T* cross the gap. As you can’t normally keep track of your precise speed every single frame, that event is considered luck-based. 🤓
Meah, now we have a RTC circuit to retrive "BIOS Time" to use the epoch time(seconds since Jan 1st 1970) as seed. Anyway, for Sega Genesis I prefer using the "time" taken to user to press start as a seed, and a selector of what randon routine should it trigger.
Another great way to get more randomness without additional hardware is to take inputs states at various intervals and use them as seeds. Not that random in a console, but for example in computer software, it's very typical to grab mouse movement, which is very difficult to replicate
great, I'm waiting for a new video about Credits Warp Explained that shows all the addresses visually and how the bytes behave in them, so we can make new codes run
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
So even though the RNG will repeat every 27776 calls, it seems that for a lot of the RNG calls that only care about the results of the upper or lower bits; this means that for their relevant behavior that RNG call sequence "repeats" for them every 128 or 217 calls, respectively, even if the full number 16 bit number is itself unique. Also, I have a question: For Wendy and Lemmy their index for which pipe to appear out of is 4 bits long, allowing for 16 possibilities. There's only 8 pipes possible to appear out of. How exactly does the that work?
The generated value is used as an index into a table instead of the pipe index directly. It is also responsible for the locations of the dummy Koopas. There are only 16 patterns for where all three show up, even though there could be 105 if every combination were possible.
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
just subbed tonight! Apart from the PHY / PLY, this code should effectively run unaltered on a Commodore 64. Interesting to see such a long, odd value before numbers repeat. Looks like a very fast routine as well. Dunno why they didn't just JSL STA JSL STA RTL and not bother with the Y register at all. Or, the routine can be even quicker with JSL TAY then fall through routine again to get A and exit with random (unsaved) values in A/Y.
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!
When a Sprite calls for RNG, the scroopy deep confarbles the regneray and the value of the boopyda bleeps returns to the lappy-slap33 then divide the tripptydoo by the regneray and you'll get the reason why a koopa moves right.
No. The real joke is that you don't understand this video, but you're not interested in putting in the time and effort to make it make sense, so you give up and say dumb things instead.
I always thought those birds looked unnaturally natural.
@@RandomNameLastName811 Indubitably indeed!
@@RandomNameLastName811
it's truly true....
Y'all dummy dumbs
Someone put some heart and soul into those birds and it shows.
I wonder if those birds were supposed to show up in more places and get more screen time, thus justifying the extra effort that went into them. Or maybe it was late in development and some programmer had a free hour to burn just for fun.
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!
Honestly, you can't explain assembly to non technical laypeople without dumbing it down a lot, its extremely abstract. As far as 99.9% of humanity is concerned assembly doesn't even exist and how computers work is literally the dark arts. What I'm saying basically there's no way to talk about assembly other then to go all out or dumb it down completely. People will either know what you're talking about or be completely clueless.
11:54 What?!?!?! I am mindblown!! In all the years I have been playing this game, I have never, ever seen a 1-up come out by Kamek! I didn't even know that was possible!
I don't even recall a thwimp. Can't be certain about the coins though. Very interesting.
Yeah I've played the game enough to see that happening.
OmikronWeapon I was playing yesterday and I actually got a Thwimp twice!
i already got one
I have but only once. Its VERY very rare.
I’m too stupid to understand these videos, but still am entertained.
Not stupid mate, just inexperienced.
@@ryanvandoren1519 it's just a colloquialism, I for one have no idea what an "exclusive or" is and it's never explained in the video, but I know I'm not stupid. I'm just stupid at watching this video. I still like it though
Do you have any programming experience at all? If not then you are not stupid. If you had been coding for 20 years and still didn't understand this, then "maybe" you would be stupid.
Stupidity and ignorance are two very different things. And I assure you, you are not stupid. You simply don't understand what's being said. But believe me when I say you're capable of understanding it one day. Just don't worry so much about understanding it and just learn what you can when you can, but keep trying to learn. Never stop trying because you won't learn if you don't try. Just look up things you don't understand one thing at a time, and take as long as you need to understand them. If you find there's something else you need to know in order to understand what you've looked up, then take a step back and look that up. Don't worry about your end goal, just enjoy the journey and keep at it. I'm in the process of learning this stuff myself, so here are a few topics to get you started.
6502 CPU, there's a good primer called EASY6502 which depending on your skill level, may or may not be helpful. But you will find it helpful at some point.
Hexadecimal and binary numbers are the best place to start if you're completely new to this stuff.
Logic gates/logical operations, like NOT, AND, OR, NAND, NOR, and XOR would be the next step. Windows comes with a calculator with a programmer mode that will let you play with these operations on hex and binary numbers once you understand them better. There's also a free program called logisim that will let you play with logic gates and make logic circuits so you can play with them and see how they work. It also lets you make more complicated digital circuits to the point where you can start to make parts of a CPU or even an entire CPU if you know enough. It's a great tool for learning about this stuff.
CPU registers would probably be the next logical step after learning that stuff.
This stuff alone should take you quite some time to get comfortable with. But like I said, don't be afraid to look stuff up. Consult multiple sites, videos and resources if you don't understand one. Take your time and be patient. And don't give up. Before you know it, you'll be learning about stuff you never would have imagined you would understand. Even if you just learn binary and logic gates it will probably give you a huge boost to your self esteem and your confidence in your ability to learn.
Some of this may be helpful. Some of it may be useless to you. Some may not even interest you. Or none of it may interest you. But I hope you at least get something out of this post I've made. It's probably a bit all over the place, but my hope is it can at least get you started in the right direction.
Finally, if you're looking for a video series to understand CPUs from a hardware level, Ben Eater has a great series here on UA-cam where he builds a CPU from the ground up using electronics and chips etc. It can be very helpful in understanding assembly language to understand how a CPU works like that as well.
Best of luck to you in your endeavour. Enjoy the journey and be patient and persistent. I know I've already said that, but it's the most important advice I can give you.
Cheers.
@@VoidHalo OMG YOUR SUPER SMART
Looking forward to this series! I'm loving how many TAS-ers / glitch-hunters are doing this sort of fully-fleshed out explanation of glitches and game mechanics these days!
Also, I love the "extended 1-up sound" in the intro.
Well, that's my weekend viewing sorted. Thanks for the list. I' sure you've saw them but for anyone who hasn't DotsAreCool and SethBling also have some good stuff. It's Mario specific but also discusses how the SNES works.
Me too.
Edit: He actually “RGM” explained it in his latest vid. (rgm means retro game mechanics)
If you're interested in pokemon glitches, one person I recomend a good bit is RETIRE.
I agree. It's wonderful how many resources on this sort of thing are popping up on UA-cam. I wasn't aware of the other channels you mentioned though. So thanks for that. I'll be sure to check them out.
Another recommendation: decino has a lot of videos about how Doom and Doom II work.
This wasn't just a good gaming video, this was a fantastic computer science video. *Subscribed!* The breakdown of the assembly and pseudo-code functions was really good and I especially loved the graphs of the random outputs and how you highlighted the important parts of the data via color and animation.
That was a good video about SMW's RNG. Actually taught me which address to use in order to make the seed different ~
One of the sprites I made ticked the RNG every frame Mario is on the ground. Since it's a more dynamic element, it works well to make it less of a pattern.
My boss calls the RNG to determine whether or not I get a raise, it never calls back tho.
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.
Does he also call RNG to determine, whether or not he fires you?
I dug through reality and broke the wrong block, now I'm laid off.
oops
@@LeviathanRX So YOU'RE the one that caused COVID!
@@BlazingShadowSwordMEEEDIIIC!
BTW, if anyone was interested, the PHY and PLY instructions are to PusH the Y register onto the stack and PulL (pop) to pop the stack top into Y. This is the RNG subroutine saving the value in Y while it uses the register for other purposes, then restores the value of Y prior to going back to where the subroutine was called.
The random fire and birds are hypnotizing. It feels like it gives the game a unique personality.
i love how you just popped onto the platform with top-tier editing
I'm honestly surprised how few calls the game uses for random numbers.
no idea why youtube recommended this to me but this video is incredibly well made.
2:16 "Click here to learn more assembly instructions" The hover-over text says "Coming soon!" and I'm looking forward to it! I know i could probably find this information elsewhere online but I enjoy how you explain things :)
still waiting?
I learned 6502 assembly back in the 1980s when it was cool. I am so glad to see more people taking an interest in assembly again. You can do fantastic things with it.
Oh boy, I can't wait to learn more assembly instructions!
Guess you can, or, must, because that still hasnt happened.
We need to learn reality-assembly to call the assembly video
Ersanio has a tutorial where he explains each opcode, it's really helpful
I didn't understand a thing, but it sounds smart, so i like it
The "Random number generator" creates a pseudo-random number based on a complex set of values (the "seed," I think) that has a tendency to change constantly. Unless there's something hardware-related, computers are actually incapable of creating random numbers.
You, I like you.
@@Chaos89P
yeah. the "random" number generators are just a very convoluted mathematical calculation based on a "seed" value.....if you always use the same "seed" the "random" number will always be the same.
usually what you do is set the seed to the current time-stamp of the computer clock.
that will create a better random number than a static seed,
of course nothing beats a good hardware random number generator....but aint nobody got time for that!
@@sabin97 But the current time stamp is already somewhat random. And when the seed is random, the resulting RNG is too.
@@cube2fox
it confuses me when you use the word "but" while agreeing with what i just said....
Man, the RNG use was really smart in this world, the blinking and bird movement implementation and was mindblowing. I am very sure the guy in charge of the bird movement made first the movement to be based on certain cycles and he hated it and made something that really resembled nature. Awesome video.
I know this is off topic, but his videos are so cleanly edited.
Thanks for the assembly code from the SMB3 rom! It's great to see deep explanations for this cool stuff!
I really liked this. I was especially impressed with the production values. The only thing I wasn't able to understand is what Bit Test actually does; I came in with no prior knowledge of how assembly works, and at this part, I felt I needed at least a little. I don't know if I'm outside your target audience, but if I am, the clarity of your explanations is pretty excellent, as I was able to understand everything else even without prior knowledge.
After watching a few times, I think what it does is use an AND gate on each bit of the two numbers you're using (so 1 AND 1 is 1, but everything else is 0), and if the new number is all 0s, Z gets set to 1.
Effectively, Bit Test is checking if the two values have any set bits in common.
To be precise, BIT just checks if
(Accumulator value) AND (Operand value) = 0
If yes, set Z-flag. If not, clear Z-flag.
I'm assuming you know how the 'logical AND' operator works (he did explain it for a split second in the video). Basically it puts a 1 in each bit which had a 1 in both operands. The accumulator is always implied to be the first operand.
I think(someone else can correct me if I'm wrong) it is an AND operation that sets the Z flag if the result is zero.
It is an AND operation between corresponding bits in the operands, yes.
Correct.
Your understanding into the details on this is mind blowing. I'm impressed!
Taking topics I already know a lot about and still making the video interesting enough to get me to watch the entire thing. I love it. Keep it up.
Cool new channel! As a modern newbie programmer I find it educational and inspiring to hear specifics of how old games worked. Also nice having suspicions from my childhood confirmed
That's a pretty weird RNG...
Not using true randomness is not just a cost issue. A lot of game design benefits from the predictability of a pseudo-random generator over a true random generator for instance.
For example, Consider recording a replay of what the player was doing. For this to work, you have to replicate EVERYTHING correctly.
You could record the state of all of the game objects for every frame, but that would take up huge amounts of storage.
But, if all the game objects have deterministic state, then all you need is the starting state and the player inputs, which takes up much less space.
This is possible if the game is entirely based on predictable deterministic logic...
Or... If you use a pseudo-random number generator. (since this is actually deterministic for a given seed)
It looks too like it's setting the seed to an exact starting value too. Which...
Means the sequence of things in the level is kind of predictable in some ways
That's an odd choice.
See, when developing PC demos I found the most common technique to get a 'random' outcome is to use the system clock.
Even though the Pseudo RNG function isn't random, it seems fairly random as long as your seed value keeps changing.
The system clock has the virtue that barring someone messing with their clock (or the clock running for longer than it was designed to), the seed will never be the same, so 'random' events will truly seem random, even though they aren't, because the seed used is never the same twice.
Unfortunately, an old console like the snes has no system clock.
So... You have to come up with a different way of creating the initial seed values...
And so far, I haven't actually been able to think of one that works consistently...
Which... May well explain why SMW just gives up and sets it to 0 every time a level loads...
Outside of using a predictable number generator for determinism.. there is never ever ever ever such a thing as a real random number generated by a computer (yet.. maybe once we go quantum)
I think it could be set to a global timer value.
I came up to a "better random" by making a clock based on VBLANK interrupt cicles, so the user will never be able to press start at exactly same time ever, and three different random routines based on which number was on clock.
But nowadays, with very cheap RTC circuits, it would be possible to save the daytime in the SRAM
@@martinhowser4094 There is one way, machines with a requirement for very strong cryptography like military grade communications hardware can be equipped with a hardware random number generator that samples some type of physical quantum phenomenon, such as decay of a radioactive substance, or noise on a photoelectric circuit caused by unpredictable arrival of photons. These are obviously far too expensive for a games console.
@@pyramidschema8668 you could just use the noise produced by a low resolution camera, it's random I think
This is certifiably one of the most interesting and fascinating and educational things I've ever watched on UA-cam.
This man has an exceptional "lecturer" voice! 🙌👍
Well made and very informative! Looking forward to the next episode!
(I was never sure if podoboos were random, thanks for clearing it up!)
1:39 but first we need to talk about parallel universes
Well TJ """""" *H E N R Y* """""" Yoshi.
You're saying this as if it was complicated.
Excellent video, glad to see someone actually looking at the assembly code for games rather than not go in depth.
absolutely fantastic look behind the curtain of what is going on here, great video. Subbed for more of this sort of in dept look at games.
Well done. I look forward to seeing more videos. Your Super Mario 3 video convinced me to subscribe. Seeing more videos with assembly in them make me want to stick around. And I love retro and game mechanics.
"Asl = Arithmetic Shift Left"
Me: "Asl = Age Sex Location"
American Sign Language
A sS funnLy meme
A simple lute
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.
It's called yoshi's safari
I love the pixel perfect gameplay, looks so clean
Great work! I'd like to see more Mario-related mechanic explanations soon!
I really appreciate your channel. Love how you get into the details
This video, to me, is a great example of "never played it, never thought about it." However, my brain's craving for MORE KNOWLEDGE ABOUT MORE THINGS ON STUFF has me fascinated.
Cool, will this channel be the Pannekoek2012 but then for SMW? That would be absolutely awesome
Butter Bridge 1 done in half an A press coming soon! :D
+octacle Look for Some Guy. I know that isn't helpful but that's the name of the user who has done a few no jump levels so far.
Some Guy is SomeGuy712x
CoTeCiOtm But you jump with B.
Potato on a stick
Yes.
But then, who's the Tyler Kenhe?
@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]);
There are a couple other ways to really make an RNG function ... random.
You can read the noise from one of your sound card's audio channels and use that as the seed, or you can read the unfiltered mouse input or the gamepad's unfiltered analog sticks.
Heck, there are even servers around the world picking up cosmic radiation and used that to supply a seed for RNG functions to use. And i don't think you can go more random that cosmic noise :D
Those options weren't available to Nintendo when building the GBA. Besides, aside from the mistake of resetting RNG at level start, this game handles randomness pretty well.
J.J. Shank Using the current score And time with the randomness would have been easy to perfect it
J.J. Shank This is a SNES game.
Lanzo A Reaper Same difference
The cosmic noise is not the most random, a quantum system is actually truly random.
I am the only person that appreciates this, but thanks for using an actually possible Rubik’s cube position in the video. 1:03
Awesome video. Just wanted to mention that using the system clock is a great way to seed any RNG routine.
I didn't know their were other ways to make a seed...
Aaron Misner
Would be good if it would have one and it couldn't be changed easily to make it consistent for every run
True, or any other kind of timer that runs continually from system boot, which is something that's been used on pretty much every system in the world ever (the earliest i can point to is the built in BASIC of the Sinclair ZX80, and the successor models of course, where using the RANDOMIZE command sets the 16-bit RNG seed to the number of video frames since power-on, repeating every 20 minutes or so in 50hz regions). However, this is specifically about SMW randomness, and as stated, it resets the seeds to zero at the start of each level, so your only actual source of entropy is how many times the RNG has been called in that particular level before the call in question...
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
HIS FIRST VIDEO :)
Always appreciate your videos, thanks for the quality content
Found a new channel to binge. Great stuff, man.
Good explaining, also good luck on the new channel
New favourite channel - hat tip to you good sir
If you’re wondering: No, that rubik’s cube in the thumbnail is not possible. The colour scheme is correct, but the white-green-red corner and white-green-orange corner have a flipped colour scheme
NEEEEERRRRDD. Kidding, this was actually highly insightful. Loving the videos.
Excellent discussion and good video! Subscribed, and looking forward to more!
I turned on captions just to see if RNG would be read as orangy
Lol
Me and Orangey are gonna go get stoned Bubs
I like the intro sounds, glitched extended 1up sound from SMB3
oh! so it works like the enigma code kinda! that's pretty neat
I understand so little of these videos... But I watch them nonetheless.
11:50 I never knew what they were called XD I love that name so much
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
RGME really just spawned in making dope videos about retro games, huh.
Your series is great, great job! Top-quality stuff.
I'm sorry but you lost me about 60 seconds in. I don't know why I keep watching these videos when they go right over my head.
Because they are awesome! :D
Same here but it's because I think they are very hard to understand. I wouldn't say that I'm dumb but these clips make me feel like an idiot :D Nevertheless I'm always impressed how someone can break these codes and explain stuff I'd never understood! :D
@@StooRoxxAss i know what all of this stuff is but i also know 6502 assembly and have been learning this stuff for a while
Xor being EOR is probably the most cursed thing ever
Me: hearing EOR instead of XOR
Me: * insert suprised pikachu face *
Nice vid. Would be interesting to see some statistical analysis on the rng, like a distribution plot, compared to a modern prng. I know some classic games have notoriously bad rngs.
Amazing. You really deserve more subs.
Despite Super Mario World supposedly being rushed, they sure did put a lot of effort into those birds on Yoshi's House.
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
It’s kind of the same, but instead of the character’s precise *POSITION,* you’d be interested in the character’s precise *SPEED.* Consider needing to cross a gap that’s 23 units wide. Let’s say, for the sake of simplicity, that your jump lasts for 5 frames, and your speed oscillates between 4 and 5 upf (units per frame), every frame. Now, if your speed = 5 upf on the first frame of your jump, your speeds throughout the jump will be: 5-4-5-4-5; so, your jump will carry you 5 + 4 + 5 + 4 + 5 = 23 units; so, you *WILL* cross the gap. If, on the other hand your speed on the first frame is 4 upf, your speeds throughout the jump will be: 4-5-4-5-4; so, your jump will carry you 4 + 5 + 4 + 5 + 4 = 22 units; so, you *WON’T* cross the gap. As you can’t normally keep track of your precise speed every single frame, that event is considered luck-based. 🤓
Meah, now we have a RTC circuit to retrive "BIOS Time" to use the epoch time(seconds since Jan 1st 1970) as seed.
Anyway, for Sega Genesis I prefer using the "time" taken to user to press start as a seed, and a selector of what randon routine should it trigger.
My god man, you're a mad genius.
Another great way to get more randomness without additional hardware is to take inputs states at various intervals and use them as seeds. Not that random in a console, but for example in computer software, it's very typical to grab mouse movement, which is very difficult to replicate
13:28 what is that middle game?
This reads like a scientific paper, this is really incredible.
great, I'm waiting for a new video about Credits Warp Explained that shows all the addresses visually and how the bytes behave in them, so we can make new codes run
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
Category:
*_P e o p l e a n d b l o g s_*
In video about numbers and software.
Oh boy! ASM tutorial coming soon!
So even though the RNG will repeat every 27776 calls, it seems that for a lot of the RNG calls that only care about the results of the upper or lower bits; this means that for their relevant behavior that RNG call sequence "repeats" for them every 128 or 217 calls, respectively, even if the full number 16 bit number is itself unique.
Also, I have a question: For Wendy and Lemmy their index for which pipe to appear out of is 4 bits long, allowing for 16 possibilities. There's only 8 pipes possible to appear out of. How exactly does the that work?
The generated value is used as an index into a table instead of the pipe index directly. It is also responsible for the locations of the dummy Koopas. There are only 16 patterns for where all three show up, even though there could be 105 if every combination were possible.
wow, what a deep dive... I love it.
thanks for sharing!!
Urchins can also blink in practice in SMW, though.
11:47 Pac-man!
that was phenomenally good. well done
I just watch these to feel smart
Lol actually your videos are awesome. Keep it up
This is amazingly well made!
I have no idea how this makes sense but I still want to watch??
Very well made video, and very informative ! thanks for your hard work !
this is a seriously well made video
neatly explained!
10:08 For some reason I find this hilarious.
0:00
A legend was born
Thank you for making the rubik's cube scramble possible
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
im sorry but ASL stands for age, sex, location
Lambby American sign language
Lambby Lmao
A/S/L ?
Wanna cyber?... err... sorry, force of habit.
Random
just subbed tonight! Apart from the PHY / PLY, this code should effectively run unaltered on a Commodore 64. Interesting to see such a long, odd value before numbers repeat. Looks like a very fast routine as well. Dunno why they didn't just JSL STA JSL STA RTL and not bother with the Y register at all. Or, the routine can be even quicker with JSL TAY then fall through routine again to get A and exit with random (unsaved) values in A/Y.
Very good job for your first video
Nerd! .... Absolutely beautiful analysis
Im taking an intro to machine code class, and somehow this is all clicking in my head!
This channel is sick! Consider yourself patreon'd!
Solarbear ... last time I got patreon’d I woke up dry heaving margarita and chimichanga burps on sixo de Mayo
Very clear explanation, very well done!!!
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!
When a Sprite calls for RNG, the scroopy deep confarbles the regneray and the value of the boopyda bleeps returns to the lappy-slap33 then divide the tripptydoo by the regneray and you'll get the reason why a koopa moves right.
English? Please?
That’s the joke.
No. The real joke is that you don't understand this video, but you're not interested in putting in the time and effort to make it make sense, so you give up and say dumb things instead.