PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

'Mario' source code

Dave Johnston · 21 Jun 2003, 09:18 UTC
By request, I've uploaded the very messy source code to my 'Mario' game to:
http://www.omnytex.com/pf/fileexchange/fileexchange.asp

I have to admit I just zipped up the files and am crossing my fingers, hoping it'll all work! 8O

Here is the included readme.txt file:

'Mario' source code
"""""""""""""""""""

*** REQUIRES POCKETFROGPLUS ***

This is the source code to a 'Mario'-style game that I wrote in late 2002. It features platforms, animated sprites, parallax scrolling background and sound to name a few things, along with some basic collision detection. Look in the code hard enough and you'll find it can also handle sloping platforms! (well, just)

The source isn't well documented, and isn't particularly nice either. Those with Half-Life coding experience will notice the inspiration of naming (BaseEntity, BasePlatform etc...) and interfaces/methods. I adopted it for this since, well, I like it :)

Speaking of uhh, 'inspiration' - some code has been directly 'inspired' (read: copied). There are a couple of SetThink SetTouch lines which come straight from Half-Life, and there is also a 'trace' method for spotting intersections which came from some webpage I forgot to note down. Credit to whoever it was...

Other things to note:
- the game is mostly all done floating-point, but still gets half-decent FPS!
- there is some fixed-point code, but it isn't used (as far as I remember) - nor is it very tested
- the mario sprite is (C) Nintendo
- code is messy and largely uncommented
- all other graphics are original
- lots of things may be broken or not work... remember this is an alpha that I abandoned due to lack of time

That is all for now! I hope someone makes some use of this mess of pointers and classes...

- Dave Johnston
- dave at johnsto d0t co d0t uk
- http://www.johnsto.co.uk/pocketpc/
Thanks for releasing the source Dave. Do I have your permission to upload the binary on file-exchange so people can test it out without compiling? It took me about a half-hour to compile, as I've never used PocketFrog or WCE3.0 or anything. Your original readme will be included. The binary I would be uploading is just a straight compile of your source, with only a few minor modifications made to make it compile.

Modifications made:
In game.rc it pointed to image7.bin and image8.bin. Those files didn't exist, so I just guessed as to what they should be.
<<One of them points to the clouds and if it isn't the right bitmap, the whole game is screwed up. The other one points to the sky bitmap, which I cannot find, but does not affect gameplay. (Theres only a pink sky)>>

I get 19-21 FPS on my Axim X5 400.

P.S.- What was with the Phootball thing? :D
Dave Johnston · 21 Jun 2003, 19:51 UTC
Datalore wrote:
Modifications made:
In resource.rc it pointed to image7.bin and image8.bin. I just guessed at another image to link it to, as those files didn't exist.


Hmm, probably aren't used anyway.

Datalore wrote:
P.S.- What was with the Phootball thing? :D


I was originally going to make a very silly football game which basically involved uhh.... fat people running around a football pitch over the course of a day. It would start at breakfast time, the first half would end at lunch time, and the game would finish at dinner time.

It was gonna be called Fat Footbaall... Phat Football... Phootball.... etc.
Dave Johnston · 21 Jun 2003, 20:57 UTC
If you compile it with all optimisations on, you can get around 30-40fps. In debug, it gets around 10-15fps on my Jornada.
I have no idea how to turn on these optimizations you speak of. Here's an unoptimized version that I was able to keep pretty small by cutting out unused images. So far this Mario game looks pretty cool.
It had an identity crisis though, as it looks like it could have been either Phat Soccer, Phat Football, or Sonic the Hedgehog instead.

I fixed the pink screen issue. I don't know if I'm getting 20 FPS because of some Dell Axim issue or because I don't have a clue on how to optimize. Can somebody with an Ipaq/other PDA test this? Just report your FPS. Thanks.

File is at http://www.omnytex.com/pf/fileexchange/fileexchange.asp
Dave Johnston · 21 Jun 2003, 23:17 UTC
Datalore wrote:
I have no idea how to turn on these optimizations you speak of.


Choosing 'Win32 (WCE ARM) Release' enables 'maximum speed' and hence all optimisations. You can see the settings in 'Project | Settings' of eVC++.
Dave Johnston · 21 Jun 2003, 23:18 UTC
Datalore wrote:
It had an identity crisis though, as it looks like it could have been either Phat Soccer, Phat Football, or Sonic the Hedgehog instead.


Yeah, I had quite a few plans for it :) - you'll notice how the whole design is very generalised, so it can cope with quite a number of 2d games needing basic collision detection and linear movement.
I did the release config from the start, so it must be another Axim issue. Or I'm overlooking something, we won't know until other users test it.
I compiled my own copy and managed to get 18-23fps on my Axim @ 300mhz and 16-20fps @ 200mhz. I'm working on my own GapiDraw based platformer engine which can achieve 29-33fps. I'm hoping I can squeeze an extra frame or two out once I've completed my 4th rewrite :D.
Same FPS I'm getting on my Axim. About your platformer, are you working on just the engine right now or do you actually have a game going? I'd be interested to see what kind of game its going to be. Is it more like Sonic or Mario?
I'm working on the game engine for the moment. More specially, I'm working on the level editor, which oddly enough, is handled as a game module in my engine.

I'm probably going to borrow most of my ideas from the old Apogee platformers such as Commander Keen, Duke Nukem and Monster Bash. To be honest, I've never really been into Mario and Sonic, as I've been interested in computers since I was 3 and never felt the urge to own a console :).

Anyway, the rough idea I have is some sort of futuristic zombie game. That idea could change though...
Dave Johnston · 22 Jun 2003, 12:06 UTC
Datalore wrote:
I fixed the pink screen issue. I don't know if I'm getting 20 FPS because of some Dell Axim issue or because I don't have a clue on how to optimize. Can somebody with an Ipaq/other PDA test this? Just report your FPS. Thanks.


I started getting scared when I read this, in case I had accidentally been remembering the wrong FPS counts, so I just ran my most recent binary and at the start of the game got 33-34 fps. Ran your binary, got the same.

So it does look like a device-specific issue at this time. Odd...
I'm a beta tester for Quigley's Quest, which is a similar 2D platformer. IIRC, it also had lowered frame rates on the Axim. I hope Dell releases a patch or something. I'm might go ahead and install the A03 rom patch, maybe that'll make a difference. On the other hand, I've heard horror stories about the A03 patch.
I'm going nuts. First of all, I can't figure out how to redefine the levels. Second, I don't know how to simply put an object on the field. I'm getting this:
Image
Any ideas, Dave?
Dave Johnston · 23 Jun 2003, 06:45 UTC
Datalore wrote:
I'm going nuts. First of all, I can't figure out how to redefine the levels. Second, I don't know how to simply put an object on the field. I'm getting this:
Image
Any ideas, Dave?


Woha, what have you done to the background?!! :)

Lok at 'createLevel1()' in 'game.cpp' to see how the test level was created.

To create a monster... well, I never got round to that - was too busy sorting out physics etc. You'd basically need to clone CPlayerMario and change the update methods such it acts like a monster. You could remove the 'moveInput' method since that is only used for player-controlled entities.

Even better would be to create a general class CBaseMonster which you could then subclass into the various monsters etc.