What is it?

This project is a recreation of the original arcade Mario Bros. and Super Mario Land using SDL.
For this project I had to make a basic 2D engine using SDL. Additionally, per the assignment brief, I had to make the first level of the arcade Mario Bros. with a second level that didn't have to be connected to Mario Bros. For this, I decided to make my Mario Bros. game have one level layout, but several waves of enemies to imitate multiple levels. For my second level, I instead decided to instead implement 1-1 from Super Mario Land. All of this required me to implement text rendering, a basic texture class, classes to manage sound effects, a highscore table with file i/o, a basic level/scene system, a system for enemy waves, aabb and circle collision detection and ai for the enemies (koopas, crabs, goombas, flies and koopas from Mario Land).

Who did what?

During tutorials, we were given some code to learn how to use SDL and we were given some graphics from the original game. Additionally, for some sections, we were given incomplete code for features such as the POW block that we had to finish.
Additional resources used:
Stomp SFX
Marioland Coin SFX
Marioland Jump SFX
Fly death SFX
Koopa explode SFX
Marioland bkg music
Crab SFX
Coin SFX
Jump SFX
Shell SFX
Mario bros bkg music
Crab sprite
Coin sprite
Koopa sprite
Mario sprite
Mario sprite
Luigi sprite: same as mario
Pow block sprite
Mario bros tileset
Intro graphics mario bros
Intro graphics marioland: screenshot from bgb emulator
Marioland sprites and tileset: ripped from Marioland
Marioland level data: ripped from Marioland
Press Start 2P Font
Tool used to create bitmap of font

Everything else in the project was done by myself

When was it worked on?

Work started on the project around January of 2020 and finished at the end of April 2020

What are the controls?

For the Super Mario Land section:
W, A and D to move Mario.

For the Mario Bros. section:
W, A and D to move Mario. Up arrow, left arrow and right arrow to move Luigi.

What went right/wrong during development?

One of the things that I think went well was the waves system for the Mario Bros. section. The system I made allowed for any number of waves, made up of any number of enemies. It also allowed for control of what enemy spawns in, how long after the start of the wave they spawn in, their initial position, the direction and their speed. This allowed me alot of freedom in how I designed each wave. One downside however of this system was that the waves had to be defined in code, instead of being defined in an external file. This meant that if any changes were made to a wave, the program had to be recompiled. As the program wasn't too big, this luckily wasn't too much of a problem.
Another thing that went well was the portability of the code. When I started to write the code for the Super Mario Land section, I was expecting I would have to make major changes to the code. However, I only had to make a few small changes for everything to work.
Another thing I think went well was the accuracy of the Super Mario Land level. Due to the size of the level, I decided that I would attempt to rip the level data from the ROM instead of creating it by hand. To do this, I found an incomplete disassembly online which gave me the memory addresses of each level. I then set an access breakpoint in bgb, and went through the code from there until I roughly understood the format. Next, I wrote a basic program using my pacman game as a base (as this was done in early February, I used this as the Mario project was not far ahead enough) which read the level data from the ROM and displayed it. A few month later, when I was ready to add the Super Mario Land section to my project, I updated the program so that it output the level to a file. I then used that file for the level data for Super Mario Land.

One of the things I think that went poorly was the animation system. The system allowed you to set the start frame and the number of frames in the current animation. It also allowed you to control the time a single frame would take. However, there was no real interface for this. To use the system, you had to directly set the variables. An alternative to this would have been to make an animation class which handles this directly. On creation, each animation could have been defined. This way, changing animation could be simplified to a single function call.
One of the problems I faced during development was adding powerups. I had planned to add them from early on. However, I decided that it would be better to leave them until later, as there were more important features. Due to the time limit, I was never able to get around to implementing them. Additionally, I was unable to add pipe functionality to the Super Mario Land section for the same reason.

Where can I play the game/access the source code?

Both the game and the source code can be found on my github account. Alternatively, you can click here to go straight to the github page.

Screenshots