A Comprehensive Super Mario Bros. Disassembly
31–40 of 87 posts
Re: A Comprehensive Super Mario Bros. Disassembly
#32Earlier quoted context omitted.
Lookup tables were indeed a common technique used by games in the past.
And present, too, right? It's not the same reason as it would have been in the 80s, but today in performance critical code it is not uncommon to reduce the number of conditionals for better CPU pipelining, and lookup tables are a very common tool for this.
On modern CPUs, data dependency, such as lookup tables often cause pipeline stalls — worse pipelining.
L1 cache is at a premium as well, you rarely want to waste it to access LUTs.
You can compute a lot in 12 cycles caused by L2 hit (L1 miss). In theory up to 32 * 12 = 384 floating point operations.
Re: A Comprehensive Super Mario Bros. Disassembly
#33Re: A Comprehensive Super Mario Bros. Disassembly
#34I've seen Shigeru Miyamoto speak at several game developer conferences over the years. He's absolutely brilliant, a really nice guy, and there's so much to learn by studying his work and listening to him talk. Will Wright calls him the Stephen Spielberg of games.
At one of his earlier talks, he explained that he starts designing games by thinking about how you touch, manipulate and interact with the input device in the real world, instead of thinking about the software and models inside the virtual world of the computer first. The instantaneous response of Mario 64 and how you can run and jump around is a great example of that.
Shigeru Miyamoto GDC 1999 Keynote (Full): https://www.youtube.com/watch?v=LC2Pf5F2acI
At a later talk about how he designed the Wii, he said that he now starts designing games by thinking about what kind of expression he wants it to evoke on the player's faces, and how to make the players themselves entertain the other people in the room who aren't even playing the game themselves. That's why the Wii has so many great party games, like Wii Sports. Then he showed a video of a little girl sitting in her grandfather's lap playing a game -- http://youtu.be/SY3a4dCBQYs?t=12m29s , with a delighted expression on her face. The grandfather was delighted and entertained by watching his granddaughter enjoy the game.
This photo -- https://i.imgur.com/zSbOYbk.jpg -- perfectly illustrates exactly what he means!
Shigeru Miyamoto 2007 GDC Keynote - Part 1: https://www.youtube.com/watch?v=En9OXg7lZoE
Shigeru Miyamoto 2007 GDC Keynote - Part 2: https://www.youtube.com/watch?v=jer1KCPTcdE
Shigeru Miyamoto 2007 GDC Keynote - Part 3: https://www.youtube.com/watch?v=SY3a4dCBQYs
Shigeru Miyamoto 2007 GDC Keynote - Part 4: https://www.youtube.com/watch?v=jqBee2YlDPg
Shigeru Miyamoto 2007 GDC Keynote - Part 5: https://www.youtube.com/watch?v=WI3DB3tYiOw
Shigeru Miyamoto 2007 GDC Keynote - Part 6: https://www.youtube.com/watch?v=XvwYBSkzevw
Shigeru Miyamoto Keynote GDC 07 - Wife-o-meter: https://www.youtube.com/watch?v=6GMybmWHzfU
Re: A Comprehensive Super Mario Bros. Disassembly
#35Re: A Comprehensive Super Mario Bros. Disassembly
#36Earlier quoted context omitted.
I once read that the way SMB was able to pull off the physics engine on such limited hardware was that it used lookup tables for physics instead of actually calculating velocity. My assembly-fu is weak but it looks like your link is to the section that contains all the lookup tables. I think JumpMForceData for example is a series of offsets for each successive frame after you hit the jump button. https://gist.github.…
You can also fine-tune the feel of a jump when you're directly editing a handful of values vs trying to find a function that describes your desired results.
Re: A Comprehensive Super Mario Bros. Disassembly
#37Earlier quoted context omitted.
You can also fine-tune the feel of a jump when you're directly editing a handful of values vs trying to find a function that describes your desired results.
How so? "Trying to find a function" is editing a handful of parameters to a polynomial+exponential model -- the same thing
Re: A Comprehensive Super Mario Bros. Disassembly
#38This seems like a really impressive effort to make sense of all this! Would the original game have been written in assembly? And if so, would the source have looked similar to this? Having never touched assembly language (aside from learning some very basic cracking many years ago swapping JE for JNE in the serial check routine, haha), it seems like a true dark art to me, so I’m really curious to know!
Yes, all old NES games were written in 6502 assembly (named after the NES's 6502 processor), and even most games into the Super Nintendo and Game Boy days were written using assembly language. The source would've looked very similar to this, although I can assume the original labels would've been in Japanese. The difficulty in creating a disassembly like this isn't converting the machine code back into assembly, whic…
Re: A Comprehensive Super Mario Bros. Disassembly
#39Looks like data for the various songs here: https://gist.github.com/1wErt3r/4048722#file-smbdis-asm-L160... I'd love to see the process of extracting actual audio from that.
Re: A Comprehensive Super Mario Bros. Disassembly
#40Here's one of my favorite parts: https://gist.github.com/1wErt3r/4048722#file-smbdis-asm-L942
The byte here is for the BIT instruction, but why is it just a lonely byte? Well, the BIT instruction in this case also includes the two following bytes. When the game processes that instruction, the `ldy #$04` is swallowed up as part of the BIT instruction, effectively skipping over it. IIRC this was a pretty common trick used among 6502 programmers. It allows you to jump ahead over the next (2byte) instruction with just a single byte!