Author Topic: Super Mario Bros. 3 engine - RFD  (Read 689 times)

Offline Darmakwolf

  • Dr. Type
  • ****
  • Posts: 361
  • Aoooooooo - the werewolves of London!
    • View Profile
Super Mario Bros. 3 engine - RFD
« on: 2021-May-24 »
Hello friends! Today, I am releasing the source code and compiled binary for an engine I am working on programming casually in my free time.

It's called RFDash (Real Furry Dash) - I am making it for some friends. (For some disclosure, I go by Dart Redtail Fox on many other forums, and I have a character named Dart / Dordo that I sometimes put into games, if that makes sense.)

Features:
Full Super Mario Bros. 3 style overworld, level, and progression system
Map editor that can handle monsters, interactive objects, teleport doors and pipes etc
TWO PLAYER experience: take turns when one player dies. One player is also of course possible.
TWIST ON THE ORIGINAL: The player who is NOT playing (watching,) may CONTROL ENEMIES by pressing start and selecting an enemy on screen to spice up multiplayer!
Plays .SPC (Super Nintendo chiptune format) natively! Levels can use authentic 16-bit music directly (thanks to winamp input/output dlls)
Dynamic mobs and maps: no lag due to "too much" in a level - the level is streamlined as you move.
Controller config system - define buttons per-controller! Button preferences are saved and loaded automatically.
Game supports both game controllers and/or keyboard+mouse, even simultaneously.
Tons of cool tiles and objects to choose from! Make maddeningly confusing levels, or simple fun ones!
Two characters exist right now - Dordo (fox) and Yoshi (... yoshi)
The characters aren't going to necessarily be "mario" themed, as this is a game I am making for friends. One simply wanted a yellow Yoshi character playable.
I can't list all of the features here because there just isn't time in the day I don't think.

Includes CLEAN source code with indenting, descriptions, and concise functions! Feel free to use part or all of this to design your own game.


Tips:

When the game begins, it asks you to press a button. You can use a controller button or keyboard button, and walk through the on-screen process to define keys. At the main menu, a different device can be pressed to initiate co-op (2-player.) Once a button preference has been saved, it will be loaded automatically the next time that device is detected.

Anywhere:
Press F1 through F7 to change the game's window size

In the LEVEL editor:

Arrow keys scroll around the map.
hold TAB to bring up a tile list. Click one, and release TAB. You may now paint that tile by clicking and dragging.
SCROLL WHEEL will change the tile blue or red. Blue means "pass through," red means "solid block."
Right click any tile to "copy" it. Then left click to paint with the copied tile. Note: pass-through is copied as well.
"1" and "2" on the keyboard switch between layer 1 and 2. Layer 1 is drawn BEHIND the character. Layer 2 is drawn IN FRONT OF the character.
"3" switches to the monster layer. Scroll wheel selects a preview monster - left click places it. Hold DEL key to delete a monster you're hovering over.
"S" sets the start position to the tile under the cursor. Do not set the "S" directly one block underneath a solid tile - the character will have nowhere to move!
"D" sets a "DOOR" tile. It will then ask you to select a "other end" of the door by clicking another block. The door tile can be entered (either end) by the player pressing "up" in game. Note: it will also ask you to select a new background tile and music file. You may define this, or press cancel to keep it as-is.
"T" sets a "TELEPORT" tile. This is the same as "DOOR" but with no "press up" requirement. Put this inside pipes to create pipe warps. Note that this should be on the BOTTOM RIGHT side of a pipe in order to make the piping effect look right.

Pipes: Pipes will automatically allow the player to enter them by pressing a button toward the pipe while directly at the end of it. (For instance, a pipe to the left of the player requires the player to walk up to it and press left, etc.) Pipes MUST BE ON LAYER 2 in order to be a "enterable pipe." There is no exception. Layer 1 pipes do nothing. The player will move through solid tiles while "piping," and will stop doing so when it has reached "pass-thru" tiles sufficient in size for the player to pop out of.
If you place a plant in the pipe, always place veritcal plants on the left side inside of the pipe. For horizontal plants, it's the top side of the pipe inside. Experiment to get it right!

Pressing ESC in the editor will save and exit right away.
Note that while in the editor, the mouse is locked to the window. This was required to make the scrollwheel work. Press F10 to release it, and F10 to recapture it if need be.

WORLD EDITOR:

While editing a world, place tiles and level blocks anywhere you want, there's no real requirement. Hover over a tile and press L to link a level to it. This will make it require the player to beat it in order to move over it. See the included demo world and levels for an example.

Gameplay:

There is only "run" and "jump" and "pause" in this game, making it simple to start playing. Anyone who has played Mario knows right what to do. The one twist is, the level ends by going down a flagpole, much like Mario 1, though this game aims to mimic mostly mario 3.

You can jump on turtles, grab their shells by holding "run," and throw them to break blocks or kill enemies.
Jump on most enemy's heads to kill them etc.
Water also works, one can swim by hopping in.

One might find Dordo to play a bit more like Mario himself.
Yoshi is much "floaty-er" but can do a hover jump and goes quite far.

DEBUG:
Enter key destroys levels in gameplay overworld. This is in case a level is way too hard and you just want to pulverize it!
Holding tilde key in-level will show debug info. While this is open, pressing "+" on the numpad will cheat and give you some extra health
TAB will open up the HUD until you press it again. The HUD opens automatically when getting a coin or life, though.

