Handling Input from the Screen
Some UIQ smartphones, such as the Sony Ericsson P1i, support touchscreen input, which can be used to add another mode of user interaction to a game. Screen events can be detected and handled in much the same way as keypad input, by overriding CCoeControl HandlePointer-EventL as shown below. In the example given, to capture events that occur in the close vicinity of a particular point on the screen, an area of the screen is constructed, ten pixels square, and centered on the point in question....
Handling Input from the Keypad
Handling user input made by pressing keys on the phone's keypad is quite straightforward in the Symbian OS application framework. The application UI class should call CCoeAppUI AddToStackL when it creates an application view to ensure that keypad input is passed automatically to the current view. The key events can be inspected by overriding CCoeControl OfferKeyEventL . Note that only input from the numerical keypad and multi-way controller is passed into CCoeControl OfferKeyEventL . Input from...
Samuel Sam Cartwright
Samuel graduated from Griffith University, Australia, with a BIT in 2000. Shortly thereafter, he joined an outsourcing firm in Tokyo specializing in development for the telecommunications industry. While there, he worked as a Windows application developer creating low-level protocol encoders and UML tools before a briefly working on a mobile phone MMI man machine interface using the Apoxi framework. In 2005, Sam joined Gameloft K.K., where he is now a senior programmer. As a game programmer,...
Open C
This is Nokia's answer to the same problem addressed by P.I.P.S. - Nokia has taken it further by adding another five standard C libraries on top of the four provided by P.I.P.S. Open C is only available for S60 3rd Edition devices. On UIQ 3, only the four P.I.P.S. libraries effectively a subset of Open C are available. Symbian and Nokia have been working together very closely over the last 18 months to keep both Open C and P.I.P.S. in line with each other. Open C is available as a plug-in to...
DoJa Overview
The easiest way to get started in DoJa development is to download the DoJa2.50e development kit from the NTT DoCoMo website at www.doja-developer.net downloads. Make sure that you grab the development kit user guide, release notes, and API docs while you're there. The installation process is straightforward, and the only thing to note here is that you can and should install the plug-in for Eclipse at least version 2.1.1 via the custom installation option. Figure 10.1 shows the installation in...
Peter Lykke Nielsen
Peter Lykke Nielsen started his career in the interactive entertainment industry back in early 1995, when he was part of the trio setting up and running the independent game developer Scavenger. As well as being part of building the company, he also oversaw a number of titles in development. In the late nineties, after having relocated to England, he joined Activision as a Producer and worked with them on Rome Total War and Rally Fusion Race of Champions plus a number of their Disney and Star...
Challenges of Implementing a Game Server
So what is needed to develop a client-server game As has been hinted above, there are a number of challenges in the mobile space so just using a standard HTTP server or something like that might not work as desired. Here are a few problems that would need to be considered when designing the game server. What protocol is used to talk to the server Some sort of custom protocol running over TCP or UDP gives the most flexibility. If using UDP, then reliability might need to be implemented at a...
Cell ID
From the previous discussion, the most obvious location method is that of the GSM cell ID, as it requires no modifications to either the phone handset or the network infrastructure. While the cell ID has a typical location acquisition time of around three seconds, its accuracy depends upon the size of the cell, which varies depending upon the capacity requirements of a particular geographical area for 3G systems this could range between a cell radius of 100m to 10 km . Whilst there are a...
Saving Game Data
When the game is paused, it should save any important game state in case it is needed to continue the game in the state it was in before pausing. For example, the player may re-boot the phone before the game is next played, but it should still be able to continue the game from the point before it was paused. A player who has got to a particular level in a game will not be happy if their progress is lost because they had to interrupt their session. A game should always save its data at regular...
OpenGL ES
As a concept, OpenGL ES ranks right up there with the greatest of all human achievements and no-I'm not exaggerating. If you've actually been lucky enough to witness just how good hardware accelerated 3D graphics can look on a mobile phone, you'll know what I mean. It not only stands on its own as a mature technology, but it also provides support to other higher level libraries, such as the Mobile 3D Graphics API for Java ME. Symbian has provided a software based implementation of the OpenGL ES...
Bidirectional Text
To support left-to-right writing languages common in Europe as well as right-to-left languages for example, Arabic and Hebrew controls that draw text to the screen can make use of the bi-directional rendering support provided by Symbian OS. When targeting multiple world regions, the use of the DrawText method of CGraphicsContext and derived classes is now strongly discouraged in favor of the following approach. When drawing text in scripts that run from right-to-left, much more text preparation...
Image Conversion Library ICL
Library to link against imageconversion.lib Header to include imageConversion.h Required platform security capabilities None Symbian supports the encoding and decoding of images using the ICL. The library is designed for converting graphics formats into CFbsBitmaps and vice versa. The ICL supports decoding in a separate thread in order to reduce latency of active objects in the client's thread. This may or may not be important to a game. An example of where background thread decoding would be...
Helix DNA Client for Symbian OS
Helix is a cross-platform digital media framework originally developed by RealNetworks and was subsequently released to the public as an open source project. It consists of a media server, a client, a player application, a codec and format framework, and a content generation application, called 'the producer.' This framework can be used to stream and play video and audio data in various formats. Helix has a Symbian OS port of the DNA Client that is used to build player applications compatible...
Reuse of Controls Across UI Platforms
S60, UIQ and MOAP the UI platform for FOMA phones all provide their own UI toolkits which contain standard controls for list boxes, menus, dialog boxes and so on, each tailored to the look and feel of their respective platforms. There is little re-usability across platforms a list box class on S60 is implemented using a completely different control to that used on UIQ. However, when developing a custom control, the basic CCoeControl framework that Symbian OS provides is common across UI...
Drawing APIs and Scalability
Table 3.5 summarizes the drawing methods described in the chapter and how they deal with scalability and orientation. Table 3.5 The scalability of drawing methods on Symbian OS Table 3.5 The scalability of drawing methods on Symbian OS Drawing using a window server graphics context can be made scalable and will work with rotated screen modes. Drawing via WSERV - off-screen bitmap It's possible to create an off-screen bitmap of the same size as the screen, or one of fixed size. However, it's...
Tearing
Tearing occurs when the contents of the screen is refreshed part way through drawing the next frame of animation, which is clearly undesirable. Tearing appears on-screen as a horizontal discontinuity between two frames of an animation, as illustrated in Figure 3.10. The application has drawn frame n-1 and the display hardware is part way through Figure 3.10 Example of two game frames appearing half and half, causing noticeable tearing Figure 3.10 Example of two game frames appearing half and...
Buffering Techniques
Table 3.1 shows the buffering techniques available on Symbian OS. Table 3.1 Buffering schemes and their implementation on Symbian OS Table 3.1 Buffering schemes and their implementation on Symbian OS A single frame buffer of pixel data is used to draw to the screen. Direct screen access DSA , although on systems that require an Update to flush the frame buffer, the results will be double buffered to an extent. This scheme uses an off-screen buffer, also known as a back buffer. Double buffering...
Multimedia Framework MMF
The need to have better audio support in Symbian OS increased with the advancement of audio hardware, the availability of processors that are more powerful and the increased battery life of devices. This led to the development of the multimedia framework MMF , which supports video recording and playback as well as audio. The multimedia framework, shown in Figure 4.1, is an extendable framework allowing phone manufacturers and third parties to add plug-ins to provide support for more audio and...
Key Events
Key events are delivered to the application by the Symbian OS window server WSERV . WSERV uses a typical GUI paradigm which works well for controls such as text editors and list boxes. That is, when a key is held down, it generates an initial key event, followed by a delay and then a number of repeat key events, depending on the keypad repeat rate setting, until it is released. There are three possible key event types. Each key press generates the three event types in sequence 1. EEventKeyDown...
Beatnik MobileBAE
MobileBAE is a commercial cross-platform audio engine developed by Beatnik Inc. www.beatnik.com . It started as a software wavetable synthesis engine for playing MIDI music, but has added support for playing some digital audio formats and other advanced audio features as well. Many licensees licensed the Symbian OS port of this engine and used it in a number of Symbian smartphones to provide the implementation of the audio features. The implementation comes in the form of standard MMF plug-ins...
Audio Tone Player
For certain types of simple games, such as a card game or a Tetris clone, all the game developer wants is to provide some kind of audio feedback to the user. Therefore, realistic sound effects or full-blown audio tracks might not be required for these types of games. Sometimes, the game developer might not have the resources to spend on specialized audio content. In these cases, just creating the simplest of effects using the synthesizer can be the best option. Granted, it does not sound great...
Local Multiplayer Games Over a Bluetooth Connection
Local multiplayer games are those that can be played by more than one player, each using a different phone, communicating by a short link connection. Here we will concentrate on multiplayer games over a Bluetooth connection because this is the most convenient technology for use on a Symbian smartphone. Bluetooth is a technology that allows devices to establish a local-area wireless network. Devices must be within about 10 meters of each other to establish connections. Bluetooth connections...
Runtime and Application State
The Runtime and Application State APIs are provided to create a framework for a game, to load the other APIs, and to handle asynchronous background tasks and notifications. The Runtime API loads the libraries providing the APIs described above, and is used to instantiate each as it is required. It also initializes the system, yields to the operating system to handle background events, and monitors the time elapsed since the game loop started running. The Application State API notifies the game...
Game Architecture
Software architecture is a contentious topic and generally a highly subjective one - after all if you put three computer scientists in a room you'll generally get six opinions on how to get out and one of them will have at least three ways in mind . When you add in the large disparity of skill sets and handsets available in the mobile game industry, you find that well, not everyone agrees. However, given that Java ME broke new ground in MIDP 1.0 days, it's fairly common to adopt design patterns...
Implied Location
Implied location solutions are systems where the mobile phone user can interact with objects or systems that have a known location relative to the mobile network infrastructure. Thus a user's particular location can be implied by his or her interaction with the objects or systems. At the system level, this could be the interaction with WLAN cells or Bluetooth piconets. WLAN cells have a relatively small coverage area, up to 100 meters, and as some mobile phones already include WiFi...
Simulating User Activity
There are occasions when the game may want to simulate activity. For example, while attract mode is playing, it is desirable to prevent the system from dimming the backlight, the screensaver taking over, and eventually the backlight turning off completely. This may seem contradictory, but often games will detect user inactivity, move to attract mode, and then actually simulate user activity while attract mode is running, so the graphics can be seen. User activity is simulated by calling 3 The...
Adobe Creative Suite
The full creative suite contains tools for areas such as video, sound and visual effects as well as web and print design. Many of these have nothing to do with games development, but three applications that do are Fireworks, Photoshop and Illustrator CS3. Photoshop can be used for editing bitmaps and Illustrator can be used for vector graphics. Both tools have functionality that goes far beyond what Flash offers, and are critical for the creation of top grade graphics. Effects such as glow,...
Using Sensors on Symbian OS
Accessing the 3D motion sensors requires the use of the Symbian OS Sensor API which provides access to a wide range of sensors. These sensors can include accelerometers, thermometers, barometers, and humidity monitors. In fact, it can be any type of sensor designed to be incorporated into a mobile phone or be accessible to the phone via Bluetooth technology.13 Sensors need only be supported by the API library to be usable. Currently, the Symbian OS Sensor API is available only from Nokia and...
What Is Symbian What Is Symbian OS
Symbian is a British company, formed in 1998 as a collaboration between Nokia, Ericsson, Motorola and Psion. The company supplies Symbian OS, which is the leading open operating system found in advanced data-enabled mobile phones, known as smartphones. At the time of writing this book, Symbian OS has been used in over 120 different models of smartphone. Symbian does not make smartphones itself, but licenses Symbian OS to the world's major handset manufacturers in alphabetical order, Fujitsu, LG...
Part Two Creating Native Games on Symbian OS v
2 Symbian OS Game Basics 43 2.3 The Heartbeat Timer 46 2.4 Handling Input from the Keypad 49 2.5 Handling Input from the Screen 52 2.7 Memory Management and Disk Space 57 2.8 Maths and Floating Point Support 59 2.9 Tools and Further Reading 60 3 Graphics on Symbian OS 61 3.4 About Display Memory 67 3.5 A Primer on Drawing on Symbian OS 68 3.6 Direct Screen Access 75 3.7 Double Buffering and Anti-Tearing 83 3.8 Pixel Color Representations 90 3.9 Loading and Manipulating Images 97 3.10 Scaling...
Device Information
APIs are provided to obtain information about the phone's capabilities and status information. The Device Capabilities API provides developers access to information from an S60 device that is used to determine if the device is qualified for N-Gage game playing, and to get information on the CPU and whether additional features exist that allow enhanced game functionality, such as floating point support and the amount of RAM available to the game. The Device Status API is a library which provides...
Sound Effects
The most important audio task that a mobile game needs to implement is sound effects. These complement the visual feedback the user gets from the screen by providing real-time audio cues about the action going on in the game. Because of the small screen sizes, having good sound effects is even more important on a mobile device. A good explosion effect will have a bigger emotional impact on the player than a tiny animation on the small screen. One of the major problems with supporting quality...
Using Vibration on Symbian OS
Controlling the vibration motor in phones via Symbian OS was not a supported feature for third-party developers in the early releases of the different Symbian OS-based UI platforms. The APIs were private components, meaning that they were restricted to the licensees of Symbian OS and their partner companies. The reason for this was, most likely, that vibration consumes a lot of battery power, and manufacturers wanted to limit excessive demands on this constrained resource. Advances in hardware...
AbortRestart Sequence
It should be noted that abort or resume callbacks tend to occur in pairs. The sequence of events is typically as follows 1. The game is in the foreground, drawing graphics in a timer-based loop to the whole screen. 2. The operating system detects an event, such as an incoming call, and requests WSERV to display a dialog. 3. WSERV calls AbortNow on DSA clients. 4. The game synchronously stops drawing. 5. WSERV displays the dialog to indicate an incoming call. 6. WSERV calls Restart on DSA...
A Waste of Time
One issue with waiting for synchronization is that the waiting time is potentially wasted. The game cannot do any rendering to the direct bitmap until its thread's active scheduler has processed the request and called RunL . It is not uncommon to ignore the vsync callback and tune the drawing code for the hardware. Another solution is to use triple buffering, so that there is another back buffer to render to, while the screen refreshes. Triple buffering is usually a bit excessive in terms of...
Introduction 1
This chapter describes some of the basic issues to consider when creating a game on Symbian OS v9 in C . We discuss how to write a standard game loop using an active object timer, how to handle user input from the keypad and screen, and discuss how to pause the game when interrupted by a change in application focus. Some of the resource limitations associated with the mobile platform such as memory, disk space and floating point math support are also discussed. A sample game skeleton,...
Online Multiplayer Games
At first glance, online multiplayer games meaning those games where communication from the handset goes over the Internet rather than over a short link technology such as Bluetooth may seem to differ very little 2 An IAP is a concept specific to Symbian OS, associated with IP-based applications. It is a collection of settings that defines how a connection to a particular network is made. An IAP can be thought of as representing a single network interface. from short link gaming. You might...
Grayscale Images as Masks
For grayscale images, the pixel value is a single number that represents the pixel's brightness. The most common pixel format is the byte image, where this number is stored as an 8-bit integer giving a range of possible values from 0 to 255. Typically, zero is taken to be black, and 255 taken to be white values in between make up the different shades of gray. Grayscale images mode EGray2 5 6 are most commonly used as alpha masks for specifying transparency when using functions such as...
User Inactivity
If no user input is received, after a certain length of time, to minimize the phone's power usage, the system will gradually dim the backlight, and eventually turn it off completely. The length of inactivity time before each step occurs is often customizable by the phone's owner, and usually, a screensaver is displayed, such as the time and date, which can also be customized. Regardless of the fact that the phone appears to be in power-saving mode, the game loop will continue running, even when...
Using the Camera on Symbian OS
When writing native C games for Symbian OS platforms, use of the camera requires the UserEnvironment platform security capability. The CCamera API is used, and one of the two available callback interfaces, MCameraObserver or MCameraObserver2, should be implemented. The primary difference between the interfaces is in the way the camera is managed when several applications use it simultaneously. MCameraObserver2 introduces a priority level registered for each application which determines the...
Airplay Online A Multiplayer SDK and Service Solution
Airplay Online can be thought of as solving three problems, each of which we will look at in turn 1. It provides a set of'services' to perform standard operations like downloading assets, managing high scores, tracking the user's identity, and a lobby for setting up multiplayer games. 4 In addition to the extra skills required, writing and maintaining an online multiplayer game has an ongoing cost, in terms of server hardware, hosting, and bandwidth costs. 2. It provides a transport protocol...
NGage Arena
N-Gage Arena is an end-to-end solution for online multiplayer and community services for N-Gage games running on a range of S60 smart-phones. Chapter 8 discusses the N-Gage platform in more detail, but N-Gage Arena is described here because it forms a natural part of the multiplayer gameplay chapter. N-Gage Arena was originally part of Sega.com's SEGA Network Application Package for mobile multiplayer gaming. Nokia acquired Sega.com Inc. a subsidiary of SEGA in early 2003 to enable them to...
What is Airplay SDK
Airplay SDK from Ideaworks3D consists of a comprehensive C C SDK and a set of tools for native mobile game development. The solution comprises two environments a development environment and a deployment environment. Both environments include a set of powerful and extensible tools and technologies within a framework of processes and workflow best practices. This combination of technology and know-how delivers significant cost savings during both development and deployment and enables a faster...
Pp
Figure 6.16 Screenshots of VibraPool Using the vibration feature in S60 is a fairly straightforward task and simply requires the instantiation of an object of class CHWRMVibra using the static factory function CHWRMVibra NewL . It is important to note that the NewL function may leave with KErrNotSupported if the phone does not support the vibration feature, or KErrNoMemory if insufficient memory is available to instantiate the CHWRMVibra object. The vibration is started by calling the function...
Bitmap Drawing Blitting Performance
The availability of different screen modes shown in Table 3.2 means that different depth bitmaps can be combined as they are drawn. There is nothing stopping a game from storing tiles in 256 colors, blitting them to a 4K off-screen bitmap and then copying the bitmap to a 24 bpp display. Having said that, there is an implicit performance penalty when blitting from a source to a destination with a different depth. The penalty may be significant, for example, when porting code which is optimized...
Using Location on Symbian OS
To allow developers to program location-aware applications more easily, Symbian introduced the location-based services LBS API, or location acquisition LA API as it is sometimes called. LBS was initially a Nokia component introduced into S60 2nd Edition, Feature Pack 2, but it later found its way to the core of the Symbian OS platform in Symbian OS v9.1. The API is comprehensive and broad enough to cover both network based positioning and GPS methods, to allow flexibility in applications. In...
Audio Output Streaming and Creating Multichannel Sound Effects
The way to accomplish reduced latency and multi-channel audio support for a complex audio engine is by implementing a software mixer running in a dedicated high-priority thread. Audio streaming APIs are the most suitable APIs for this purpose. Audio streaming APIs interface directly with the hardware through the DevSound interface, bypassing the MMF. Audio data will be processed directly in the applications thread when the audio streaming API or DevSound API see section 4.3.4 is used for...
Playing Video Clips
Full motion video has been a staple of console and PC games for a long time, but is not that common in current mobile games because storage space and network costs have been at a premium. However, some mobile handsets are now being equipped with 8 GB persistent storage for example, the Nokia N95 8 GB or the Nokia N81 8 GB and others are accepting similarly large memory cards. It now becomes feasible to construct games which contain video introductions and cut away sequences 'cut scenes' . The...
DevSound API
DevSound is the lowest level audio API available, but its implementation is hardware-dependent that is, it differs from device to device and is not available on all platforms. Some platforms allow direct access to DevSound through the CMMFDevSound interface. The advantage of using CMMFDevSound to implement an audio engine is that it will allow finer grained control on audio hardware than other classes and allow more control over buffer management. The CMMFDevSound class contains methods to...
D Motion Sensors
The Nintendo Wii has achieved phenomenal sales since its launch, largely by capturing the imagination of players not traditionally considered part of the current game market. From the perspective of both the game developer and game player, the most innovative feature of the Wii is the 'Wiimote.' The Wiimote itself was one of the primary design aspects of the Wii, and, in an interview by Kenji Hall for Business Week in November 2006,10 Shigeru Miyamoto describes part of Nintendo's rationale...











