Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
94 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

The world of mobile gaming has never been as hot as it is today! Through the last couple of years the mobile gaming experience has grown from asynchronous black and white games to real-time colour multiplayer java games. The introduction of colour mass market "gaming" enabled mobile phones has taken mobile gaming a giant step up the gaming food chain.

Hobbyist heaven

The current state of mobile game development resembles much that of the early 80s, where a single developer could lock himself into his bedroom for a month and come out with a fresh best selling classic. Add the simple fact that you can get all the tools you need to make your own mobile game completely free (without having a bad conscience), and you will understand why mobile game development is attracting so much interest from hobby developers and smaller game houses alike.

"So how do I get started?" I hear you ask. Well read on!

Overview

This 2-part article will introduce you to the world of mobile game development through J2ME and MIDP. The first part will give a general introduction to the platform and environment, familiarise you with the MIDP API and help you code, compile and run your first MIDP game.

The second part will take a more detailed look at important elements in MIDP development such as:

  • Device specific APIs
  • Tips and tricks on how to reduce your application size
  • Targeting multiple devices
  • Implementing sound and music
  • The different platforms

    Firstly lets take a look at the main target platforms. The list of platforms is ever growing but can be split into 2 main categories; Java based and C++ based. Within these 2 categories there are several variations with their own characteristics and device base.

    The most widely available/supported platforms are:

    Java based C based (non java)
    MIDP (J2ME) Mophun
    ExEn Brew
    WGE .NET compact framework
    DoJa  

    It is important to consider which platforms have the widest range of device support, and more importantly which devices are most popular among users. In some cases you might want to target a specific region or phone network operator, in this case the choice of target platform might not lie in your hands. As an example, Verizon (one of the largest network operators in the US) are pushing Brew enabled handsets. So far J2ME/MIDP seems to be the most widely available platform, chosen by Nokia, Motorola, Siemens and Samsung to mention a few.

    This article will focus on the J2ME/MIDP platform and the supporting devices. If you wish to read more about the other platforms check out the resource section where you will find links to related information.

    So what is all this J2ME and MIDP business anyways?

    (4 letter acronym warning!)

    J2ME

    J2ME  (Java 2 Micro Edition) is an optimised subset of J2SE (Java 2 Standard Edition) or "normal java". J2ME itself defines a further subset of configurations and profiles that are used to tailor the environment for low-end devices such as PDAs and mobile phones.

    CLDC

    CLDC (Connected Limited Device Configuration) is one of the J2ME configurations which is designed for devices with slow(er) processors and limited memory. Typically devices with a 16 or 32bit CPU and from 128k to 512kb+ memory.

    MIDP

    The MIDP (Mobile Information Device Profile) profile (API) defines elements such as:

    • High level user interface elements
    • Application lifecycle management
    • Local data storage
    • Connectivity

    And most importantly for us:

    • Low level Graphics APIs
    • Input handling
    • Media (Sound)

    The MIDP profile together with the CLDC configuration make up the KVM (Kilo Virtual Machine) which is the runtime that we will be developing for.

    Devices

    To wet your appetite a little here is a list of some of the devices that you will be able to develop for when you become the master of MIDP!

    Nokia Motorola Siemens Samsung
    3510i T720 S55 S100
    3300     A500
    5100      
    6650      
    6100      
    7210      
    7650      
    3650      
    N-Gage      

    For a more detailed list, check out this link!

    Environment / Tools

    Before you get your coding fingers all warmed up lets take a look at the basic MIDP development environment and process.

    J2SE SDK

    As you will be writing and compiling java code you will need the standard J2SE SDK. This includes the basic tools needed to compile your code. So if you haven't already, download and install the J2SE SDK from here.

    The Wireless Toolkit

    As you might have suspected you will be developing for a device that is not a "PC" so you will need something that emulates the target device or platform. Enter the J2ME Wireless Toolkit. The J2ME Wireless toolkit or WTK will be your best friend (and sometimes enemy) in the coming time. The WTK includes these main features:

    • The MIDP API classes and documentation
    • Default set of device emulators
    • Example code and applications
    • Java class pre-verifier (more about this one later)

    The WTK can be downloaded and installed from here.

    Editor of choice

    To write your code you can of course use the editor you are most friendly with. My personal favourite is UltraEdit. There are several Java IDEs that integrate well with the WTK:

    Once everything is installed lets get going on the fun stuff, writing code! (at last!)





    MIDP the API

    Contents
      Introduction
      MIDP the API
      First MIDlet

      Printable version
      Discuss this article

    The Series
      Part 1