I'm sure there's a ton I'm forgetting. Ask me any questions you come up with! I think this is probably the best "mario simulation" I've programmed yet. There are some bugs, but they're mostly minor and being worked on. If you find something please let me know.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4396
    • View Profile
    • FUED
Re: Super Mario Bros. 3 engine - RFD
« Reply #1 on: 2021-May-25 »
Very nice! Just gave a go :)

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 352
  • to program what I have todo how should I program?
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #2 on: 2021-May-25 »
spectacular great work  , thank you :nw:

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 352
  • to program what I have todo how should I program?
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #3 on: 2021-May-25 »
Darmakwolf for information, do not compile with the steam version:

Initializing WinAmp ...
WinAmp INITIALIZED. *** Unhandled exception ***
    EXCEPTION_ACCESS_VIOLATION

Offline Darmakwolf

  • Dr. Type
  • ****
  • Posts: 361
  • Aoooooooo - the werewolves of London!
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #4 on: 2021-May-25 »
Darmakwolf for information, do not compile with the steam version:

Initializing WinAmp ...
WinAmp INITIALIZED. *** Unhandled exception ***
    EXCEPTION_ACCESS_VIOLATION

Yeah I mentioned this to Kitty - I noticed it too. He said he'd need the source to see why. Well now it's available  :D
I am making this in GLBasic IDE Version: 15.238

Maybe there's some syntax difference when it comes to DLL calls in the Steam version?

Offline Darmakwolf

  • Dr. Type
  • ****
  • Posts: 361
  • Aoooooooo - the werewolves of London!
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #5 on: 2021-May-25 »
I'll likely post my updates and latest version(s) on my self-hosted website:

http://dordo.tplinkdns.com/RFDash/

just because it's easier to share with my friends that way. I made it in... Windows 95 + Dream Weaver 3.0.  :O

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #6 on: 2021-May-25 »
This looks cool, quality work as usual Darmakwolf!  :good:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Darmakwolf

  • Dr. Type
  • ****
  • Posts: 361
  • Aoooooooo - the werewolves of London!
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #7 on: 2021-May-26 »
Thank you all! My code style has become a lot more... readable, if you ever looked at what I posted before. I think my time with C# set me straight.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #8 on: 2021-May-31 »
Yes the code is much more modular and structured.

Beware though, GOTO was invented by the devil!  ;)
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 401
    • View Profile
    • my personal website
Re: Super Mario Bros. 3 engine - RFD
« Reply #9 on: 2021-Nov-29 »
Your site is down, but checked demo attached in first post, nice old school gameplay there :]
I went to see source, and wow, more than 100 files, looks that You have separate file for every enemy type, game mechanic and so on, interesting, I prefer to have for example one file for all AI, but whatever suits you, specially that code is nicely structured and formatted, despite using DrawAnim it isn't demanding like many other small indie games (GLB power). Played 3 levels, sun can be annoying, there are some hit box/collision problems in this version (sun hit me even when crouching and he is 2 tiles away), level 3 is crazy but funny :D
Most notable suggestions is give option to change video resolution - even basic 2x/3x scaler or something would be nice, and give option to use WASD keys to move, as arrows aren't always best for this - laptops.
Don't forget to upload newer version and share changes, but what's most important put this game on itch.io ;)
btw. nicely animated fox.
Check my source code editor for GLBasic - link Update: 20.04.2020

Offline Darmakwolf

  • Dr. Type
  • ****
  • Posts: 361
  • Aoooooooo - the werewolves of London!
    • View Profile
Re: Super Mario Bros. 3 engine - RFD
« Reply #10 on: 2021-Nov-29 »
Hi dreamerman!

1. Scaler - use the F-keys! F1 - F8 should scale the display - I might have forgotten to put that in the intro, but the functionality is there.
2. WASD - this game was made for a game controller. You CAN use the keyboard, but it's possible that w/a/s/d could be defined action buttons - that's why it assumes arrows. You can of course easily modify this behavior if you wish, since it's open-source.
3. The many files - this is because of the IncrediBuild feature. Once compiled, I can modify a single file and recompile in 2 seconds instead of 10 minutes every time. GLB caches the files after they're compiled, and recompiling will only actually recompile files you CHANGE. I originally had them all in one, and it was a SLOG to compile that way.
4. hit detection - yes, the sun was not finished. Beta product sort of thing. I intend to make him less frustrating lol.
5. The demo levels were THROWN together in ... probably 15 minutes total. Not much thought went into it, pure tech-demo.

For the website, yeah it's down as I move to a real host instead of in-house. I will definitely update here when there are updates - I'm glad you enjoy it!


Your site is down, but checked demo attached in first post, nice old school gameplay there :]
I went to see source, and wow, more than 100 files, looks that You have separate file for every enemy type, game mechanic and so on, interesting, I prefer to have for example one file for all AI, but whatever suits you, specially that code is nicely structured and formatted, despite using DrawAnim it isn't demanding like many other small indie games (GLB power). Played 3 levels, sun can be annoying, there are some hit box/collision problems in this version (sun hit me even when crouching and he is 2 tiles away), level 3 is crazy but funny :D
Most notable suggestions is give option to change video resolution - even basic 2x/3x scaler or something would be nice, and give option to use WASD keys to move, as arrows aren't always best for this - laptops.
Don't forget to upload newer version and share changes, but what's most important put this game on itch.io ;)
btw. nicely animated fox.