E-Book, Englisch, 504 Seiten
Hamer / Davison Learn Blackberry Games Development
1. ed
ISBN: 978-1-4302-2719-9
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 504 Seiten
ISBN: 978-1-4302-2719-9
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
BlackBerry smart phones aren't just for business. In fact, throw away that boring spreadsheet, tear up that yearly budget report-the BlackBerry is a lean, mean game-playing machine. Carol Hamer and Andrew Davison, expert software game developers, show you how to leverage the BlackBerry Java™ Development Environment (based on Java ME) to design and create fun, sophisticated game applications from role playing to dueling with light sabers. The BlackBerry: not as clumsy or as random as a blaster-an elegant device, for a more civilized age. In this book, Carol and Andrew give you the professional techniques you need to use music, 2D and 3D graphics, maps, and game design patterns to build peer-to-peer games, role playing games, and more for the BlackBerry.
Carol Hamer received her Ph.D. in number theory from Rutgers, the State University of New Jersey. Since then, she has worked as a software engineer for 10 years in the U.S., France, and Switzerland, including three years working for In-Fusio Mobile Games. Carol has written three books on mobile game programming for Apress: J2ME Games with MIDP2, Creating Mobile Games, and Learn BlackBerry Games Development. She writes a blog called A Little Bitty Java (http://bittyjava.wordpress.com) with programming ideas, troubleshooting tips, and code samples.
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;5
2;Table of Contents;6
3;About the Authors;9
4;About the Technical Reviewers;10
5;Acknowledgments;11
6;Chapter 1 Gaming on BlackBerry;12
6.1;What’s in This Book?;12
6.1.1;Mastering the Basics;13
6.1.2;Exploring Further;14
6.2;Why Mobile Games?;14
6.3;Why Java Micro Edition?;15
6.4;Why BlackBerry?;16
6.4.1;What Makes BlackBerry So Special?;16
6.4.2;The Berry vs. the Apple;17
6.5;Summary;17
7;Chapter 2 BlackBerry Application Basics;18
7.1;BlackBerry and MIDP;18
7.2;How a BlackBerry Java Application Works;20
7.2.1;Hello MIDP!;20
7.2.2;Hello BlackBerry!;24
7.3;Compiling and Building Your Game;30
7.3.1;Using the BlackBerry JDE;30
7.3.2;Creating Resource Files;33
7.3.3;Understanding BlackBerry Application Files;35
7.3.4;Building for Multiple Devices with Ant;36
7.4;Installing and Distributing Your Game;45
7.4.1;Local Installation;45
7.4.2;Remote Installation;46
7.5;Summary;46
8;Chapter 3 Game Graphics and Events with MIDP and RIM Classes;48
8.1;The Maze Game;48
8.1.1;Drawing with the Graphics Class;48
8.1.2;Using Memory;61
8.2;Handling Platform Events with MIDP vs. RIM;64
8.2.1;Getting a Handle on the Drawing Surface;65
8.2.2;Handling User Input Events;73
8.2.3;Using GUI Components;77
8.3;Summary;82
9;Chapter 4 Adding a Professional Look and Feel;83
9.1;Simple 3D Image Tricks;84
9.2;Simple 3D Drawing Tricks;95
9.3;Painting a Custom User Interface;97
9.3.1;Laying Out the Screen with a Manager;98
9.3.2;Painting Custom Widgets;103
9.4;Summary;108
10;Chapter 5 Security and Selling Your Game;109
10.1;Understanding BlackBerry Java Security;109
10.1.1;Using Digital Signatures and Certificates;110
10.1.2;Signing with Credentials from RIM;111
10.2;Selling Your Game on BlackBerry App World;114
10.2.1;Getting Started with BlackBerry App World;114
10.2.2;Preparing Your Game for Sale on BlackBerry App World;116
10.2.3;Selecting a Billing Model for BlackBerry App World;118
10.2.4;Sending Dynamic Keys to BlackBerry App World;120
10.3;Decrypting Dynamic License Keys;124
10.4;Selling Your Game on Other Web Portals;136
10.5;Selling Your Game on Your Own Site;136
10.6;Summary;139
11;Chapter 6 Swingin’ Light Saber;140
11.1;Starting the Application;143
11.2;Introducing the Game;143
11.2.1;Moving On to the Game;146
11.3;The Game Screen;147
11.3.1;Loading Sounds;149
11.3.2;Starting the Game;150
11.3.3;Processing Shakes;152
11.3.4;Updating the Game;152
11.3.5;Regular Game Updates;153
11.3.6;Painting the Game;155
11.3.7;User Input;157
11.4;The Light Saber;159
11.4.1;Responding to User Input;162
11.4.2;Rotating the Saber;164
11.4.3;Drawing the Saber;168
11.5;The Saber Trails;169
11.6;Game Sprites;170
11.6.1;Coding a Sprite;170
11.6.2;A Sprite’s Bounding Box;172
11.6.3;Updating a Sprite;173
11.6.4;Drawing a Sprite;173
11.7;Exploding Sprites;174
11.7.1;Making a Sprite Explode;175
11.7.2;Updating the Sprite;176
11.7.3;Using ExplodingSprite in SwingSaber;176
11.8;The Blast Sprite;177
11.9;Game Music;179
11.9.1;Loading a Clip;180
11.9.2;Playing a Clip;182
11.9.3;Looping;183
11.9.4;Closing and Stopping;184
11.9.5;Monitoring Players;185
11.9.6;Playing Tones;185
11.9.7;From Note Name to MIDI Note Number;187
11.10;Playing Tone Sequences;189
11.11;Porting SwingSaber to an Earlier Operating System;190
11.12;Summary;191
12;Chapter 7 Play a Live Opponent with SMS;192
12.1;Sending and Receiving SMS Messages;193
12.1.1;Using a MessageConnection;194
12.1.2;Using the Push Registry;203
12.2;Finding the Phone Number with PIM;205
12.3;Building the Checkers Game;210
12.3.1;Handling the Application Life Cycle;210
12.3.2;Understanding the SMS Checkers Game Logic;220
12.3.3;Painting the Checkers Game Graphics;238
12.4;Summary;243
13;Chapter 8 Using Scalable Vector Graphics;244
13.1;Understanding Scalable Vector Graphics;245
13.1.1;Drawing with Bézier Curves;245
13.1.2;Understanding the SVG Format;248
13.1.3;Creating SVG and SVG Tiny Files;251
13.1.4;Creating SVG Animations;260
13.2;Adding an Animation to Your Game;263
13.3;Creating a Game in SVG;270
13.3.1;Controlling the SVG Animation from the Code;271
13.3.2;Understanding Coordinates and Transformations;277
13.4;Summary;281
14;Chapter 9 Creating Role-Playing Games on the Internet;282
14.1;Communicating via HTTP;283
14.1.1;Implementing Communications in a Game;283
14.1.2;Logging In;295
14.2;Building the Tweet Space Game Logic;299
14.3;Putting It Together;321
14.3.1;Designing the Screen Layout;321
14.3.2;Organizing the Code;329
14.4;Summary;332
15;Chapter 10 Remotely Drive a (Toy) Sports Car;333
15.1;A Quick Introduction to USB;336
15.1.1;The Human Interface Device Class;339
15.2;A Java USB Library;339
15.3;Analyzing the Dream Cheeky Car Protocol;341
15.4;Using the LibusbJava Library;345
15.4.1;Moving the Car;347
15.5;USB Devices Are Temperamental;348
15.6;The USBCar Class;349
15.7;A Bluetooth Server;350
15.7.1;Bluetooth;350
15.7.2;JSR 82;351
15.7.3;BlueCove;352
15.8;The Base Station;352
15.8.1;Processing the Client;354
15.8.2;Processing Messages;355
15.8.3;Reading a Message;357
15.8.4;Sending a Message;358
15.9;The Car Controls;358
15.9.1;Initializing the Car Controls;360
15.9.2;Pairing with Bluetooth Devices;361
15.9.3;Connecting to the Base Station;362
15.9.4;Communicating with the Base Station;363
15.9.5;A Picture Button;363
15.9.5.1;Implementing Button Presses and Releases;365
15.10;The Netbook Version of CarControls;366
15.10.1;Using ServiceFinder;367
15.10.2;Finding a Device, Finding a Service;369
15.11;Summary;369
16;Chapter 11 Fox and Hounds;371
16.1;GPS Gaming;371
16.2;Playing Fox and Hounds;372
16.3;An Overview of the Fox and Hounds Implementation;374
16.3.1;Time for an Example: CurrentTime;376
16.4;The Game Organizer Gets Organized;377
16.4.1;ID Creation;377
16.4.2;Making a Map;379
16.4.3;What About BlackBerry Maps?;382
16.4.4;Initializing the Game Server;382
16.5;The Server Side;383
16.5.1;Initializing the Server;384
16.5.1.1;Reinitializing the Servlet;386
16.5.2;Processing a Client Message;386
16.5.3;Saying Hi;387
16.5.4;Processing a ‘‘loc’’ Message;388
16.5.5;Killing a Player;389
16.5.6;Player Information;390
16.6;Manipulating Map Coordinates;391
16.6.1;From Mercator to Image Coordinates;392
16.6.2;Longitude Conversion;394
16.6.3;Latitude Conversion;395
16.7;The Client Side;396
16.8;Playing the Game;398
16.8.1;Saying Hi to the Server;399
16.8.2;Creating an HTTP Connection;401
16.8.3;Downloading the Map;402
16.8.4;Positioning the Map;403
16.8.5;Storing Player Details;405
16.8.6;Rendering the Map and the Players;405
16.8.7;Finishing the Game;406
16.9;Managing Player Location Information;407
16.10;Killing Another Player;409
16.11;The Location Updater Thread;411
16.12;GPS and the BlackBerry;413
16.13;Using GPS in Fox and Hounds;417
16.13.1;Location Provider Changes;419
16.13.2;Stopping the Location Provider;420
16.14;Summary;420
17;Chapter 12 Introducing 3D with JSR 239;421
17.1;A Brief Introduction to OpenGL ES;422
17.1.1;More Information on OpenGL ES;423
17.1.2;OpenGL ES and Java;424
17.2;The BoxTrix Example;425
17.2.1;Animating the Scene;427
17.2.2;Initializing the Graphics Engines;429
17.2.3;Initializing the 3D Scene;432
17.2.4;Adding Lights;435
17.2.5;Making the Scenery;436
17.2.6;Using a Back Buffer;437
17.2.7;Drawing the Scene;439
17.2.8;Shutting Down the 3D Graphics;441
17.3;The Floor;442
17.3.1;Creating the Floor;443
17.3.2;Drawing the Floor;445
17.4;A Textured Cube;447
17.4.1;Creating a Cube;448
17.4.2;Drawing a Cube;451
17.5;A Billboard;452
17.5.1;Drawing a Billboard;453
17.6;The Overlay;454
17.6.1;The Coordinates of the Overlay;455
17.6.2;Drawing the Overlay;457
17.7;The Camera;460
17.7.1;Rotating the Camera;461
17.7.2;Translating the Camera;463
17.7.3;Moving the Camera;464
17.8;Using Camera Modes and Direction Constants;464
17.8.1;Creating the Camera;467
17.8.2;Processing Menu Items;467
17.8.3;Updating the Camera;468
17.8.4;Moving the Camera;469
17.9;Summary;469
18;Index;470
"11 Chapter Fox and Hounds (p. 363-364)
As a formerly renowned Professor of Symbological Noetics, it was natural that I be asked to unravel the riddle, ‘‘7,000 Hollywood thanks to he who rests close to the leukodystrophies.’’ Little did I realize that it would lead to me being chased through the streets and vaulted archways of my hometown, Hat Yai. I’d become a wily fox tracked by four tenacious hounds:
- Sir Tetley Teabag: A scholar of BlackBerry lore and tea cozy semiotics. The sound of his aluminum crutches a welcome echo in any reverberant space.
- Silo Malarkey: The tattoo-covered, albino postman, a devotee of the Hopeless Day organization, and severe corporeal mortification.
- Max Caller: The wheelchair-bound director of HERN-IA; his wheeled mobility device containing a Sinclair ZX-81 supercomputer, surface-toair FIM-92 Stingers, and a toaster.
- Beau Jeste: The Gallic savoir-vivre and captain of the Central Region Armored Police. His dark eyes scorched the earth before him, radiating a fiery clarity that forecast his reputation for unblinking severity in all matters.
I’m staggering from street to street, learning the ropes in the trenches, aided by my Fox and Hounds GPS application, but for how much longer? And then suddenly it all became clear.
GPS Gaming
The Global Positioning System (GPS) is a network of US navigational satellites that broadcast signals worldwide containing latitude, longitude, altitude, and time data. Aside from its original role as a navigational aid, it’s at the heart of a growing collection of location-based services. These include such essential mobile applications as finding the nearest coffee shop, gathering shopping discount coupons based on the user’s current location, personalized weather services, and location-based games involving geocaching and hide-and-seek. Geocaching is a modern-day take on treasure hunts, played using handheld GPS receivers.
Unfortunately, the treasures (or caches) aren’t brimming kegs of doubloons and pieces of eight; they’re more likely to be plastic boxes containing notebooks and knickknacks (if you’re lucky). GPS-based hide-and-seek and chase games are growing in popularity, as typified by Fast Foot Challenge (www.fastfoot.mobi). Several runners try to catch the elusive player X within a specified outdoor playing area and time (e.g., a 1-kilometer radius circle in 30 minutes).
There’s also Catch&Run (www.catchandrun.com), based on David Vavra’s thesis, ‘‘GPS game for mobile framework Locify,’’ available at http://edux2.felk.cvut.cz/car/car_bachelors_thesis.pdf. Fox and Hounds is a simple chase game, inspired by the author’s enjoyment of Fast Foot Challenge."




