Outline IntroductionTechnologies in our projectPocket PC programming techniquesSnapshot of our projectFuture workConclusionQ&A
IntroductionCurrent Pocket PC game
Two players only Wired connection
In our project, we will implement a complete wireless multiplayer Pocket PC game on Bluetooth
Technologies in our projectBluetooth
Two Bluetooth equipped devices can establish a connection together within 10 meters range of each other.
It utilizes a radio-based link, so does not require a line-of-sight connection in order to communicate.
Technologies in our projectGame API
Handling graphics much more efficiently Useful to write blazing-fast games
Difference between GDI and GAPI
User Code
Display Hardware
Display Driver
Video Memory
Windows GDI
Device ContextDevice Context
Display Hardware
Display Driver
Video Memory
Windows CE GAPI
Device ContextUser Code
Advantages of GAPIBy bypassing Window CE GDI entirely,
Game API allow programmers to directly access to Pocket PC video memory.
It is useful in writing high-performance, real-time games.
It is useful for video playback and other graphics applications.
Limitations of GAPINo support for “BitBlt” or “TransparentI
mage”Need to write a custom BitBlt routine by
the programmer
Pocket PC programming techniquesPocket PC limitations
Computational Power Memory Screen Size
Due to these limitations, there are some problems that are not encountered in desktop PC programming.
Pocket PC Memory ManagementShutting down applications without
notifying user when memory is lowHappens when an application needs
more memory, e.g. instantiate more objects
Pocket PC Memory Management
Threshold Value Description
Hibernation 200 KB WM_HIBERNATE message sent to longest inactive application
Low-memory
128 KB WM_CLOSE message sent to longest inactive application
Critical-memory
24 KB No new applications can be opened.
Pocket PC Memory Management Implement a handler for the
WM_HIBERNATE message Attempt to release as many resources as
possible Avoid being closed unnoticeably
Game APIConventionally, the origin of a window is
at the upper-left corner.Also, the pixel bits in a bitmap are
organized in horizontal rows.However, the video memory retrieved
from GAPI may NOT be organized as stated above, depending on the model.
Game APICASIO Pocket PC series
NormalHP iPAQ series
Origin at lower-left corner Organized in vertical column
Game APISolution 1 - use GXDisplayProperties
*(VidMem +x * GXDisplayProperties.cbxPitch +y * GXDisplayProperties.cbyPitch)
Accessing a pixel needs TWO multiplications, which are quite slow in Pocket PC, especially when bitblting.
Game APISolution 2 - use specific code for
different model Much faster, comparing
*(vidmem + x * cbxPitch + y * cbyPitch) *(vidmem++)
in a for loop Troublesome to develop Many publicly available packages use this
method
ThreadSprites movement and graphics update
are performed one by one in game loop.Problems
The job of sprites movement may be lengthy.
The job of sprites movement would be done in a controlled way.
Frame rate may drop.
ThreadAccording to 1/10-second rule
mentioned by Charles Petzold, the job of sprites movement should be handled separately by another thread.
In our project, the job of each sprite movement and graphics update are handled by separate threads.
Thread PoolThread creation and thread termination
are very time consuming.Both thread creation and termination
occur frequently in a multi-player game using multi-threading.
We need to speed up these processes.
Thread Pool - Basic IdeaCreate enough threads at initial phase
to avoid dynamic allocation of threads in the middle of the game.
Not to terminate unused threads – reuse them when appropriate.
Object PoolSimilar to thread pool, the aim of object
pool is to reduce the overhead of object creation and termination.
The major difference is that object pool has to manage different kinds of objects.
ConclusionDeveloping games on Pocket PC has
its commercial values. It is a challenging task, involving many
latest technologies. It needs some attentions not commonly
noticed in desktop PC programming.