Super Mario Bros engine

Previous topic - Next topic

Darmakwolf

Thought I'd share my interesting Mario game engine with the GLBasic community, source code and all!

With it you will find the beginning of a really lame Mario knockoff called Ultra Marioid! (I intended for it to be an Android game, it works nicely on Kindle Fire HD 7")
What it does:

* full worldmap system with entirely customizable layouts in the same fashion as Super Mario Bros. 3. Levels are automatically linked by level number.
* infinite level size, not bound by a grid. Place objects freely on the screen!
* supports per-level music customization via ini file
* infintiely expandable object arsenal. make a bitmap named obj_(number).bmp and it's usable in-game if it's in the media folder.

Test the demo level by pressing new game. On the world map, you can either click a position to move to or use the arrow keys. Stepping on a level indicator will initiate the level.

Controls:

Arrow keys to move
X to jump

Being optimized for touch screen mechanics, some blocks are "tappable" to break them, so you can simply use the mouse on a PC. When compiling for android, remember that your screen MUST support 1280x800, such as the Kindle Fire HD, unless you rewrite some of the code to alter it. Compiling for Android automatically switches on the NES-style on-screen controls.

Editing a level: Press "EDIT" at the start screen. Use arrow keys <--- and ---> to select a level, enter to pick what one. A yellow "?" will appear if the level has not been made yet - so just press enter to make it!

The arrow keys fly you around the map. Shift + arrow key = fast move. SPACE bar saves the level.

In the editor: press "O" to open the objects list. You can select an object from here, or simply press the + key or the - key on the numpad to "scroll" through objects available. Click to place an object. Snap objects to the left, right, top, or bottom of other objects by selecting them with the mouse and using W,A,S, or D on the keyboard.

Scroll with the scrollwheel on the mouse to change the properties of the next object to place. Mousing over any object and using the / or * keys on the numpad changes the SELECTED object's properties. By default, objects act as solid blocks. They can become moving platforms, breakable by jumping under them, or act as coins. In game, you can break ANY block on PC by holding shift and clicking it. In the editor, delete a block by mousing over it and pressing delete. The shift-click thing is more of a beta-testing feature, it's obviously not for the final product.

Keep in mind Mario will start in the middle of the screen on a newly loaded map, so build accordingly. Pressing T opens a slider to select how many "taps" the next object placed requires in order to explode it in-game. Set this back to zero to disable it.

Remember: this is not a finished product. With some additions it can be made into a fully finishable game, but as it is, it's just a sort of fun little experiment.

Download full project: http://www2.zshare.ma/yrudnqo1weiq

Ian Price

That really looks like an excellent engine you've got there. Cheers Darmakwolf. I hope others can make good use of it.
Nice one :)
I came. I saw. I played.

Schranz0r

Maybe it's a wrong name for this engine :)

I'll give it a try at home.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

fuzzy70

Thanks Darkmawolf, I am definitely going to give that code a good browse as never really looked into platformers from a programming standpoint, played loads of them though  :D

Lee

"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Marmor

da code ! da code ! he give us da code  :good:

yeah thx a lot ! i learning some from everyone !

Darmakwolf

I forgot to mention that in game you can press and hold F1 to display object collision boxes. They flash red when they're hit. F2 is debug-mode flying, hold it to float upward.

spicypixel

Love the engine, especially as I'm in the process of writing my own. I do soooooooo wish the code was indented though. Any GLB Beautifier around???
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

fuzzy70

Quote from: spicypixel on 2013-Mar-20
Love the engine, especially as I'm in the process of writing my own. I do soooooooo wish the code was indented though. Any GLB Beautifier around???

There is this one http://www.glbasic.com/forum/index.php?topic=3243.msg23711#msg23711

Think I tried it many moons ago when I started with GLB but do it as I go along now  :D

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

spicypixel

Quote from: fuzzy70 on 2013-Mar-20
Quote from: spicypixel on 2013-Mar-20
Love the engine, especially as I'm in the process of writing my own. I do soooooooo wish the code was indented though. Any GLB Beautifier around???

There is this one http://www.glbasic.com/forum/index.php?topic=3243.msg23711#msg23711

Think I tried it many moons ago when I started with GLB but do it as I go along now  :D

Lee

Unfortunately not there anymore :-( Anyone have a copy floating around?
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

fuzzy70

Found it on a backup  =D

Lee

"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Moru

I really should get my homepage up again... Glad you had use for it :-)

Darmakwolf

#11
Sorry I have a strange way of writing code... indenting somehow makes my OCD angry, but not blocks of scary looking algorithms :P

I think you will find it is very efficient code though. It skips rendering off screen objects and uses a sprite array for sharing graphics between objects so that minimal memory is used.

CW

This is same really nice work, Darmakwolf. I like your deft sprite manipulations, and you absolutely nailed the feel and physics of Mario's jump. Even without baddies on the field, the challenge of working my way back up to the top through careful jumping (up, out and back) kept me engaged. You have a very nice package there. Well done. I look forward to playing with the editor tomorrow. I know it's a demo, but if you decide to put more work into it, I hope you keep us in mind for another peek.
-CW