Creating a Blackberry Game – Part 1

Introduction

I’ve used a number of cell phones, and without a doubt RIM’s Blackberry continues to be my favorite by far. Blackberry users will know what I’m talking about – it’s just a fantastic communications device. One of its few shortcomings, though, is its lack of a large game library. Historically, the Blackberry has been targeted at the business market, and its software reflects that. However, more and more of these fantastic cell phones have wound up in the hands of the average consumer, and with good reason. And with that happening, the need for some good, fun games increases. This is where you come in!

The first thing that happens to me whenever I get a new device, after playing around with it of course, is wanting to program it. It’s just the engineer in me popping out. I’ve made a number of Blackberry applications since I first got my 8830, but I wanted to tackle making a game. There are a few resources on the web, but some are targeted at java devices in general, and others are slightly old, so I wanted to put together a good tutorial about creating a Blackberry game for modern devices from start to finish.

This series of tutorials will document creating a simple space fighter game. A completed example of such a game is available on the Synthetic Dreams website, called “Galactic Blast”. The Galactic Blast Demo is a simple example of how easy it is to create a Blackberry game. With the source code documented here, you can go and create your own game, making it as complex as you want. While Galactic Blast is a space fighter, the principle is the same creating any style, from RPG to platform adventure. All development work will be done in Java, and this tutorial assumes you are familiar with this language. Some quick screenshots from the demo:

Getting Started

While strictly speaking it isn’t necessary to own a Blackberry to do Blackberry development, it definitely helps. While the RIM development tools come with a Blackberry emulator that is pretty spot on to the real thing, there are a few areas where the emulator differs (which will be mentioned as we go), and it’s nice to test it out on a real Blackberry. You definitely will need a compiler and IDE. While there are plugins for Visual Studio, they are limited and not as robust as the full Blackberry Java Development Environment provided by RIM. The Blackberry JDE can be obtained for free from RIM here: http://na.blackberry.com/eng/developers/downloads/jde.jsp.

At the time of this entry, JDE 4.3.0 was used. This download will come with the JDE as well as a device simulator, and tools to simulate being connected to a wireless network on the simulator. The IDE is fairly nice as well, with some intellisense type method/property/class tips.

jde1.jpg

Setting up the Project

After starting up the JDE, you’ll want to create a new workspace/project. Name it whatever you’d like. After your project is open, there are a few things you can set immediately. Right click on the project name in the workspace window, and select “Properties”. In the General tab, you can set information such as Title, Version, Vendor, and Description. This will appear when the user downloads your application, as well as the title of the icon on the Blackberry itself.

Right clicking on the project in the workspace window will also allow you to add existing items (such as png/jpegs/midis) to your project or create new ones (java source). For this project, we make use of 6 source files, though only 4 of them contain anything major.

Note – when you’re compiling and running your program, by default it will run on the emulator. When you want to upload it to your Blackberry to test (without going through the hassle of using the Desktop Manager or OTA downloads), the JDE includes a handy utility called the “javaloader” located in the bin directory. There are a number of tasks it can perform, but one of the most useful is simply copying an executable to an actual device. If your device is connected to your computer via USB, use the “-u” option, and then supply the cod file of the program you wish to upload. E.g. “javaloader -u C:\projects\MyProj1\MyProj1.cod”.

Now that you have your project set up, you’re ready to start the actual programming. See you in part 2…

20 Responses to Creating a Blackberry Game – Part 1

  1. Bill S. says:

    Toni, thank you for this detailed example of creating a blackberry game. I just got a Storm and am working on developing a version of a card game I like called “Fives”, and your posts will be a great resource.

    I also loved your Guitar Hero for the C64 post… great hack for classic HW. Many of my fondest childhood memories involve a Commodore Vic20 or C64. 😉

  2. Robert says:

    Great tutorial. One question though: where would I get the graphics files and how would I load them on the Simulator?

  3. Michael Lucas says:

    I was also wondering where I could get the graphics files to finish the tutorial with.

  4. Nick says:

    Thanks for making the tutorial really helped with making my own BlackBerry game.

  5. Mads says:

    This seems great, as I just got a Blackberry Curve, but the link to the JDE appears missing. On the Blackberry site, it gives an error message, saying that the page has been moved or no longer exists. So I really can’t do anything with it, as it doesn’t exist. Anyone know where the page is, if anywhere?

  6. […] I were writing a Blackberry game, I would start with Tony Westbrook’s excellent blog post which Toni Westbrook dot Com

  7. Nice post, the engine quite reminds me of KPL so I can make I nice 3D game with ease! And I have a blackberry

  8. Dale says:

    This helped me a lot. But the link to get the program to do all this doesn’t work really. http://na.blackberry.com/eng/developers/downloads/jde.jsp.

    I can’t find another application anywhere I look to do this. If you could help that would be nice.

  9. Hey! I love your site

  10. Toni says:

    Mads, Dale – you’ve probably long since found it, but all the developer tools can be found here:

    http://na.blackberry.com/eng/developers/

    And thanks for the kudos guys!

  11. Rocks says:

    Great ! Thanks for sharing!

  12. alicealc says:

    Thanks for sharing this, Toni!

  13. Thomas says:

    http://na.blackberry.com/eng/developers/javaappdev/javadevenv.jsp

    if you cant find it just google out “BlackBerry JDE”

  14. […] lo esencial para divertirte por horas disparando a las naves enemigas, desde tu teléfono.Visto en TonyWestbrook  Descarga gratis/Synthetic dreams google_ad_client = "pub-5441882084840746"; /* […]

  15. […] Download OTA: Galactic Blast Developer: Creation Tutorial […]

  16. […] to get Galactic Blast completed. You might recognize the title from the demo game featured in our tutorial on creating a Blackberry game. The commercial release of Galactic Blast is built off a very similar framework to what’s […]

  17. Mubarak says:

    Hi,

    Great game, however, i cannot scroll the ship horizontally because I’m using a BB 7130E
    which has a side scroller.

    All the same good work.

  18. jaw says:

    nice tutorial very detailed a very helpful especially for a begginer like me on developing a game. I’m planning to develop a game somehow a word puzzel game I hope i can get more help from u. Keep it up.!!

  19. gr8 tutorial man! … worth reading 🙂

  20. Awesome job on this post.

Leave a Reply

Your email address will not be published.