Learn Blackberry Games Development (eBook)

eBook Download: PDF
2010 | 1st ed.
504 Seiten
Apress (Verlag)
978-1-4302-2719-9 (ISBN)

Lese- und Medienproben

Learn Blackberry Games Development - Carol Hamer, Andrew Davison
Systemvoraussetzungen
44,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

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.
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(TM) 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.

Contents at a Glance 5
Table of Contents 6
About the Authors 9
About the Technical Reviewers 10
Acknowledgments 11
Chapter 1 Gaming on BlackBerry 12
What’s in This Book? 12
Mastering the Basics 13
Exploring Further 14
Why Mobile Games? 14
Why Java Micro Edition? 15
Why BlackBerry? 16
What Makes BlackBerry So Special? 16
The Berry vs. the Apple 17
Summary 17
Chapter 2 BlackBerry Application Basics 18
BlackBerry and MIDP 18
How a BlackBerry Java Application Works 20
Hello MIDP! 20
Hello BlackBerry! 24
Compiling and Building Your Game 30
Using the BlackBerry JDE 30
Creating Resource Files 33
Understanding BlackBerry Application Files 35
Building for Multiple Devices with Ant 36
Installing and Distributing Your Game 45
Local Installation 45
Remote Installation 46
Summary 46
Chapter 3 Game Graphics and Events with MIDP and RIM Classes 48
The Maze Game 48
Drawing with the Graphics Class 48
Using Memory 61
Handling Platform Events with MIDP vs. RIM 64
Getting a Handle on the Drawing Surface 65
Handling User Input Events 73
Using GUI Components 77
Summary 82
Chapter 4 Adding a Professional Look and Feel 83
Simple 3D Image Tricks 84
Simple 3D Drawing Tricks 95
Painting a Custom User Interface 97
Laying Out the Screen with a Manager 98
Painting Custom Widgets 103
Summary 108
Chapter 5 Security and Selling Your Game 109
Understanding BlackBerry Java Security 109
Using Digital Signatures and Certificates 110
Signing with Credentials from RIM 111
Selling Your Game on BlackBerry App World 114
Getting Started with BlackBerry App World 114
Preparing Your Game for Sale on BlackBerry App World 116
Selecting a Billing Model for BlackBerry App World 118
Sending Dynamic Keys to BlackBerry App World 120
Decrypting Dynamic License Keys 124
Selling Your Game on Other Web Portals 136
Selling Your Game on Your Own Site 136
Summary 139
Chapter 6 Swingin’ Light Saber 140
Starting the Application 143
Introducing the Game 143
Moving On to the Game 146
The Game Screen 147
Loading Sounds 149
Starting the Game 150
Processing Shakes 152
Updating the Game 152
Regular Game Updates 153
Painting the Game 155
User Input 157
The Light Saber 159
Responding to User Input 162
Rotating the Saber 164
Drawing the Saber 168
The Saber Trails 169
Game Sprites 170
Coding a Sprite 170
A Sprite’s Bounding Box 172
Updating a Sprite 173
Drawing a Sprite 173
Exploding Sprites 174
Making a Sprite Explode 175
Updating the Sprite 176
Using ExplodingSprite in SwingSaber 176
The Blast Sprite 177
Game Music 179
Loading a Clip 180
Playing a Clip 182
Looping 183
Closing and Stopping 184
Monitoring Players 185
Playing Tones 185
From Note Name to MIDI Note Number 187
Playing Tone Sequences 189
Porting SwingSaber to an Earlier Operating System 190
Summary 191
Chapter 7 Play a Live Opponent with SMS 192
Sending and Receiving SMS Messages 193
Using a MessageConnection 194
Using the Push Registry 203
Finding the Phone Number with PIM 205
Building the Checkers Game 210
Handling the Application Life Cycle 210
Understanding the SMS Checkers Game Logic 220
Painting the Checkers Game Graphics 238
Summary 243
Chapter 8 Using Scalable Vector Graphics 244
Understanding Scalable Vector Graphics 245
Drawing with Bézier Curves 245
Understanding the SVG Format 248
Creating SVG and SVG Tiny Files 251
Creating SVG Animations 260
Adding an Animation to Your Game 263
Creating a Game in SVG 270
Controlling the SVG Animation from the Code 271
Understanding Coordinates and Transformations 277
Summary 281
Chapter 9 Creating Role-Playing Games on the Internet 282
Communicating via HTTP 283
Implementing Communications in a Game 283
Logging In 295
Building the Tweet Space Game Logic 299
Putting It Together 321
Designing the Screen Layout 321
Organizing the Code 329
Summary 332
Chapter 10 Remotely Drive a (Toy) Sports Car 333
A Quick Introduction to USB 336
The Human Interface Device Class 339
A Java USB Library 339
Analyzing the Dream Cheeky Car Protocol 341
Using the LibusbJava Library 345
Moving the Car 347
USB Devices Are Temperamental 348
The USBCar Class 349
A Bluetooth Server 350
Bluetooth 350
JSR 82 351
BlueCove 352
The Base Station 352
Processing the Client 354
Processing Messages 355
Reading a Message 357
Sending a Message 358
The Car Controls 358
Initializing the Car Controls 360
Pairing with Bluetooth Devices 361
Connecting to the Base Station 362
Communicating with the Base Station 363
A Picture Button 363
Implementing Button Presses and Releases 365
The Netbook Version of CarControls 366
Using ServiceFinder 367
Finding a Device, Finding a Service 369
Summary 369
Chapter 11 Fox and Hounds 371
GPS Gaming 371
Playing Fox and Hounds 372
An Overview of the Fox and Hounds Implementation 374
Time for an Example: CurrentTime 376
The Game Organizer Gets Organized 377
ID Creation 377
Making a Map 379
What About BlackBerry Maps? 382
Initializing the Game Server 382
The Server Side 383
Initializing the Server 384
Reinitializing the Servlet 386
Processing a Client Message 386
Saying Hi 387
Processing a ‘‘loc’’ Message 388
Killing a Player 389
Player Information 390
Manipulating Map Coordinates 391
From Mercator to Image Coordinates 392
Longitude Conversion 394
Latitude Conversion 395
The Client Side 396
Playing the Game 398
Saying Hi to the Server 399
Creating an HTTP Connection 401
Downloading the Map 402
Positioning the Map 403
Storing Player Details 405
Rendering the Map and the Players 405
Finishing the Game 406
Managing Player Location Information 407
Killing Another Player 409
The Location Updater Thread 411
GPS and the BlackBerry 413
Using GPS in Fox and Hounds 417
Location Provider Changes 419
Stopping the Location Provider 420
Summary 420
Chapter 12 Introducing 3D with JSR 239 421
A Brief Introduction to OpenGL ES 422
More Information on OpenGL ES 423
OpenGL ES and Java 424
The BoxTrix Example 425
Animating the Scene 427
Initializing the Graphics Engines 429
Initializing the 3D Scene 432
Adding Lights 435
Making the Scenery 436
Using a Back Buffer 437
Drawing the Scene 439
Shutting Down the 3D Graphics 441
The Floor 442
Creating the Floor 443
Drawing the Floor 445
A Textured Cube 447
Creating a Cube 448
Drawing a Cube 451
A Billboard 452
Drawing a Billboard 453
The Overlay 454
The Coordinates of the Overlay 455
Drawing the Overlay 457
The Camera 460
Rotating the Camera 461
Translating the Camera 463
Moving the Camera 464
Using Camera Modes and Direction Constants 464
Creating the Camera 467
Processing Menu Items 467
Updating the Camera 468
Moving the Camera 469
Summary 469
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."

Erscheint lt. Verlag 29.4.2010
Zusatzinfo 504 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Software Entwicklung Mobile- / App-Entwicklung
Informatik Software Entwicklung Spieleprogrammierung
Mathematik / Informatik Informatik Web / Internet
Schlagworte BlackBerry • graphics • Internet • Java • music
ISBN-10 1-4302-2719-2 / 1430227192
ISBN-13 978-1-4302-2719-9 / 9781430227199
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 6,8 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Robust and fast cross-platform application development

von Marco Cantu; Pawel Glowacki

eBook Download (2024)
Packt Publishing Limited (Verlag)
29,99