It's so surprising to me that there's someone out there making all these videos that are so perfectly focused on the exact kind of thing I want to learn about in a UA-cam video. Kudos on this, it's all really good stuff.
It's...surprising to me that....there is someone out there who commented so perfectly on something so...."random".... that I didn't realize I fully agreed until I read the comment under this video that I am fixated on in the dark, quietly watching and trying not to wake the wife.... 2.5 decades after I played Zelda as a kid.... just excited as hell and enthralled...with boring adult stuff looming in the morning. [Note: punctuation and sentence structure failures. I'm just very happy about your comment is all. You nailed it]
There's definitely a number of us out there that discovered an almost academic level interest in the inner workings of these games we loved growing up. I was afraid it would ruin the "magic" so to speak, but I found I have a new level of appreciation for them
I love these code walks. I have hobbyist-level experience with coding, but I've never worked with assembly code. I didn't really have a concept of what it was - now I understand how it works thanks to these fascinating exercises in mapping memory and tracking byte values. I've been amazed how these videos deepen my understanding not just of vintage games but of fundamental computing concepts too. You also help us appreciate the ingenuity and artistry that went into creating these early games. Thanks for your work!!
make sure you check out Ben Eater's channel, he builds an 8-bit breadboard computer and has a ton of videos about assembly and comparing to C code and stuff like that, he built his own "video card" on a breadboard, his videos are awesome.
That was actually added in the English translation. The Japanese one said "Look for the Lion Key" (presumably because level 8 has two items and the magic book is easy to find, so people might not think to look for the Lion Key). The 10th enemy hint is a pretty dope one though. It was utterly mystifying for decades ... and turned out to be correct!!
@@ssl3546 That's even more interesting. It means the localizers themselves were struck by what an odd mechanic it was and decided to put in a hint about it.
@@MrCheeze I realize this is minute, but I actually kinda doubt that Zelda I's in-game text was given a proper "localization" treatment. The translation is... spotty to put it lightly, and has plenty of grammar and spelling errors that I doubt any decent editor would have overlooked. I suspect that the game was translated by a non-native speaker who didn't know English *that* well but could indeed translate, then the people overseas more-or-less only went through it to change any mentions of "Legend of Zelda" to "The Legend of Zelda" and to change the name of the "Bible" item to "Book of Magic". I even doubt that the localizers would have known about the bomb drop mechanic, since the roughness of the text suggests they mostly left the game alone aside for small tweaks. (Random aside: I suspect this initial translator could potentially have been one of the game's programmers, as that would explain how the hint to a very obscure mechanic made it in there.) From what I heard, this doesn't seem that out there of a possibility: IIRC the early Final Fantasy games were handled somewhat similarly, with an in-house translator doing all the text, then the rough English getting handed over for editing/localizing. The difference being FF's editors did a better job at cleaning up the text, mostly. The manual seems like where most of the translation/localization effort went; especially the story, which is actually pretty well translated. I will give the in-game text's translator credit for one thing though: "Spectacle Rock" is a stunningly good way to translate "Megane Iwa", especially by the standards of the rest of the translation.
As a programmer myself with pretty extensive experience with x86 assembly, I know how tedious (but fun) it can be to reverse assembly code such as this. I also know how difficult it can be to explain such code line-by-line in such an easy to understand manner. It is obvious however that you are very good at doing this and I commend you for just how elegantly you managed to convey this info along with excellent visuals and scripting which make the content very easy to consume. Superb job overall!
This completely checks out, my childhood favorite place to grind money were the Ropes in Dungeon 2 and they have the best drop chance in the above table (59%) and a member of Group C which is filled with Rupee drops. This video was wonderfully done and I had a great time thinking about all of this.
Your videos are FANTASTIC. I love the level of depth you go into. As a developer but not super familiar with developing on the 6502 or the NES, I find it so interesting.
God I love this channel. I have no experience or education with code but each of these videos I watch makes want to understand more and try it myself. It's like when I studied science at uni. Translating the formulas to the practical applications gives you better understanding, especially when play around with the figures. The only real challenge is wrapping your head around hexadecimal code. The rest is pure logic.
The actual RNG part is a software implementation of a so-called Linear Feedback Shift Register. This is used in the NES noise channel to provide the random sequence of pulses we perceive as the static sound. Basically any retro sound device that has a noise sound did this, with different "tap" setups to determine the new bit that was generated. The resulting sound was a little different but the principle was the same for all of them.
Interestingly enough, all of the sounds on the Atari 2600 are produced from two LFSRs. They can be configured to have different patterns and periods, which produces different timbres. The periods can be quite short, like 31 cycles.
This is actually TOP TIER content. The amount of work put into these videos is fantastic. The code manipulation is complex, yet easy to understand on a basic level. Perhaps most importantly, these techniques provides instantaneous results that you can watch occur in real-time simultaneously in game and on the hardware itself. Videos like this should be shown to children in school -- I think it could be a fantastic means to encourage them to take a step into the world of programming.
Original legend of Zelda devs put in a message about how their code works, and we find out why 30+ years later. Amazing, and I love being a software developer now and can finally understand all this stuff down to the very core. So cool
For the next video I would love to see you look into the logic behind enemy respawn, since the logic behind it is surprisingly intricate, but because it's irrelevant to speedrunning, there's not enough detailed documentation on how it works.
I love seeing under the hood on emergent mechanics like this which feel random despite being far more predictable in their implementation. This was one of the most approachable Behind the Code episodes for me, or maybe I'm just getting used to seeing assembly in the other videos. Great work!
What's interesting about this is that it shows evidence of a smooth/creative development process / toolchain through how succinct and concise each system really is at its core. The fact that Nintendo decided to go so far as to program a goofy bomb mechanic into an already complex "drop" system just goes to show how freely they were able to make games in that day and age -- even _with_ the intense memory/CPU limitations they were facing. (Zelda's efficiency even led to a 2nd quest!!)
As a kid I always noticed that killing clusters of enemies by using bombs seemed to yield more bomb drops. I also noticed that the Ropes in level 2 were a great source of 5-rupies. It's interesting to see the actual logic behind it.
Fun fact: When an enemy is holding an item, like the Stalfos holding a key in level 1, it's not treated like a normal item drop. You can actually collect the key without defeating it just by walking through the enemy, and if you do so it won't drop the item when you do defeat it. Best I can tell it just spawns in an item like normal and just attaches it to an entity, so it becomes stationary once the thing holding it dies.
Great video! Love your content! It would be if you could make a behind the scenes/tutorial about the tools you use (emulator, scripting, disassembler)!
The manual hinted at the general drop rates of enemies, but I would never have considered the ingenious, fool-proof "undead carrier #1" exclusion regarding Bomb/Fairy Force-Dropping. That caught me by surprise. When I make a Doom Mod that severs the original's over-emphasis on finite resources in level design (i.e. creatures drop all kinds of goodies to help a player survive), I will base it on Zelda's process, up to and including the number of items, how often, who, etc.
I'd be careful with that. The first thing that struck me is how this sort of overdesign led to all kinds of player frustration in the past. For example, you know how players would complain that they'd always get fairies when they didn't need them? Well, now we know why - rewarding a streak of 16 damageless kills with an item intended to restore the damage you did not take is not a good design choice. Likewise, requiring a bomb for the bonus bomb drop is non-intuitive and only rewards players who are using their bombs very casually (i.e. not players who desperately need a bomb pickup). And locking out 3/4 of your enemies from dropping bombs? A player may end up in the middle of a dungeon and run out of bombs, and if there's no enemies around who give out bombs they're going to keep killing the closest enemies, completely unaware that they will never get a bomb drop. Honestly, I think the game would've done better with more RNG.
Awesome video! The code introspection was very interesting. Can you do something on map storage in zelda, and how link collides with the map data (walls and such)?
@@DisplacedGamers There is also some neat stuff going on in how Zelda unpacks room layouts for the overworld and dungeons with like three layers of indirection. Screens -> Column Lists -> Sequence Table -> Vertical Strips ("quads") Would love to see that explored and where they use (or missed) opportunity for shared code/data. I wonder if it was driven by the speed of disk drive access or the size limit.
From what I read/seen, Zelda I apparently stores the dungeons in a rather curious way: They're all just laid out more or less just as you see them in the game, but they're all interlocking together like a jigsaw puzzle to make the most efficient use of the space. I imagine this is why the shapes the dungeons are supposed to be in are pretty vague at times, and possibly is why we have the... odd choice of the Manji. The programmer responsible for laying out the dungeons actually did such a good job at saving space that he only used half the memory allocated to this task, which is why we have the Second Quest.
One time I played this, I killed a Goriya in Level 2, and all the other Goriyas died as well, and the game called for a fairy drop at that moment, so the room filled with fairies! I have recorded proof of it, too. It happened on my Switch.
Love these disassemblies. I’ve been breaking down the first Castlevania, much to my enjoyment. I’ve found I’ve learned a lot about 6502 in general beyond simply the syntax when disassembling. Had one of those “aha” moments tonight which was cool! I also use Mesen but can’t seem to comment when looking at the debugger. Is that the appropriate section? I’ve been resorting to writing in notepad hahaha. Thanks again for inspiring this interest in me.
I really love this series - I share it with the Gamer group at my company in our Slack channel. It's such an amazing look at the games that defined us. I wonder if there was a similar logic for drops that was used based on the developer that actually made the game?
Great video. I used to try to analyze the hex values in mega man x back in 2013. Would be poggers if you could do a "facet of the gem " video on the thunder force games. A lesser known but legendary space shooter series
I want how can you spawn combo drops like the 2 fairies you got at the end? I myself have witnessed 3 fairies spawn in my playthroughs. Is it because killing a "collective of enemies" with one strike counts as 1 enemy?
Love the channel, your work and your explanations. Have you looked into enemy movement patterns and how they work? It would be fascinating to see how they implemented that.
"10th enemy has the bomb" That clue was the most vague, and mystified me as a kid. I thought you just had to kill 10 enemies without getting hit, but it didn't always happen.
I'm curious if there was a reason they cared so much about not letting enemies with items drop anything, other than the aesthetics of a messy double drop? I wonder what would happen if those lines of code were removed...
There is a chance it could be to do with rendering time, the PPU has only so much time to render everything on screen. Which means there is a maximum amount of sprites that can be rendered at one given time. Having an extra item/sprite drop could cause the PPU to run out of time. Running out of rendering time is far worse then flicker. This could result in enemy sprites completely becoming invisible and would be classed as a show stopping bug. So all in all it could be to make sure they don't exceed the maximum limit to prevent game breaking bugs.
It could be a readability concern. Some players may kill an enemy, then immediately move in to collect whatever they dropped without first seeing what it was. Having two items on top of eachother just creates confusion.
Are you familiar with Zelda 1 speedruns? All the top players incorporate kill streaks to force bomb drops throughout the run. There's also a screen scrolling glitch that you might find interesting.
I know it isn't exactly what you're covering, and maybe I missed it, but what's the deal with the thing that happens where you kill one enemy in a dungeon room, and all the other enemies of that type instantly die?
I'm 90% sure that this is discussed in the manual, but it might not be. Anyhow, some rooms have a monster marked as the "ringleader." When this one particular monster is killed, it takes all of its friends with it. There's only a handful of these in the entire game, and I don't believe it appears in any other Zelda title.
I found the manual online and checked, I can indeed confirm that it mentions this "ringleader" mechanic; it's a tip at the bottom of one of the early pages. What a weird mechanic, there's nothing that signposts if an enemy is a "ringleader" or not.
No wonder the second dungeon with all the snakes seemed such a great place to grind rupees. Full of group C enemies with highest drop chance and most potential drops are rupees.
This is so complicated! I wonder why they made these mechanics so complex. It’s kind of genius though because then if you know the mysterious mechanic you could use it
3:51 Doing a swordless run and I'm stuck between 2 rooms in the 6th Dungeon. My health is "okay", but I have a room with Vires and the other room with Wizrobes. I have one bomb, the red candle and plenty of arrows, however I can only use bombs on the Wizrobes and the the Vires won't drop anything. Thankfully I looked up your video since I was going crazy from not getting a random bomb drop. That's all I need right now. 😣
Hi, recently I have been digging into the NES simpsons vs space mutants ram to find out how Bart's controls work in this game because they are a bit weird, I have found out a few things but very little, I was wondering if I could consider a video on that and find out how the bart control works in the game and forces and speeds that control the character.
Player movement is a big deal. Collision detection is an often-cited problem in subpar games, but movement - especially in a platformer - can destroy the fun factor from the word "GO." If you are considering a video on it, I say go for it!
For a moment I thought you might actually cover something I've wondered about in the game... Sometimes when you kill an enemy, all enemies on screen die. It's kind of like the killing the main ghost, but I've seen it happen in dungeons. Mainly level 2, with the bomberang guys. I swear it's random, but thinking about it now I wouldn't be surprised if it only happens in certain rooms. Is not, it's probably related to that slot 0 thing.
You probably found the answer to this on your own already, but it is indeed something specific to certain rooms. There's a flag that sets the room to have a "leader" amongst the enemy group. The leader is always the enemy in the first slot. If the leader is killed, all enemies die. It's usually used in specific dungeon rooms but as you noticed it's also used on all the graveyard screens which is why killing the first ghost will kill any of the others that were spawned after it.
I took a closer look at the PRNG, and determined that it is a 2 tap 16 bit Linear Feedback Shift Register, with 11 more bytes to capture its output. The period of this LFSR is 32768
weird thing about the drop chance, it's impossible to have something drop 100% of the time, since with the highest value of 255 the chance to get the drop would be 255/256 ie 99.6%.
10th enemy has the bomb. I never knew what that meant when I played the game decades ago but over the past few years I learned what that meant - ie exactly what your video here goes over. No idea why something that cryptic was in the game. Did Nintendo (or more likely the localisers) expect players to have the basic internal game knowledge to know what that meant?
Umm, did I miss something? You show this chart for the enemy types and the "drop turn," but what determines the drop turn? I keep rewatching that section but it is never explained.
When you kill an enemy, the current drop turn determines which item will drop (if any) and rolls to the possible drop turn. There are some exceptions such as when you encounter an enemy that splits. The end of the video rolls a green highlight through the drop turn on the left side of the screen as each enemy is defeated.
@@DisplacedGamers No, I mean, what determines what the value of the drop-turn is? Does it increment with killing enemies? Does it increment each time a drop occurs? What actually changes the value of $52A? You missed explaining this in the video.
I noticed a significant difference in item drops between the famicom cartridge versions and the nes versions of rev-a non rev-a. It's crazy how much of a difference it really is. Even the GameCube version is better than the NES Mini.
So I was playing level 2 and in one of the rooms (filled with the red guys who throw boomerangs) I happened to kill one just as it threw its boomerang. The rest of the monsters died and disappeared, however the boomerang was still moving. The items dropped where initially a rupee and a bomb but when the boomerang touched the rupee it turned into a bomb. I know that’s a poor explanation but If you happen to see this comment and are interested, please let me know so I can explain in detail.
Wow that’s a grammatical train wreck^^ In short: I killed a red goriya right as it threw its boomerang. The goriya disappeared and dropped a rupee but when it’s boomerang returned to the spot where it died the rupee became a bomb.
Good ol RAM manipulation. So many games can make use of it but the NES ones are stand out choices because of how "simple" they are by comparison to more modern day games.
So many games using basic RNGs (that famous random number table), and Zelda's over here showing them what a real LFSR looks like. (Well, not quite. Needs longer taps. But close!)
so they way i understand: if i wanted to manipulate for the highest chance to get rupees, i'd need to kill C-class enemies on the 1st/3rd/4th/7th/8th/9th/10th visit to a screen (room) that houses them? because 0-1 turn may be a rupee, but 1-2 turn may be heart and so on(?).
The turn rolls after a kill. It is independent of screens visited. So if you walk into a screen with 5 enemies from Group C and are sitting on 3-4, you have a chance to obtain: blue rupee, heart, clock, rupee, rupee
Why does it drop you a fairy after you don't get hit after killing 16 monsters? You shouldn't need health if you killed 16 monsters without getting hit, and therefore losing any health.
One premise to live by. There is no such thing that is truly random. Something may seem random but it's just too many seemingly unrelated variables to track... usually Ignoring quantum level physics of course.
How you say in resume as i understand How this read enemies Read the enemies of X Read the enemies of A Read again the enemies of X Read the enemies of C Read yet again the enemies of X Read the enemies of B Read again the last time the enemies of X Read the enemies of D He see if the enemy if a item carrying gibdo or stalfos And check the forced drops if posible mechanics and some RGN and wolla item droped The RGN it's make from 32bit, 8 digit binary numbers, and truth tables in nmi
It could be that they wanted to only provide a forced drop of any variety at a minimum of ten flawless kills. The forced fairy drop resets the 0-10 streak because of this, and the total kill streak doesn't need to be reset because the fairy only drops at 16 (it won't drop at 32, 48, etc.)
@@DisplacedGamers Plausible, though another explanation also occurred to me: Perhaps they simply didn't want to code a priority decision on 80/160/240/etc hits, which are the common multiples between the two forced drops. Does anything notable happen when the fairy counter would roll over from 255?
@@qriist1850 Just for the heck of it, I forced the value to FE and defeated a few enemies. It rolled over to zero - as expected, I guess. I didn't look at any code for this. Getting the counter to 16 again force-dropped a fairy.
I'd wager at least part of the reason that the fairy counter doesn't reset itself is because it was deemed unneccessary to continue producing fairies if the player is on a massive flawless streak. It makes sense to repeatedly reward the player with money/bombs (which are readily expended by the player) for playing the game well, but little sense to continually reward him with life refills, especially given that he'll likely be picking up additional single hearts during each flawless 16 cycle.
That bomb drop explanation could make me actually enjoy this game again. I stopped enjoying it last time I replayed the game, entirely due to bombs, when I'd use all my bombs on one screen looking for the secret without a guide, then it'd take me 20+ minutes to get even one bomb drop, and then of course I'd get like 5 bomb drops at once, while I still only had 8 max. The last time I played, I was able to still get all the secrets unlocked before I got around to bothering with any bomb capacity upgrades, because I just wasn't getting enough money to buy up other things like the big shield or blue ring yet. So, eh, maybe still iffy anyway. This is one of those things where old games, especially due to bad translations, I just started giving up on them even having grew up with Zelda 1 since a child. All that methodology for how bombs drop is just so obtuse, unknown, and what hints you do get were poorly conveyed to the point of useless. I really shouldn't have to hear nearly 40 years later how it all works to be able to continue enjoying the time spent in the game, because it took someone, probably technically illegally, ripping apart the code to reveal the inner workings to make it all clear. I consider Zelda 1 a bad game these days, the way it's packaged and presented to the player without external intervention by fans. There are so many other games, new and old, that I enjoy without such bad design involved.
It's so surprising to me that there's someone out there making all these videos that are so perfectly focused on the exact kind of thing I want to learn about in a UA-cam video. Kudos on this, it's all really good stuff.
It's...surprising to me that....there is someone out there who commented so perfectly on something so...."random".... that I didn't realize I fully agreed until I read the comment under this video that I am fixated on in the dark, quietly watching and trying not to wake the wife.... 2.5 decades after I played Zelda as a kid.... just excited as hell and enthralled...with boring adult stuff looming in the morning. [Note: punctuation and sentence structure failures. I'm just very happy about your comment is all. You nailed it]
There's definitely a number of us out there that discovered an almost academic level interest in the inner workings of these games we loved growing up. I was afraid it would ruin the "magic" so to speak, but I found I have a new level of appreciation for them
I love these code walks. I have hobbyist-level experience with coding, but I've never worked with assembly code. I didn't really have a concept of what it was - now I understand how it works thanks to these fascinating exercises in mapping memory and tracking byte values. I've been amazed how these videos deepen my understanding not just of vintage games but of fundamental computing concepts too. You also help us appreciate the ingenuity and artistry that went into creating these early games. Thanks for your work!!
Thank you for your comment, John. It means a lot to me.
I'm trying to learn 6502 and it's not easy that's for sure
make sure you check out Ben Eater's channel, he builds an 8-bit breadboard computer and has a ton of videos about assembly and comparing to C code and stuff like that, he built his own "video card" on a breadboard, his videos are awesome.
Wow, that forced bomb drop is such a weird mechanic, and to be one they considered worth making a hint about of all things.
That was actually added in the English translation. The Japanese one said "Look for the Lion Key" (presumably because level 8 has two items and the magic book is easy to find, so people might not think to look for the Lion Key). The 10th enemy hint is a pretty dope one though. It was utterly mystifying for decades ... and turned out to be correct!!
@@ssl3546 That's even more interesting. It means the localizers themselves were struck by what an odd mechanic it was and decided to put in a hint about it.
@@MrCheeze I realize this is minute, but I actually kinda doubt that Zelda I's in-game text was given a proper "localization" treatment. The translation is... spotty to put it lightly, and has plenty of grammar and spelling errors that I doubt any decent editor would have overlooked.
I suspect that the game was translated by a non-native speaker who didn't know English *that* well but could indeed translate, then the people overseas more-or-less only went through it to change any mentions of "Legend of Zelda" to "The Legend of Zelda" and to change the name of the "Bible" item to "Book of Magic". I even doubt that the localizers would have known about the bomb drop mechanic, since the roughness of the text suggests they mostly left the game alone aside for small tweaks.
(Random aside: I suspect this initial translator could potentially have been one of the game's programmers, as that would explain how the hint to a very obscure mechanic made it in there.)
From what I heard, this doesn't seem that out there of a possibility: IIRC the early Final Fantasy games were handled somewhat similarly, with an in-house translator doing all the text, then the rough English getting handed over for editing/localizing. The difference being FF's editors did a better job at cleaning up the text, mostly.
The manual seems like where most of the translation/localization effort went; especially the story, which is actually pretty well translated. I will give the in-game text's translator credit for one thing though: "Spectacle Rock" is a stunningly good way to translate "Megane Iwa", especially by the standards of the rest of the translation.
As a programmer myself with pretty extensive experience with x86 assembly, I know how tedious (but fun) it can be to reverse assembly code such as this. I also know how difficult it can be to explain such code line-by-line in such an easy to understand manner. It is obvious however that you are very good at doing this and I commend you for just how elegantly you managed to convey this info along with excellent visuals and scripting which make the content very easy to consume. Superb job overall!
Hm, so this is why Goblin Slayer is always counting his kills.
i dont know what that is but he must be a gamer
@@kooolainebulger8117 I'm surprised this is on youtube, but here it is. This is for your education. ua-cam.com/video/kQ7Kaj97YNk/v-deo.html
This completely checks out, my childhood favorite place to grind money were the Ropes in Dungeon 2 and they have the best drop chance in the above table (59%) and a member of Group C which is filled with Rupee drops. This video was wonderfully done and I had a great time thinking about all of this.
Your videos are FANTASTIC. I love the level of depth you go into. As a developer but not super familiar with developing on the 6502 or the NES, I find it so interesting.
It took me 30years to understand, why level 2 is a good place to make bank. thank you very much.
God I love this channel. I have no experience or education with code but each of these videos I watch makes want to understand more and try it myself.
It's like when I studied science at uni. Translating the formulas to the practical applications gives you better understanding, especially when play around with the figures. The only real challenge is wrapping your head around hexadecimal code. The rest is pure logic.
The actual RNG part is a software implementation of a so-called Linear Feedback Shift Register. This is used in the NES noise channel to provide the random sequence of pulses we perceive as the static sound. Basically any retro sound device that has a noise sound did this, with different "tap" setups to determine the new bit that was generated. The resulting sound was a little different but the principle was the same for all of them.
Interestingly enough, all of the sounds on the Atari 2600 are produced from two LFSRs. They can be configured to have different patterns and periods, which produces different timbres. The periods can be quite short, like 31 cycles.
not to sound stupid, but what was the benefit of this?
@@BigHailFan A cheap way to get variety I assume.
"you'll see why in just a *BIT*"
Tell me this was intentional 😄
I'm learning a lot about 6502 assembly by watching your amazing videos
Bismuth also goes into detail for this topic as well in his legend of zelda any% explained video :)
Love Bismuth.
That was a great video. It's crazy that the No Up+A Any% has been broken twice since that video came out... it was only about a month ago.
This is actually TOP TIER content. The amount of work put into these videos is fantastic. The code manipulation is complex, yet easy to understand on a basic level. Perhaps most importantly, these techniques provides instantaneous results that you can watch occur in real-time simultaneously in game and on the hardware itself.
Videos like this should be shown to children in school -- I think it could be a fantastic means to encourage them to take a step into the world of programming.
I love this Behind the Code series. Looking forward to the next episode!!
Original legend of Zelda devs put in a message about how their code works, and we find out why 30+ years later.
Amazing, and I love being a software developer now and can finally understand all this stuff down to the very core. So cool
This hurt my head in the best possible way. I love it!
Glad I'm not the only one.... I find these videos so interesting yet almost headache inducing.
This video, and the previous one on hit detection, is one of the top videos on yt. Deserves 10x more views than it has.
Great video. Love how you dig into the inner workings of these games of my childhood :)
if this was my bitwise lesson 20 years ago, I'd have been better prepared for life! Great video, sir
For the next video I would love to see you look into the logic behind enemy respawn, since the logic behind it is surprisingly intricate, but because it's irrelevant to speedrunning, there's not enough detailed documentation on how it works.
I love your level of detail in going through this old classic!
I love seeing under the hood on emergent mechanics like this which feel random despite being far more predictable in their implementation.
This was one of the most approachable Behind the Code episodes for me, or maybe I'm just getting used to seeing assembly in the other videos. Great work!
What's interesting about this is that it shows evidence of a smooth/creative development process / toolchain through how succinct and concise each system really is at its core.
The fact that Nintendo decided to go so far as to program a goofy bomb mechanic into an already complex "drop" system just goes to show how freely they were able to make games in that day and age -- even _with_ the intense memory/CPU limitations they were facing. (Zelda's efficiency even led to a 2nd quest!!)
Very interesting. When this game was new I took advantage of the item drop code without knowing it, farming for rupees to buy a blue ring.
Although it's out here for a year, I just dropped by.. And.. IT... IS... AWESOME!
You had me at "Behind the Code" -- and "Zelda" of course.
Simplifying your videos may yield a larger audience. I really enjoy the parts I understand.
Thanks. Some of the more recent videos are a bit shorter and balance the heavy technical with the flow a bit better. It is an ongoing endeavor.
I love learning about the code behind the new/snes games
Excellent video. This was so fascinating, especially as I'm playing through this again currently!
As a kid I always noticed that killing clusters of enemies by using bombs seemed to yield more bomb drops. I also noticed that the Ropes in level 2 were a great source of 5-rupies. It's interesting to see the actual logic behind it.
Fun fact: When an enemy is holding an item, like the Stalfos holding a key in level 1, it's not treated like a normal item drop. You can actually collect the key without defeating it just by walking through the enemy, and if you do so it won't drop the item when you do defeat it. Best I can tell it just spawns in an item like normal and just attaches it to an entity, so it becomes stationary once the thing holding it dies.
Love this! Excellent backing track too!
This motivates me to go back and continue working on my nes emulator!
Great video! Love your content! It would be if you could make a behind the scenes/tutorial about the tools you use (emulator, scripting, disassembler)!
The manual hinted at the general drop rates of enemies, but I would never have considered the ingenious, fool-proof "undead carrier #1" exclusion regarding Bomb/Fairy Force-Dropping. That caught me by surprise.
When I make a Doom Mod that severs the original's over-emphasis on finite resources in level design (i.e. creatures drop all kinds of goodies to help a player survive), I will base it on Zelda's process, up to and including the number of items, how often, who, etc.
I'd be careful with that. The first thing that struck me is how this sort of overdesign led to all kinds of player frustration in the past. For example, you know how players would complain that they'd always get fairies when they didn't need them? Well, now we know why - rewarding a streak of 16 damageless kills with an item intended to restore the damage you did not take is not a good design choice. Likewise, requiring a bomb for the bonus bomb drop is non-intuitive and only rewards players who are using their bombs very casually (i.e. not players who desperately need a bomb pickup). And locking out 3/4 of your enemies from dropping bombs? A player may end up in the middle of a dungeon and run out of bombs, and if there's no enemies around who give out bombs they're going to keep killing the closest enemies, completely unaware that they will never get a bomb drop. Honestly, I think the game would've done better with more RNG.
Awesome video! The code introspection was very interesting. Can you do something on map storage in zelda, and how link collides with the map data (walls and such)?
Hmm. The screen scroll glitch and block clipping might make for a good topic at some point.
@@DisplacedGamers There is also some neat stuff going on in how Zelda unpacks room layouts for the overworld and dungeons with like three layers of indirection.
Screens -> Column Lists -> Sequence Table -> Vertical Strips ("quads")
Would love to see that explored and where they use (or missed) opportunity for shared code/data. I wonder if it was driven by the speed of disk drive access or the size limit.
From what I read/seen, Zelda I apparently stores the dungeons in a rather curious way: They're all just laid out more or less just as you see them in the game, but they're all interlocking together like a jigsaw puzzle to make the most efficient use of the space. I imagine this is why the shapes the dungeons are supposed to be in are pretty vague at times, and possibly is why we have the... odd choice of the Manji.
The programmer responsible for laying out the dungeons actually did such a good job at saving space that he only used half the memory allocated to this task, which is why we have the Second Quest.
One time I played this, I killed a Goriya in Level 2, and all the other Goriyas died as well, and the game called for a fairy drop at that moment, so the room filled with fairies! I have recorded proof of it, too. It happened on my Switch.
Love these disassemblies. I’ve been breaking down the first Castlevania, much to my enjoyment. I’ve found I’ve learned a lot about 6502 in general beyond simply the syntax when disassembling. Had one of those “aha” moments tonight which was cool!
I also use Mesen but can’t seem to comment when looking at the debugger. Is that the appropriate section? I’ve been resorting to writing in notepad hahaha.
Thanks again for inspiring this interest in me.
I really love this series - I share it with the Gamer group at my company in our Slack channel. It's such an amazing look at the games that defined us. I wonder if there was a similar logic for drops that was used based on the developer that actually made the game?
Great video. I used to try to analyze the hex values in mega man x back in 2013. Would be poggers if you could do a "facet of the gem " video on the thunder force games. A lesser known but legendary space shooter series
I want how can you spawn combo drops like the 2 fairies you got at the end? I myself have witnessed 3 fairies spawn in my playthroughs. Is it because killing a "collective of enemies" with one strike counts as 1 enemy?
Awesome!!!! Makes so much sense now. Thanks for the hard work.
Love the channel, your work and your explanations. Have you looked into enemy movement patterns and how they work? It would be fascinating to see how they implemented that.
!! Always a joy to see a new vid from you :D
This is some god-tier work. 👍🏻👏🏻
Pretty fascinating video! Thanks for uploading!
This is excellent stuff. I’d be interested in how the maps of Zelda I are stored/compressed and then ultimately rendered.
"10th enemy has the bomb"
That clue was the most vague, and mystified me as a kid. I thought you just had to kill 10 enemies without getting hit, but it didn't always happen.
I'm curious if there was a reason they cared so much about not letting enemies with items drop anything, other than the aesthetics of a messy double drop? I wonder what would happen if those lines of code were removed...
There is a chance it could be to do with rendering time, the PPU has only so much time to render everything on screen. Which means there is a maximum amount of sprites that can be rendered at one given time. Having an extra item/sprite drop could cause the PPU to run out of time. Running out of rendering time is far worse then flicker. This could result in enemy sprites completely becoming invisible and would be classed as a show stopping bug. So all in all it could be to make sure they don't exceed the maximum limit to prevent game breaking bugs.
It could be a readability concern. Some players may kill an enemy, then immediately move in to collect whatever they dropped without first seeing what it was. Having two items on top of eachother just creates confusion.
Are you familiar with Zelda 1 speedruns? All the top players incorporate kill streaks to force bomb drops throughout the run. There's also a screen scrolling glitch that you might find interesting.
I know it isn't exactly what you're covering, and maybe I missed it, but what's the deal with the thing that happens where you kill one enemy in a dungeon room, and all the other enemies of that type instantly die?
I'm 90% sure that this is discussed in the manual, but it might not be. Anyhow, some rooms have a monster marked as the "ringleader." When this one particular monster is killed, it takes all of its friends with it. There's only a handful of these in the entire game, and I don't believe it appears in any other Zelda title.
I found the manual online and checked, I can indeed confirm that it mentions this "ringleader" mechanic; it's a tip at the bottom of one of the early pages.
What a weird mechanic, there's nothing that signposts if an enemy is a "ringleader" or not.
No wonder the second dungeon with all the snakes seemed such a great place to grind rupees. Full of group C enemies with highest drop chance and most potential drops are rupees.
As a note speedrunners have been able to completely manipulate Level 3's RNG by using a sound queue before entering the dungeon.
This is so complicated! I wonder why they made these mechanics so complex. It’s kind of genius though because then if you know the mysterious mechanic you could use it
Woot more behind the code!
3:51
Doing a swordless run and I'm stuck between 2 rooms in the 6th Dungeon. My health is "okay", but I have a room with Vires and the other room with Wizrobes. I have one bomb, the red candle and plenty of arrows, however I can only use bombs on the Wizrobes and the the Vires won't drop anything. Thankfully I looked up your video since I was going crazy from not getting a random bomb drop. That's all I need right now. 😣
Hi, recently I have been digging into the NES simpsons vs space mutants ram to find out how Bart's controls work in this game because they are a bit weird, I have found out a few things but very little, I was wondering if I could consider a video on that and find out how the bart control works in the game and forces and speeds that control the character.
Player movement is a big deal. Collision detection is an often-cited problem in subpar games, but movement - especially in a platformer - can destroy the fun factor from the word "GO."
If you are considering a video on it, I say go for it!
As a kid I had noticed that blue octoroks were more likely to drop bombs and 5-rupees
Wow. That’s pretty cool. I now better understand those speed runs.
The automatic subtitles are totally screwed up for this video. Wow.
For a moment I thought you might actually cover something I've wondered about in the game...
Sometimes when you kill an enemy, all enemies on screen die. It's kind of like the killing the main ghost, but I've seen it happen in dungeons. Mainly level 2, with the bomberang guys. I swear it's random, but thinking about it now I wouldn't be surprised if it only happens in certain rooms. Is not, it's probably related to that slot 0 thing.
You probably found the answer to this on your own already, but it is indeed something specific to certain rooms. There's a flag that sets the room to have a "leader" amongst the enemy group. The leader is always the enemy in the first slot. If the leader is killed, all enemies die. It's usually used in specific dungeon rooms but as you noticed it's also used on all the graveyard screens which is why killing the first ghost will kill any of the others that were spawned after it.
I took a closer look at the PRNG, and determined that it is a 2 tap 16 bit Linear Feedback Shift Register, with 11 more bytes to capture its output. The period of this LFSR is 32768
Any chance you could share your Mesen scripts? It would be great to play around with values and be able to play with pre-planned drops!
Love this channel!
weird thing about the drop chance, it's impossible to have something drop 100% of the time, since with the highest value of 255 the chance to get the drop would be 255/256 ie 99.6%.
10th enemy has the bomb.
I never knew what that meant when I played the game decades ago but over the past few years I learned what that meant - ie exactly what your video here goes over.
No idea why something that cryptic was in the game. Did Nintendo (or more likely the localisers) expect players to have the basic internal game knowledge to know what that meant?
Umm, did I miss something? You show this chart for the enemy types and the "drop turn," but what determines the drop turn?
I keep rewatching that section but it is never explained.
When you kill an enemy, the current drop turn determines which item will drop (if any) and rolls to the possible drop turn. There are some exceptions such as when you encounter an enemy that splits.
The end of the video rolls a green highlight through the drop turn on the left side of the screen as each enemy is defeated.
@@DisplacedGamers No, I mean, what determines what the value of the drop-turn is?
Does it increment with killing enemies? Does it increment each time a drop occurs? What actually changes the value of $52A? You missed explaining this in the video.
Oh I love u code walks. He old time movie star, he hey, he sukmydik???
12:02 What's the Zelda remix from?
So it wasn't my imagination that group c had particularly wealthy drops.
I clicked on this so fast
I noticed a significant difference in item drops between the famicom cartridge versions and the nes versions of rev-a non rev-a. It's crazy how much of a difference it really is. Even the GameCube version is better than the NES Mini.
What is the difference?
What happens if you remove the RNG code updates, so it's always set at 40?
So I was playing level 2 and in one of the rooms (filled with the red guys who throw boomerangs) I happened to kill one just as it threw its boomerang. The rest of the monsters died and disappeared, however the boomerang was still moving. The items dropped where initially a rupee and a bomb but when the boomerang touched the rupee it turned into a bomb.
I know that’s a poor explanation but If you happen to see this comment and are interested, please let me know so I can explain in detail.
Wow that’s a grammatical train wreck^^
In short: I killed a red goriya right as it threw its boomerang. The goriya disappeared and dropped a rupee but when it’s boomerang returned to the spot where it died the rupee became a bomb.
YEEEESSSSS!!!! AWESOME!!!!!
Good ol RAM manipulation. So many games can make use of it but the NES ones are stand out choices because of how "simple" they are by comparison to more modern day games.
So many games using basic RNGs (that famous random number table), and Zelda's over here showing them what a real LFSR looks like.
(Well, not quite. Needs longer taps. But close!)
so they way i understand: if i wanted to manipulate for the highest chance to get rupees, i'd need to kill C-class enemies on the 1st/3rd/4th/7th/8th/9th/10th visit to a screen (room) that houses them? because 0-1 turn may be a rupee, but 1-2 turn may be heart and so on(?).
The turn rolls after a kill. It is independent of screens visited. So if you walk into a screen with 5 enemies from Group C and are sitting on 3-4, you have a chance to obtain: blue rupee, heart, clock, rupee, rupee
As a child I always thought the blue enemies were more likely to drop blue items. Is there any evidence for that?
I want to learn this in a programming class
I would hate to be the guy routing the legend of zelda speedrun for the drops they currently have.
Why does it drop you a fairy after you don't get hit after killing 16 monsters? You shouldn't need health if you killed 16 monsters without getting hit, and therefore losing any health.
One premise to live by. There is no such thing that is truly random. Something may seem random but it's just too many seemingly unrelated variables to track... usually
Ignoring quantum level physics of course.
Thanks!
Thank you!
Interesting facts, but I doubt I'll ever them whenever I reply Zelda I.
Change Gannon to drop items
Keefs , stalfos, just say bats and skeletons man you're not impressing anyone 😂😂😂 jk man good video!
He just says the names to impress the ladies....
It's KEESE.
How about a video on how Nintendo made a game in 1984 utilizing the available technology they had to utilize. I double dog dare ya
How you say in resume as i understand
How this read enemies
Read the enemies of X
Read the enemies of A
Read again the enemies of X
Read the enemies of C
Read yet again the enemies of X
Read the enemies of B
Read again the last time the enemies of X
Read the enemies of D
He see if the enemy if a item carrying gibdo or stalfos
And check the forced drops if posible mechanics and some RGN and wolla item droped
The RGN it's make from 32bit, 8 digit binary numbers, and truth tables in nmi
Considering it doesn't reset itself, the fairy counter resetting the 5-rupee counter appears to be a programming bug.
It could be that they wanted to only provide a forced drop of any variety at a minimum of ten flawless kills. The forced fairy drop resets the 0-10 streak because of this, and the total kill streak doesn't need to be reset because the fairy only drops at 16 (it won't drop at 32, 48, etc.)
@@DisplacedGamers Plausible, though another explanation also occurred to me: Perhaps they simply didn't want to code a priority decision on 80/160/240/etc hits, which are the common multiples between the two forced drops. Does anything notable happen when the fairy counter would roll over from 255?
@@qriist1850 Just for the heck of it, I forced the value to FE and defeated a few enemies. It rolled over to zero - as expected, I guess.
I didn't look at any code for this. Getting the counter to 16 again force-dropped a fairy.
@@DisplacedGamers That makes sense. Thanks for looking into that! ♡
I'd wager at least part of the reason that the fairy counter doesn't reset itself is because it was deemed unneccessary to continue producing fairies if the player is on a massive flawless streak. It makes sense to repeatedly reward the player with money/bombs (which are readily expended by the player) for playing the game well, but little sense to continually reward him with life refills, especially given that he'll likely be picking up additional single hearts during each flawless 16 cycle.
Wish I had your reverse engineering skill!
But now everyone will want to know how to cheat at the money-making game with this!
At 2:00. U for a fairy without getting 16 total kills
Fairies are always possible in groups A and D. Uncommon, but possible. The 16 streak just forces one.
11:18 Send a bug report to Nintendo :P I think it would be funny if they had like a git for this
That bomb drop explanation could make me actually enjoy this game again. I stopped enjoying it last time I replayed the game, entirely due to bombs, when I'd use all my bombs on one screen looking for the secret without a guide, then it'd take me 20+ minutes to get even one bomb drop, and then of course I'd get like 5 bomb drops at once, while I still only had 8 max. The last time I played, I was able to still get all the secrets unlocked before I got around to bothering with any bomb capacity upgrades, because I just wasn't getting enough money to buy up other things like the big shield or blue ring yet. So, eh, maybe still iffy anyway.
This is one of those things where old games, especially due to bad translations, I just started giving up on them even having grew up with Zelda 1 since a child. All that methodology for how bombs drop is just so obtuse, unknown, and what hints you do get were poorly conveyed to the point of useless. I really shouldn't have to hear nearly 40 years later how it all works to be able to continue enjoying the time spent in the game, because it took someone, probably technically illegally, ripping apart the code to reveal the inner workings to make it all clear. I consider Zelda 1 a bad game these days, the way it's packaged and presented to the player without external intervention by fans. There are so many other games, new and old, that I enjoy without such bad design involved.
What the daffy goomba keeps giving this video's a thumbs down? Seriously. Too technical there for you, whoever you are?
wow
man, video games are hard(((
13:06 haha he said pp