Java Reference
In-Depth Information
4. How are scores and game status displayed?
As you can see in Figure 8.3, the top left corner shows the current
frame rate at all times. The top right shows the opponent's score
during multi-player mode. This is updated via Bluetooth in real
time. The bottom left shows the remaining game time; the bottom
centre shows the number of shots fired; and the bottom right shows
the player's current score.
5. How is the pause-resume cycle handled?
The MIDlet class monitors its own state, keeping itself in sync
with notifications from the AMS at all times. The Controller
class manages the application lifecycle and the GameController
manages the game lifecycle. A separate pause menu is used to allow
the player to quit the current game or change the settings at any time.
6. How is the game world represented?
The game world is 3D space where a series of attacks are launched
along the z-axis towards the player. The Mobile 3D Graphics API
(JSR-184) is used to represent this world.
7. How are frame and simulation rates managed?
The frame rate is capped at 25 FPS by granting up to 40ms for
each frame. This works by tracking the amount of time it takes to
complete the rendering phase of the game loop. If this is found
to be less than 40ms, the thread sleeps for a short period in order to
re-synchronize itself. This approach enables other active threads to
use processor cycles for other useful tasks and allows CPU power
management which can help increase battery life.
Be careful with this - on Symbian OS, the native timer has a res-
olution of 1/64 seconds so what you request may not be what you
actually get. Using a periodic timer in this manner is susceptible to
drift because you actually only receive an event once about every
30ms - so your actual frame rate is slightly less than expected.
The simulation rate runs at a different rate than the frame rate by
tracking the time since the last simulation step and only performing
a new one if a sufficient time period has elapsed.
8. Does the game respond to a change in display size?
In this case, the game is not designed to respond to changes in
screen size.
9. What multimedia effects are employed?
A WAV file is used for the sound effect of the weapon and a set of
MIDI sequences are used to provide background music. At the start
of each music sequence, a vibration event is triggered.
Search WWH ::




Custom Search