Java Reference
In-Depth Information
Chapter 2 gives an excellent example of the use of the TiledLayer
class specifically designed to enable the creation of large scrolling back-
grounds from a relatively small set of images known as tiles. This class
also supports the concept of the animated tile which is very useful for
creating interesting and active game backgrounds quite cheaply.
Finally while not part of the game API, the MIDP 2.0 specification
made support for tone generation mandatory as part of the Media API
which is a subset of MMAPI. This meant that there was always some way
of creating basic sounds in games. When you put all of this together the
MIDP 2.0 Game API is without peer in the mobile space.
For a more detailed example of how to build simple MIDP-based
games using many of the other techniques outlined above, please refer
to [Mason 2008].
8.4 Building an Advanced Java Game on Symbian OS
In Section 8.2.3, we outlined some of the constraints that devices and
operating systems in the feature phone market impose on Java ME. Most
of the limitations you encounter on other platforms do not apply when
building MIDP games on Symbian OS. Within the bounds of available
resources, Symbian OS does not place any limits on JAR size, the number
of sockets you can open, or the number of threads you can have; the local
storage space and the size of the heap can grow and shrink dynamically
as required.
This means that you can do some things in a Symbian OS MIDlet that
you would not even consider on other platforms. For example, you can
load a large number of high-resolution images at once, play advanced
sound formats instead of MIDI sequences, and distribute detailed models
or level data as JAR file resources. That is not to say that you should be
lax with your memory management but it need not be your first concern
(see Section 3.4).
More importantly, as we see in this section, you can adopt a more
abstract framework for your code base which translates directly into a
high degree of re-usability. There is no need to use the extreme Java
ME optimization techniques that are needed on low-end platforms (such
as, avoiding abstract classes and interfaces to keep JAR sizes down; see
Section 9.4.2).
For the rest of this chapter, we work through the main features of a
sample game called FindingHiggs in honor of recent work done (well,
planned anyway, before it shut down for repairs in its first week) at the
Large Hadron Collider in CERN. 7 The aim is to review a first-person-
shooter game that demonstrates the use of various JSRs commonly used
7 'God Particle Discovery Likely', news/scotland/edinburgh
and east/7608342.stm
Search WWH ::

Custom Search