Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Super Mario Bros clone (sort of a proof-of-concept for a platform game 2D tile engine)

Author
Message
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 13th Aug 2004 12:30 Edited at: 30th Aug 2004 08:06
EDIT: *** Last updated on: 8-29-04 ***

Pic (yep, that's Mario):




I've been working on a tile-based 2D game engine. In doing so I am recreating Super Mario Bros. Here is what I have so far, source code and all. I've been working on it during 1 hour intervals that I have free in between conducting my dissertation research. I haven't touched the code in a while but it is starting to get interesting. There is no actual game play yet but a lot of the nuts and bolts are there. There's also no animation as I have been too lazy to work out how to do it well.

Nothing is tweaked yet and everything is still very rough. I included source code because it is fun to look at (and laugh at, in this case) other people's source code.

My goal is to make a nice engine for a game idea I have. I would also like to get this Mario clone working multiplayer via internet (yeah right). In addition, I thought it would be a good idea to post all this stuff in the event that my house in Orlando gets pulverized by Charlie the big-ass hurricane this weekend

I'd also like feedback if it doesn't run at the right speed. I am not sure how it runs on other machines. The only thing I am doing to control speed is set the sync command. Also, my key handling code is weak - I hate that DBpro is not "event-based". As a result, weirdness happens if you try to press more than one key at a time (which I know is dumb beacuse you are always holding down the jump button while moving in Mario games!).

Here are the keys:
Move: left and right arrows.
Jump: Z (hold for more height)
Run: Hold shift
Shoot fireball: Left Control

Debug stuff:
w: Toggle debug view on or off
A/D: inc/dec jump velocity
W/S: inc/dec gravity (Mario only for now)
Up/Down arrows: inc/dec jump floatiness
Grow/Shrink Mario: G (you can break blocks when you are BIG!)
Right mouse button: Toggle tile edit mode on or off
Return: View monster data

Tile edit mode-
Left mouse button: add tile at cursor
Mouse wheel: select tile to draw with
c: hide tile palette
h: help

***************************
Last updated on 8-29-04
Changes since orignial post:
* Improved key-input, MUCH improved collision
* Mushrooms work somewhat
* Added a new demo level, physics tiles, and the ability to run.
* Added a built in tile editor (no save function yet)
* Improved debug display
* Improved object and monster handling

Download it from:
http://home.earthlink.net/~3ddd/mario.zip

Derek


He's evil, but, he'll die. I like it.
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 13th Aug 2004 12:58
Looks and sounds interesting...I am downloading it right now to tell you how it works out

Just some tips (I haven't seen the source code yet):

You are using the keystate() commands, right? Those will allow you to press more than one key at a time with no complications...

If keystate(17)=1 then blahblahblah

To make it run at the same speed on all computers, just keep a variable that is the inverse of the frame rate and multiply all movements by that variable:

speed#=60.0/screen fps()

move object 1,10.0*speed#

That way, you can set the sync to zero for maximum frame rate, but it will still run the same on all computers

I will tell you how it works out.

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href][/href]
Great Knight
21
Years of Service
User Offline
Joined: 25th Feb 2003
Location:
Posted: 13th Aug 2004 13:00
Thats pretty cool. But here is what you have to work on
Collision(It is kinda weird how it works, but looks good so far.)
Have to make the ground not so much like ice I been slideing every where.
Mushrooms fly away from you when you hit the box there in .

Other than those things you did a pretty good job.

Are you a leader or follower.
Hell Dragonz43
19
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 13th Aug 2004 13:03
Very cool looking! Reminds me of those recreations of Mario using GameMaker. Brings back memories

_______________________________________________
My website: http://www.freewebs.com/mycomputergames/
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 13th Aug 2004 13:14
Epo: Thanks! I haven't tweaked anything yet. I plan on having tiles have different friction values and other physics type things. SMB 1 is actually not way different - Mario slides around quite a bit. Big Mario slides less (I guess because he is heavier). One thing I found is that the 2D Mario games are *all about physics*. This is going to be hard to replicate.

Regarding collision - this drives me nuts! I need to really rethink it. Here is my big problem: If Mario is falling at a rate of 5 pixels per cycle and hits the ground, he may end up falling 5 pixels INTO the ground. This goes the same pretty much for all my objects that move at a rate of more than 1 pixel per cycle. Does anyone have a good solution for this?

Mushrooms don't work yet. You can press G to get bigger and break blocks!

Bolt: Thanks for tips! I'll look into those strategies when I rework the input and timing code and get animation working.


He's evil, but, he'll die. I like it.
Great Knight
21
Years of Service
User Offline
Joined: 25th Feb 2003
Location:
Posted: 13th Aug 2004 13:36
You can always do this.
Use the pegs method. Its when you have like blocks sticking out of mario(but are invisible). Say you have one blocks. One that goes through the middle of mario. Say the left side of the peg collides and mario collides. Stop mario from going left. Say if right side same thing. You dont need any for the top or bottom but thats ok, but you might want to keep the peg not the size of mario but just 3 pixals from the top and bottom away from it. For going through the ground I have thought about that too because i am making a scroller engine too, but not in DBP. Make it get the distance like if it is 40 pixals from ground and you fall at 5, but say its like 46 pixals from the ground. You should have a varible that checks the nearest block near your feet if its divisble by 5 and if its a odd number make it 1 pixal at the very end because that would be the remainer. Thats prabily what i would do when I get to that point.

Are you a leader or follower.
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 13th Aug 2004 13:51
That makes sense, Epo. I'll have to play with the math involved, but I think I could do that. I'd really like an elegant solution so I don't have to be concerned about using velocity cut-offs so that sprites don't move too many pixals at a time.


He's evil, but, he'll die. I like it.
walaber
20
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 13th Aug 2004 19:36 Edited at: 13th Aug 2004 19:44
the easiest solution is as follows:

when you calculate your movement, save the NEW position in a variable, but don't move mario yet.

then run collision checks on the new variable. if a collision has been made, find the direction of collision, and then back up one pixel at a time, until no collision is found.

move mario to the new, updated, and safe values.

in pseudo-code:


Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Pricey
21
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 14th Aug 2004 00:57
are those graphics ripped?

very nice job! well done

The dude guy
19
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 14th Aug 2004 01:06
IT SUCKS!!!!!!!!! I can't go anywhere!!!!!!!!!!!

Andrew Tamalunas
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 14th Aug 2004 01:14
Thanks! Yes, I used the graphics from the original. I view this as a learning project and I have no intention to release the program in any large way.
That being said, I used Tile Studio's great little utility for ripping graphics from screen shots of tile based games. Basically, it allows you divide the screen up into rectangles and import the seperate tile images.
Furthermore, you can actually change the level in any way they want by opening the "mariots.tsp" file with Tile Studio
http://tilestudio.sourceforge.net/.


He's evil, but, he'll die. I like it.
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 14th Aug 2004 01:23
The dude guy: I guess there are one of two things going on. Either (1) you did not pick up on the fact that this is still not much more than a game engine in the early stages of development. That is why there is almost no game play yet (besides the fact that some of the enemies have basic AI and behaviour). Or, (2) it is not working on your computer.

I can maybe help with #2, if that is the problem.


He's evil, but, he'll die. I like it.
The dude guy
19
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 14th Aug 2004 02:41
Oh... hehehe... Please accept my appology.

Andrew Tamalunas
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 14th Aug 2004 08:19
Thanks for the help Bolt, Epo, and walaber! I was able improved the keyboard handling routines and also made collision with the ground work a little better. I updated the zip file to reflect these changes. http://home.earthlink.net/~3ddd/mario.zip
Basically, I have been playing around with the code all day as there is not much else to do as we wait for Charley pass over our house (we are like a few miles from the projected center of the hurricane!).


He's evil, but, he'll die. I like it.
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 15th Aug 2004 12:25
Whoa! Did you guys hold out okay?

About the game-it rocks. Some things I noticed:
The mushrooms didn't fall to the ground once they came out of the blocks.

Mario's collision is doing way better, I've only seen him dip a couple pixels below the bridge.

The controls are nearly perfect. The only hitch was you had to hold the G key for the correct amount of time to get him to shift sizes correctly, shouldn't be a big concern though since you won't be controlling his size shifting.

The enemy collision and koopa shell zooming is awesome.

Crazy Donut Productions, Current Project: Project Starbuks
Sony stole our name!
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 16th Aug 2004 02:37 Edited at: 16th Aug 2004 08:57
Thanks. I haven't added any behavior code for the mushrooms yet.
Our neighborhood really got walluped by Charley - the center passed right over us. It was pretty scary. We'll have no power for several days so we went down to the in-laws' place in West Palm Beach. As a result, it looks like I'll have a couple of days with not much else to do but tinker on the Mario game!

Edit: Mushrooms sorta work now!


He's evil, but, he'll die. I like it.
3ddd
20
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 19th Aug 2004 14:13
Just wanted to mention that I posted an updated version. Fixed many issues, added some stuff, etc.
Download it from:
http://home.earthlink.net/~3ddd/mario.zip


He's evil, but, he'll die. I like it.
Lord Aramus
19
Years of Service
User Offline
Joined: 8th Sep 2004
Location:
Posted: 9th Sep 2004 06:06
hehe... old school mario

Excellent test choice

Ack Thpppppt!
High quality models and graphics, low prices. Graphics for the rest of us.

Login to post a reply

Server time is: 2024-05-20 10:26:16
Your offset time is: 2024-05-20 10:26:16