Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (779888), страница 58
Текст из файла (страница 58)
This includes support for playbackof MIDI and compressed audio files such as MP3 files, audio streamplayback (buffer-based), and audio clips playback (file-based).Camera and Video PlaybackThe Camera API supplies interfaces to access the phone’s camera devicesincluding functionality to:• enumerate the available cameras• query the capabilities of each camera to return information aboutthe orientation of the camera, the possible optical and digital zoomvalues, as well as the supported image capture sizes254THE N-GAGE PLATFORM• get and set the configuration of a camera, including the zoom factor,contrast, brightness, flash mode, exposure mode, and white balanceadjustment• use the viewfinder to switch between what the camera sees and whatthe user would see if the device was a mirror.
It is also possible tospecify a clipping rectangle• capture images, and specify the color format and image size of thecaptured image. It is also possible to specify a clipping rectangle.A Video Playback API provides support for playing or pausing a videoclip, and for configuring the playback image (the playback area size,position and orientation, the current and end position, and the playbackvolume).Memory ManagementThis API allows the flexible use of multiple heaps and implementation ofcustom memory allocation algorithms for those heaps, according to thedeveloper’s own memory usage routines.Runtime and Application StateThe Runtime and Application State APIs are provided to create a framework for a game, to load the other APIs, and to handle asynchronousbackground tasks and notifications.The Runtime API loads the libraries providing the APIs describedabove, and is used to instantiate each as it is required.
It also initializesthe 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 of focus loss and focusgained events, and of events occurring when the operating system requeststhe game to shut down.The APIs described above constitute the RGA libraries and are correctat the time of writing. The libraries may be modified slightly beforethey become more widely available, and you should consult referencematerial and example code provided with them, on their general release.8.3.2 N-Gage Platform APIsBesides the APIs discussed, the N-Gage SDK also supplies a numberof APIs specifically for use in N-Gage games.
For example, APIs areavailable for games to store game data, to provide game system servicesfor multiplayer game playing over a Bluetooth connection and for accessto the N-Gage Arena (including APIs to access the Arena Framework andthe Matchmaking and Ranking, Asset Management, and Chat APIs).THE N-GAGE SDK255As an example, the Game System Services API allows games to add theenablers for interaction with the N-Gage application, which is describedin section 8.4. They provide an easy way to display in-game notifications,to perform the start-up check, and to switch to the N-Gage applicationwhile playing the game.
(In-game notifications are messages that aredisplayed during the game. For example, messages could be, ‘‘John isonline’’ or ‘‘Tom says Hello.’’ These messages will be triggered by theN-Gage application.)N-Gage specific APIs such as the Game System Services API are ofuse only to those working with the official N-Gage SDK, and will notbe described further here. Information about the N-Gage Arena can befound in Chapter 5.8.3.3 N-Gage ToolsThe N-Gage SDK provides a number of additional tools, which aredescribed in the following subsections.Game PackagingDigital Rights Management (OMA 2.0 DRM) content protection is used toprevent game piracy.
A flexible packaging tool is provided to create a proprietary format N-Gage install file which contains various game metadata,activation codes and retailer information. A Digital Rights Management(DRM) encryption tool is provided, as is a set of documentation and testdata for use when preparing to package the game. DRM keys, metadatafiles, activation codes, and game-specific file access components are generated for each game, on request, to ensure content protection is uniqueto each game published.Game WizardAnother tool included in the N-Gage SDK is a game wizard whichcan be used to set up the game loop. It provides boilerplate code forinitializing the Runtime, Back Buffer and Input APIs.
The game wizard isimplemented as a plug-in to the Carbide.c++ development environment(Carbide.c++ is recommended as the standard development environmentand is a Nokia product specifically for use in C++ development forS60).MemCheckerThe N-Gage MemChecker runs on the phone and is used to monitormemory usage while a game is running, for example, to facilitate testingthe game under low memory conditions.256THE N-GAGE PLATFORMFeatures include:• detailed output of memory consumption• data on the memory, and maximum memory, used by the game• ability to set limits for the heap size of the game to test under lowmemory• simulation of memory failures• memory leak monitoring.Trace ViewerThe N-Gage Trace Viewer is used to observe the execution of an application at near-to-run-time conditions, having minimum performance impacton the traced application. Features included are:• tracing in the Windows emulator• tracing on the phone, including tracing of release, rather thandebug, builds• transmitting collected trace data to a host, regardless of the currentstate of the traced application (a crash or lockup of the applicationdoes not have any side effects on the tracing process)• multi-process and multi-target tracing.8.4 The N-Gage ApplicationWe mentioned briefly in section 8.2 that the N-Gage application andN-Gage games run on a number of different phones, so the user is notforced to buy a single, specific device in order to play N-Gage games.
TheN-Gage application will be pre-installed onto most N-Gage compatiblephones, but can also be downloaded from www.n-gage.com for ownersof some of the older Nseries phones (e.g., N73).The N-Gage application is the entry point to the N-Gage experience,collecting all the games into one place on the phone, so it is easyto find and play them once they are installed. A key feature of theN-Gage application is the online game showroom, where all the availableN-Gage games can be found and downloaded.
All of the games supportthe ‘try and buy’ method, which means that a player can try the gamein a demo version before deciding to buy it. The opportunity to playbefore purchasing is a big part of the N-Gage experience, and games aredesigned to allow them to demo their main features free of charge.THE N-GAGE APPLICATION257The N-Gage application consists of five modules: Home, Showroom,My Games, My Profile, and My Friends.8.4.1 HomeThe Home module, shown in Figure 8.6, is the entry point into theN-Gage experience. From here, players can quickly start or resume agame, track their progress and see a summary of their game profile,choose friends to chat with, check out new games, and access privatemessages from friends.Figure 8.6 The Home module8.4.2 ShowroomThe Showroom module, shown in Figure 8.7, is the focal point forextending the N-Gage experience.
From here, players can read aboutnew game releases in the Latest Games section.Figure 8.7The Showroom module with media and review sections258THE N-GAGE PLATFORMBefore downloading a game, users can find plenty of informationabout it, including details such as category, number of players, publisher,release data, and age rating.
They can also see game screenshots andvideo trailers, and read the ratings and reviews given by other players.All N-Gage games also offer trial content, so that the users can see whatthe game is about before paying for it. The introductory levels are madeavailable free to give a taste of what playing the game would be like.
Theuser can then buy a license to get access to the entire game. The licenseis purchased from within the game in four steps. The N-Gage platformconnects securely to the retailer backend to complete the transaction andretrieve a valid DRM license from Nokia’s license server. The purchasesteps are as follows:41.License Selection: The N-Gage DRM solution permits users to buya limited or unlimited license for a game. Each license providescomplete access to the game; however the limited licenses will expireafter the timeframe specified at time of purchase. The unlimited ‘full’license has no expiration. This step allows the user to select thelicense type they want to buy.2.Payment Option Selection: N-Gage offers different payment optionsdepending on the content, the license, as well as the buyer’s regionand operator.