Writing MIDP Games
The Game API that came with MIDP 2.0 made mobile phone game
development a thing of beauty. Although hundreds of games were written,
sold and shipped on MIDP 1.0 devices, ushering in (and indeed creating)
an exciting new industry for mobile games, it was MIDP 2.0 that elevated
art into science.
At the start of this chapter, we investigate some general game concepts
as well as those specific to mobile phones, look at how the MIDP 2.0
Game API makes Java ME an easy choice for mobile game development
and the benefits that Symbian OS brings to the whole picture. We also
throw together a very quick and simple game to demonstrate some Game
API basics. A brief analysis of this first game prepares us for the more
advanced concepts and techniques discussed in Section 8.4.
Section 8.4 focuses on more advanced game development on Symbian
OS using the Java ME optional JSR libraries which are now standard on
Symbian OS as part of MSA support. In this section, we discuss the design,
planning and implementation of a game which aims to demonstrate a
wide variety of techniques you can add to your toolkit. Many of these
are only feasible on Symbian OS as many other mobile platforms have
built-in constraints on MIDlets.
In addition to showing correct use of the core Game API, we also aim
to show how to use the Mobile Media API (JSR-135) for audio effects, see
how the Scalable 2D Vector Graphics API (JSR-226) can be used to build
a compelling menu system, review the use of the Mobile 3D Graphics
API (JSR-184) for the game world and see how we can use the Bluetooth
API (JSR-82) to add multiplayer functionality to our game so that two
players can play it against each other in a head-to-head match.
Throughout the chapter, only the most relevant sections of code are
shown as there is only limited space available and a lot to cover. To
that end, we recommend downloading the source code from the topic's
website before proceeding to get the most out of this chapter. 1