Hey folks! Quick note-I originally recorded this as a 3-hour deep dive, but editing the whole thing turned out to be a bit much. So, I'm splitting it into parts to keep things manageable and make it easier to follow. Hope you enjoy!
I really like that you're posting these videos unedited, they show the reality of what is essentially a code review, including the questions and confusion that reviewers often have, and the way one would typically onboard into a new project. A lot of the other videos out there only show the final result once the author has already figured it out, which is interesting too in its own way but gives impression that we just look at code and magically understand it. This is a much more realistic representation of the job, hopefully it can be a good example for people interested in the field who wonder how it is in daily life
This is something I think about often while editing, so it’s great to hear that this approach resonates. A code review is a great way to look at these, thanks for the perspective!
It might be that I'm copypasta'ing comments since it takes time for me to write them out, but here's what I said on this vid: 4:30 I ported the Master Quest level data into the Ocarina of Time Randomizer. Doing so was just a matter of replacing data, as the game already has the logic built-in for everything. Cow switches for example are not just cow actors, but a second invisible actor used for hiding other hidden items. 9:50 Leaf function is correct. It is the leaf node in a graph of function calls. In MIPS assembly, functions are responsible for allocating space on the stack frame for the arguments of the functions it calls, which always includes a minimum space for "4" arguments (in the O32 ABI, arguments are always 32 bit, so 64 bit args will instead take up "2" argument slots). Here it's a bit unusual as the function actually does call another function; I think decomp does it this way because the function does not use the stack frame at all. 28:30 I looked up what CS_STATE_RUN_UNSTOPPABLE did. It's only set in CutsceneCmd_Destination, so it appears the purpose is to lock the cutscene in a "running" state until the Play GameState is destroyed. It doesn't handle chest cutscenes at all. Looking into en_box (chests), most cutscenes are onepointdemos, while the iconic cutscene of Link looking into the chest appears to be hardcoded into the camera logic. You'll have to follow function Camera_Demo3 and const CAM_SET_SLOW_CHEST_CS to figure out more. 43:07 The theory is that "dan" is short for "dangeon", which is a real typo the devs used. Not every dungeon uses this naming scheme though. 51:50 In C, the extern keyword is used to reference code or data defined outside of the current source file. At the lower level, extern creates a symbol name in the compiled object file and is used to locate and replace placeholder addresses into real ones during the linking stage. The rest of the extern informs the compiler how to treat access to that memory address. Lastly, the spec file is what creates the definition for e.g. ydan_sceneSegmentRomStart and ydan_sceneSegmentRomEnd. These symbols never directly appear in any C code. Instead, the spec file is parsed by a custom program written by the zeldaret team. It generates a linker script that creates the definitions for the symbols, and also links all the segments together.
28:30 This sounds like a fun standalone episode. 43:07 Love this little tidbit! 51:50 I did not know this, cheers! It's great to see these comments every time. Thanks mzx!
Digging this video series, as someone who primarily learned Java,C++ and (Self taught C# along the way). It's both interesting, informative and entertaining along the way, and I even dug out my N64 and fired up OOT because why not.. Keep up the good work.
Oh man here we go , the amount of childhood memories that comes back from ocarina of time is insane. When it came out I was every day at after school with a select few of friends who owned it, never ended up owning it myself but the amount of fun I had at age 8 to trial and error things within this game will always have a special place in my heart. Thank you for this video, somehow that feeling comes back to me when watching you figuring out the codebase. It’s like watching you unravelling a mystery that never was intended for anyone to look at outside of Nintendo, great job so far and I hope you continue with this videos !
Thanks for the shared nostalgia :) I used to load my brother's save just to see all the stuff I had yet to find. It was WILD seeing how much OOT had to offer, especially relative to other games at the time.
52:15 Nothing is actually getting called. C Preprocessing is doing text replacement on the source for those macros. And the macros expansion reference other macros so there are layers of expansion. It’s just that the macros look like function calls. It’s a trip and a half trying to keep some of that straight, but it isn’t that far off of writing code that generates code in other “higher level” languages.
Experimenting with music in this series has been interesting. Kokiri forest turned out to be louder than I would have preferred. Keeping this in mind for future videos!
wait at 12:55 if there is only 4 bits to rep the cutscene in OOT then there is only 16 scenes?? That's not enough to cover all the cutscenes in the game, unless it just means the locations?
Very strange-sorry about that! It seems to be a YT issue, I’m not seeing any comments held for review. I’ve gone ahead and hit the 'always approve' button for your comments, so hopefully, that does the trick.
Hey folks! Quick note-I originally recorded this as a 3-hour deep dive, but editing the whole thing turned out to be a bit much. So, I'm splitting it into parts to keep things manageable and make it easier to follow. Hope you enjoy!
I really like that you're posting these videos unedited, they show the reality of what is essentially a code review, including the questions and confusion that reviewers often have, and the way one would typically onboard into a new project. A lot of the other videos out there only show the final result once the author has already figured it out, which is interesting too in its own way but gives impression that we just look at code and magically understand it. This is a much more realistic representation of the job, hopefully it can be a good example for people interested in the field who wonder how it is in daily life
This is something I think about often while editing, so it’s great to hear that this approach resonates. A code review is a great way to look at these, thanks for the perspective!
Maybe stream in a live and after edit post here
I'm really enjoying this series because I have lots of trouble understanding other peoples code, and it helps a lot seeing someone break it down
It might be that I'm copypasta'ing comments since it takes time for me to write them out, but here's what I said on this vid:
4:30 I ported the Master Quest level data into the Ocarina of Time Randomizer. Doing so was just a matter of replacing data, as the game already has the logic built-in for everything. Cow switches for example are not just cow actors, but a second invisible actor used for hiding other hidden items.
9:50 Leaf function is correct. It is the leaf node in a graph of function calls. In MIPS assembly, functions are responsible for allocating space on the stack frame for the arguments of the functions it calls, which always includes a minimum space for "4" arguments (in the O32 ABI, arguments are always 32 bit, so 64 bit args will instead take up "2" argument slots). Here it's a bit unusual as the function actually does call another function; I think decomp does it this way because the function does not use the stack frame at all.
28:30 I looked up what CS_STATE_RUN_UNSTOPPABLE did. It's only set in CutsceneCmd_Destination, so it appears the purpose is to lock the cutscene in a "running" state until the Play GameState is destroyed. It doesn't handle chest cutscenes at all. Looking into en_box (chests), most cutscenes are onepointdemos, while the iconic cutscene of Link looking into the chest appears to be hardcoded into the camera logic. You'll have to follow function Camera_Demo3 and const CAM_SET_SLOW_CHEST_CS to figure out more.
43:07 The theory is that "dan" is short for "dangeon", which is a real typo the devs used. Not every dungeon uses this naming scheme though.
51:50 In C, the extern keyword is used to reference code or data defined outside of the current source file. At the lower level, extern creates a symbol name in the compiled object file and is used to locate and replace placeholder addresses into real ones during the linking stage. The rest of the extern informs the compiler how to treat access to that memory address.
Lastly, the spec file is what creates the definition for e.g. ydan_sceneSegmentRomStart and ydan_sceneSegmentRomEnd. These symbols never directly appear in any C code. Instead, the spec file is parsed by a custom program written by the zeldaret team. It generates a linker script that creates the definitions for the symbols, and also links all the segments together.
28:30 This sounds like a fun standalone episode.
43:07 Love this little tidbit!
51:50 I did not know this, cheers!
It's great to see these comments every time. Thanks mzx!
Incredible series dude! Retro-game code deep-dives might be pretty niche but please keep bringing us more
Digging this video series, as someone who primarily learned Java,C++ and (Self taught C# along the way). It's both interesting, informative and entertaining along the way, and I even dug out my N64 and fired up OOT because why not.. Keep up the good work.
Keep this up! It’s so nice to watch someone work at unwrapping this gigantic game. Great work!
Oh man here we go , the amount of childhood memories that comes back from ocarina of time is insane. When it came out I was every day at after school with a select few of friends who owned it, never ended up owning it myself but the amount of fun I had at age 8 to trial and error things within this game will always have a special place in my heart.
Thank you for this video, somehow that feeling comes back to me when watching you figuring out the codebase.
It’s like watching you unravelling a mystery that never was intended for anyone to look at outside of Nintendo, great job so far and I hope you continue with this videos !
Thanks for the shared nostalgia :) I used to load my brother's save just to see all the stuff I had yet to find. It was WILD seeing how much OOT had to offer, especially relative to other games at the time.
Subscribed friend, thank you for your efforts. I enjoy the thought process of engaging with other people’s code.
Soo happy new video. !!!
Thanks for all the support since you discovered the series :)
52:15 Nothing is actually getting called. C Preprocessing is doing text replacement on the source for those macros. And the macros expansion reference other macros so there are layers of expansion. It’s just that the macros look like function calls. It’s a trip and a half trying to keep some of that straight, but it isn’t that far off of writing code that generates code in other “higher level” languages.
Good catch, 'called' wasn't quite right. Will keep 'expanded' in mind for future episodes. Cheers!
This series is great. Dunno about everyone else but I’d prefer no/quieter background music if there has to be any. Hope you keep this going!
Experimenting with music in this series has been interesting. Kokiri forest turned out to be louder than I would have preferred. Keeping this in mind for future videos!
Someday I’ll create a game as big as ocarina of time
Spelunking time
wait at 12:55 if there is only 4 bits to rep the cutscene in OOT then there is only 16 scenes?? That's not enough to cover all the cutscenes in the game, unless it just means the locations?
You have the right idea. Each location (scene) has cutscenes associated with it, and no location (scene) appears to have over 16 cutscenes
Love stuff like this, just vibes. I’ve also been relearning C getting into audio for Apple devices
What’s the community discord link?
The ZeldaRET team's discord can be found here: zelda.deco.mp/ Cheers!
my comments keep getting hidden
Very strange-sorry about that! It seems to be a YT issue, I’m not seeing any comments held for review. I’ve gone ahead and hit the 'always approve' button for your comments, so hopefully, that does the trick.