Rebuilding Super Mario Bros. piece by piece

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Rebuilding Super Mario Bros. piece by piece

Post by tepples »

My efforts to create the "President" engine got sidetracked so many times that I've lost count. But last night, I had a conversation with ShaneM, famous around here for his massive SMB1/SMB2J bug fix patch, about creating a homebrew platformer engine by rewriting Super Mario Bros. in a Ship of Theseus manner.

One would have to do at least these:
  • Rewrite SMB1 a subroutine at a time, replacing each subroutine with equivalent original code. This is how LAME was bootstrapped from the ISO MP3 encoder over the course of two years (mid-1998 to May 2000). It also gives a chance to optimize the engine's RAM use.
  • Leave NROM behind, allowing data to be split across banks and enemies to be replaced in CHR RAM between scenes.
  • Replace the level designs.
  • Replace the graphics. For the hero you could find all sorts of pixel artists, and the animation could be made more intricate by streaming tiles to UNROM. For the enemies, NovaSquirrel and I would probably be willing to let you use the enemies we designed for DABG.
  • Replace the music and sound effects. At this point, the decision to leave NROM behind would allow use of FamiTone or another homebrew music engine, so long as the replacement subroutines leave enough RAM free for other things.
The result would look and feel like a total conversion of SMB1 but be an original program with original characters that can be used as the basis for a means of making creating a homebrew platformer as easy as ROM hacking. Take the example of Erockbrox, who suggested to ROM-hack Super Mario World into a fan sequel to Kid Icarus.

Practical or no?
User avatar
mikejmoffitt
Posts: 1352
Joined: Sun May 27, 2012 8:43 pm

Re: Rebuilding Super Mario Bros. piece by piece

Post by mikejmoffitt »

This could be a very interesting project. I would be interested in contributing tiles and famitone music.

Let's agree not to name it OpenPlatformer or some other similarly open-source name, though :P
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Rebuilding Super Mario Bros. piece by piece

Post by Myask »

Issues:
1. It'd be better to call it OpenPit anyway. (Especially if you can duplicate Kid Icarus!)
2. Even if you replace all the boards and nails and materials of a Ship of Theseus, you never replace the design. You'll have merely replaced every box in the flowchart with another box; the skeleton of the flowchart remains the same, just with different meat on them. This seems suspect from the perspective of a project aiming to be not-infringing-from-foundation.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Rebuilding Super Mario Bros. piece by piece

Post by tepples »

And to an extent, LAME retained the structure of the ISO MPEG example code. But after stripping out all ISO or Nintendo code, the remaining "skeleton of the flowchart" is a set of processes inherent in psychoacoustic coding or the side-scrolling genre. The idea is that these processes do not rise to the level of eligibility for copyright per 17 USC 102(b):
US Congress wrote:In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work.
And even this can be refactored later to meet a particular project's needs. For example, once we no longer have to remain compatible with the quirks of SMB1's level design, we can fix its collision quirks even more thoroughly.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Rebuilding Super Mario Bros. piece by piece

Post by Sik »

I think the problem is that modifying an existing design would be harder than doing it from scratch, especially something like SMB1 which was made when gameplay mechanics for platformers were still way too green. It'd be better to just make a SMB1-like engine but with current knowledge (and being aware that we can use mappers, which would matter for things like the level format).

Also don't call it OpenPit, jeez:
mikejmoffitt wrote:Let's agree not to name it OpenPlatformer or some other similarly open-source name, though :P
What this post says :|
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Rebuilding Super Mario Bros. piece by piece

Post by tokumaru »

I too don't see the point in using an old engine as the foundation of a new game.

For it to feel like SMB, all you have to clone is the physics, everything else would probably work better if designed with the new specifications in mind.
Pokun
Posts: 1923
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Rebuilding Super Mario Bros. piece by piece

Post by Pokun »

I think it's a fantastic idea to make an open platform engine with SMB physics though.
User avatar
mikejmoffitt
Posts: 1352
Joined: Sun May 27, 2012 8:43 pm

Re: Rebuilding Super Mario Bros. piece by piece

Post by mikejmoffitt »

There are a few key things that make Super Mario Bros. feel like Super Mario Bros, which many mediocre clones like The Great Giana Sisters didn't copy. Fortunately for us, and unfortunately for Time Warp Productions, a copyright lawyer isn't so concerned with these aspects:

