J2ME Chuckie Egg
Last update: 1/2/2004
Intro |
Some time ago I got a Motorola V500 mobile phone, and I was intrigued to find it was possible to run user
applications on it. I then decided to port some kind of classic game to the device purely as an experiment.
I decided on Chuckie Egg, which you may remember from computers such as the BBC B and ZX Spectrum in the
mid-eighties. This webpage
documents my results, as well as letting you download the game for free.
Update 2/2/2004 Hmm, despite looking for it before and not finding anything, it appears that Elite are about to release a mobile version of Chuckie Egg commercially - I've disabled my download for now (before I actually announced the webpage to anyone!) as they may not be happy about me distributing an active title of theirs... Update 29/3/2005 Despite apparently having Chuckie Egg 'finished' for the Motorola phones, Elite never actually got around to releasing it as far as I can tell, and didn't want to license my version either. Oh well!
|
Download |
Please note that I'm not a mobile phone expert - far from it! I've only tested this game on my own phone, a
Motorola V500. I expect the game will run on most colour java-enabled phones but it's untested - I'd really
appreciate feedback on this - if the game works or even doesn't work, let me know and I'll note it on this page.
Anything simple, like screen alignment problems, I might even fix! You can also discuss the game on the
message board.
The simplest way to download the game to your phone should be to type this URL into your phone directly (Web Access -> Go To URL), note it's all lower case:
http://chuckie.vcmame.net/chuckieegg.jar - (Currently disabled)
If that doesn't work with your phone you could try the jad file, or download to your PC and upload via
Bluetooth or some other method:
http://chuckie.vcmame.net/chuckieegg.jad - (Currently disabled)
|
Technical Stuff |
Chuckie Egg is programmed in Java, more specifically 'J2ME' (Java 2 Micro Edition) and uses the MIDP 2.0
API (Mobile Information Device Profile). I hadn't programmed in Java for many years when I started this, but
as a professional C++ programmer it was easy to get back into. I started off by installing Motorola's phone emulator, which
lets you try out mobile Java apps on your PC... At least, it was meant to. The version I downloaded had some
bugs which prevented any of the examples from working on the V300/V500/V600 emulator! After some hacking around
I got some demos to run on the emulator, and then had a look on the web for some other examples of mobile code.
Motorola Developers - For emulator, and phone datasheets
With a basic demo working (sprite moving on screen) on the emulator, I then had to make sure it would actually run on the phone, otherwise I would have wasted my time. The Motorola docs suggested the phone should have a 'Java Launcher' which could be used to launch applications via data-cable or Bluetooth. My Orange branded phone didn't have this option - I suspect only official development phones support it. Instead, the only option was 'OTA Delivery' (Over-The-Air). This leads to the bizarre situation that to get code from my PC to my phone (1 metre apart) I need to upload code to my website provider in the USA, then have my phone access that website via GPRS internet access! A round trip of many thousand miles... Note that to deliver Java apps via a website the correct Mime types must be set or else the phone won't accept the data. For Apache servers, you just need to add these lines to a .htaccess file:
AddType text/vnd.sun.j2me.app-descriptor jad After several attempts struggling with the 'jad' file (which desribes the java jar file itself) I finally got the demo running! At that point I didn't realise MIDP2.0 devices could access jar files directly without need for a jad. If you do use jad though, everything has to be setup perfectly or the phone will reject the app. My original idea was to recode Chuckie Egg from the original BBC B assembly code, so as to make the gameplay identical to the original. I got as far as saving out a complete memory dump from the BBC version of the game before deciding this was going a bit far... Hence I decided to go for a more approximate approach - the original graphics and levels are in my version, but the swan & duck movement is not 100% accurate to the original. Oh well. As you might expect with Java, the internals of this app are very object-oriented (quite different to the original) - swan objects, player object, duck object, level object, etc. If anyone is interested I might release the source code on this web page. Very soon into development I realised the cpu power of the V500 was rather low - even with the player and one swan (level tilemap turned off) the game was very slow. I've had to remedy this with simple frameskipping - I do two game logic 'ticks' for every one 'render tick'. With this, the game is a playable speed on the V500 - however I'd be very interested to hear how fast it performs on other phones (Nokias?). There isn't any speed limiting in place, so it could well be too fast on some platforms. Another issue when porting is the screen size - the V500 screen has a pixel resolution of 176 x 220, which is obviously a different aspect ratio from the original game. However, I was in luck... the original BBC game ran in 'BBC mode 5' in which pixels were horizontally doubled - giving an effective resolution of 160x256. This let me use pixel-perfect graphics from the original as long as I put up with some vertical clipping (I had to drop the score bar). Whilst developing I noticed a few differences between the emulator and the real phone - the screen alignment is different for one - while the game was fine under emulation, the bottom 32 or pixels or so were clipped on the real phone - I suspect this may be a real problem for running the games on other phones, as I've simply moved everything up 32 pixels in code. Text alignment to graphics alignment is also different, and calling the 'backlight' API, which works on the emulator, appears to crash the phone! (Or at least the java runtime). |
Legal Stuff / License Of Use |
The original Chuckie Egg is copyright 1983 A & F Software (or does copyright rest with the original author, Nigel Alderton?). I assume it is ok to distribute my version as there are many other ports available freely on the web, plus the original images. However I hold the copyright on this J2ME implementation of Chuckie Egg. You may not redistribute this software without my permission, and it is certainly illegal to sell this software. If you find anyone in violation of this license then please report it to me. Also note there is strictly no warranty associated with this software and you can't hold me responsible if you damage your phone using this software (let's be honest though, it should never be technically possible for a java app running in a sandbox to damage a phone). |