Mobile Phone Game Programming : Getting to Know Mobile Platforms

1/15/2011 3:33:54 PM

Before I get into any specifics regarding mobile game
platforms, it’s important to point out that wireless mobile gaming is
still in its infancy. This is significant because it means that the
tools and technologies change rapidly. It’s very important for you to be
vigilant in keeping up with current trends and technologies, including
what phones wireless providers are carrying and what technologies they
support.

Although the mobile
game landscape is certainly changing fast, the writing is on the wall to
some degree when it comes to dominant platforms. It’s fairly safe to
narrow down the mobile phone platforms suitable for game development to
the following:

Java 2 Micro Edition (J2ME)

Binary Runtime Environment for Wireless (BREW)

Symbian

Windows Mobile Smartphone

Gamer’s Garage

Another
mobile platform that I didn’t mention is SMS, or Short Message Service.
SMS is a technology that allows you to send short little text messages
back and forth between your phone and a game server. SMS is a decent
option for text-based “choose your own adventure” type games and
possibly a chat-based game, but it is cumbersome for much else.
Additionally, you are typically charged for each SMS message, which
means an SMS game can get expensive if there is a lot of back and forth
communication going on.

All four of these
platforms are supported in current phones, and they all include rich
support for developers in the way of free tools and documentation. The
next few sections explore each platform in more detail, and help you to
understand how they differ from one another.

Gamer’s Garage

One
of the most difficult decisions during the planning of this book was
whether to commit to a mobile game platform or not. It was eventually
decided that there was no way to present the basics of mobile game
programming and also cover two or three different platforms. So we chose
the platform with the most industry support and the brightest future,
which is J2ME. Fortunately, a lot of the mobile game programming
techniques you learn throughout the book can be applied to other mobile
platforms.

Java 2 Micro Edition (J2ME)

J2ME is the compact
version of Sun Microsystems’ popular Java programming language. A lot of
people don’t realize that Java originated as a language for use in
programming mobile devices, so it has finally come full circle in the
form of J2ME. J2ME consists of a suite of development tools and a rich
application programming interface (API) for developing mobile phone
applications known as MIDlets (more on the meaning of this term later).

J2ME also includes the K
virtual machine, which is responsible for assisting in the execution of
Java bytecode on each specific phone. By relying on generic bytecode
instead of native application code, J2ME makes it possible to develop a
code base for your games that can be ported to a variety of different
mobile phones with very little effort. In fact, if it wasn’t for
variations in screen size and graphics capabilities, the effort required
to port a game between J2ME phones would be zero.

J2ME enjoys the
broadest industry support in the U.S. among mobile phone manufacturers.
Heavy hitters such as Motorola, Nokia, Research In Motion (RIM), and
Samsung all have J2ME-powered phones on the market.

Binary Runtime Environment for Wireless (BREW)

Unlike
J2ME, which is supported across a wide range of mobile phones, BREW is a
platform specifically targeted at phones based on Qualcomm’s Code
Division Multiple Access (CDMA) technology. This isn’t to say that BREW
doesn’t have a relatively large support base of phones. BREW developers
typically use the C or C++ programming language in combination with the
BREW API to develop mobile games for BREW devices. BREW also supports
other software development technologies such as XML and even Java.

Similar to J2ME, BREW
can run as an intermediary between a game and the underlying phone’s
operating system. Unlike J2ME, BREW also supports native code, which
means a game can be compiled specifically for a certain phone’s
processor. Native code games are usually much faster than their
interpreted counterparts, but they can be trickier to port between
devices.

BREW has caught on and has a
surprisingly large user base in parts of Asia, including Japan and
South Korea. In the U.S., Alltel and Verizon Wireless are currently the
leading wireless providers offering phones that support BREW.

Symbian

Symbian is a
mobile operating system that takes a very different approach than BREW
in that it is an open operating system, available for license by any
device manufacturer. Symbian was developed by Symbian Ltd., which is a
consortium of mobile phone manufacturers including Motorola, Nokia,
Panasonic, and Sony/Ericsson. Symbian is currently supported on a wide
range of mobile phones, thanks to its relative ease in licensing.

There are plenty of
options for developing mobile games for Symbian devices because Symbian
supports the C++, Java, and Visual Basic programming languages. Most
commercial Symbian games to date have been developed in C++ as native
Symbian applications, which makes them a bit faster and more integrated
into the Symbian OS than their Java counterparts. Granted, Java has
begun closing the performance gap between Java programs and native
programs, but a pure native application is almost always more efficient
than a Java program. This can be especially important when it comes to
games, which typically require every ounce of spare processing power.

So why not focus on
Symbian in this book, as opposed to Java? The simple answer is that Java
is ubiquitous, whereas Symbian is still but one mobile operating
system.

Mobile
phones are much different than PCs in terms of having both widely
varying hardware and software. Java is the unifying development
technology that allows you to build a game once, and deploy it on a wide
range of phones with minimal effort.

Windows Mobile Smartphone

You didn’t honestly think
Microsoft would sit on the sidelines and watch mobile gaming take off
without their involvement, did you? Of course not! Microsoft has seen
some success with their Windows Mobile operating system, which is
deployed on handheld computers known as Pocket PCs and advanced mobile
phone devices known as Smartphones. Although some Pocket PCs double as
mobile phones, they are more akin to PDAs than they are mobile phones,
at least in terms of their physical dimensions; Pocket PCs have fairly
large screens (240×320) and rely on a stylus for most user input.

Although Pocket PCs as
devices aren’t really a fair comparison to mobile phones, the Windows
Mobile operating system is a different story. Microsoft was apparently
just biding their time until mobile phone technology caught up to them
because they recently released Smartphone, which is the Windows Mobile
operating system reformulated for mobile phones. What makes the
operating system so interesting is that it isn’t really scaled down from
the Pocket PC version; the only significant differences are user
interface changes to account for smaller screens and the lack of styli
in mobile phones. Otherwise, you get the full-blown Windows Mobile
operating system on a mobile phone with the Smartphone logo.

What this means from a
mobile game development perspective is that you can use the same tools
and APIs that are already being used to build Pocket PC games. This
typically means using C, C++, or Microsoft’s C# programming language in
combination with the Windows Mobile APIs. Pocket PC game development has
been going on for several years now, so in some ways Smartphone has a
significant jumpstart, even though it is relatively new to the
marketplace.

Motorola and Samsung
are both manufacturing Smartphone mobile phones in the U.S., and they
are currently being offered through AT&T Wireless and Verizon
Wireless. With Microsoft’s marketing muscle and industry presence, I
expect to see Smartphone technology grow rapidly in the way of
additional devices and wireless providers in the very near future.