-Mario's rise follows the curve of a parabola flipped about the X axis, approaching the maxima.
-A much stronger downwards acceleration follows either at the jump's apex, or at the release of the jump key
-Mario reaches maximum vertical downwards velocity very quickly, as it is quite a low value.
-The initial jump "strength" is influenced by the player's horizontal velocity
-In-air navigation is limited compared to the on-the-ground movement; changing signs in X velocity is nearly impossible at a high speed
-Mario's ground movement is a bit slippery.

These make it really feel like Super Mario Bros 1 and 3. New SMB follows these a bit, though with some more flexibility. Super Mario World give much more in-air control, leading to different acrobatic possibilities and challenges. A 1:1 replacement of the SMB1 engine as outlined in Tepple's original post is very interesting from an implementation perspective, and my interest in the project is mostly for such an academic reason. I think if the intent is just to have an SMB1-like engine, that can be achieved by following these guidelines more or less.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: Rebuilding Super Mario Bros. piece by piece

Post by Drew Sebastino »

The physics in SMB3 compared to 1 don't feel anything alike. I feel handicapped playing the original game.
User avatar
Movax12
Posts: 529
Joined: Sun Jan 02, 2011 11:50 am

Re: Rebuilding Super Mario Bros. piece by piece

Post by Movax12 »

It's time consuming, but simple enough to have someone convert each routine into pseudo code with some description of what the routine does and give that to another person to code. http://en.wikipedia.org/wiki/Clean_room_design

The person writing the code should be someone that has never looked at the disassembly/source.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Rebuilding Super Mario Bros. piece by piece

Post by Sik »

There's a lot to be said about jump physics in games =P I mean, I could take Sol's and mention that:
  • Gravity is always accelerating constantly when falling by default.
  • When jumping and with negative gravity (i.e. going upwards), the acceleration is doubled if the jump button is released. This does not apply when falling, if the jump button is held down or if the ascent wasn't the result of jumping (e.g. landing on a spring wouldn't count).
  • The above applies per frame. So you could release and press it again before going downwards and it still affect gravity acceleration. This does indeed give some fine control over variable jumps.
  • Friction (i.e. horizontal acceleration) is halved while in the air. This applies to both increasing and decreasing speed.
And that's just the jump physics. And yeah, they aren't anywhere close to Mario's, but that doesn't mean worse or better either. (incidentally, the way variable jumps work was done because it was easier to implement, since it doesn't rely on a counter, just on a flag you'd already have for other reasons anyway)
User avatar
mikejmoffitt
Posts: 1352
Joined: Sun May 27, 2012 8:43 pm

Re: Rebuilding Super Mario Bros. piece by piece

Post by mikejmoffitt »

Espozo wrote:The physics in SMB3 compared to 1 don't feel anything alike. I feel handicapped playing the original game.
Then you aren't paying enough attention. SMB3 gives more control in the air especially, but Mario's strange jumps are more or less the same.

Even if the gravity modification is applied per frame, Mario reaches his maximum drop speed so fast it mostly doesn't matter once you've released the button.

Other jump physics aren't worse, they are different, but if you want it to feel like a Mario game then implementing something else isn't going to do it.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Rebuilding Super Mario Bros. piece by piece

Post by Sik »

The problem with Mario physics is that putting aside the fact that they vary between games, they also do some... weird things. E.g. doesn't the running speed in Super Mario World alternate between three different values at its peak? (rather than the two you'd expect from subpixel physics) If I recall correctly which frame you jump on in a TAS matters precisely for this reason.

I think most people will just want good physics anyway, not necessarily those from a very specific game.
User avatar
rainwarrior
Posts: 8062
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Rebuilding Super Mario Bros. piece by piece

Post by rainwarrior »

Creating a game by modifying every piece of another game is one way to learn. Part of what makes creating a game hard for a newcomer is understanding all of the pieces that are necessary to make a game. If you start with something that's already complete and working, it can make up for gaps in your knowledge.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: Rebuilding Super Mario Bros. piece by piece

Post by Bregalad »

Rewrite SMB1 a subroutine at a time, replacing each subroutine with equivalent original code. This is how LAME was bootstrapped from the ISO MP3 encoder over the course of two years (mid-1998 to May 2000). It also gives a chance to optimize the engine's RAM use.
I don't know how cloning every subroutine ones after eachother would not make a copyright infigement. After all you're still copying the game engine and not just only it's functionality. You're copying the very software architecture they used. Especially if they optimised for ROM saving which means functions were very short (so they could be re-used more).
Post Reply