Beginning Mobile Phone Game Programming

Beginning Mobile Phone Game Programming

by Michael Morrison
     
 

View All Available Formats & Editions

Build several fully functional games as well as a game engine to use for programming cell phone and mobile games with Beginning Mobile Phone Game Programming! The included CD provides the tool, code and graphics necessary to complete all exercises covered in the chapters. Beginning Cell Phone Game Programming demystifies wireless game programming by

See more details below

Overview

Build several fully functional games as well as a game engine to use for programming cell phone and mobile games with Beginning Mobile Phone Game Programming! The included CD provides the tool, code and graphics necessary to complete all exercises covered in the chapters. Beginning Cell Phone Game Programming demystifies wireless game programming by providing clear, practical lessons using the J2ME Game API. You will learn how to use the most popular mobile programming language, Java, to build compact games that can run on any Java-enabled device, including mobile phones, pagers and handheld computers. You will also learn to add a splash screen, create a demo mode, keep track of high scores, and test, debug, and deploy your games.

Topics covered include:

  • How to construct a game engine to drive mobile games.
  • How to use Java 2 Micro Edition (J2ME) and the Java Game API to get the most performance out of your mobile games.
  • How to implement sprite animation and control interactions among moving sprites.
  • How to play sound effects and music in mobile games.
  • How to take advantage of wireless networks to build mobile multiplayer games.
  • How to design and develop a variety of different games spanning several video games genres.

Read More

Product Details

ISBN-13:
9780132714921
Publisher:
Pearson Education
Publication date:
11/22/2004
Sold by:
Barnes & Noble
Format:
NOOK Book
Pages:
528
File size:
11 MB
Note:
This product may take a few minutes to download.

Read an Excerpt

IntroductionIntroduction

So I'm sitting in the dentist's chair waiting for the Novocain to set in and allow me to numbly enjoy my root canal when it occurs to me that I could be spending my time so much better than this. Although the confines of a dentist's chair and the goofy drool bib certainly limit my activities to some degree, they don't stop me from playing a wireless, online, multiplayer adventure game with a few hundred of my closest friends and enemies. Quickly I slip my Java-powered mobile phone out of my pocket and fire up a quick game so that I can momentarily divert my uneasy mind from the inevitable onslaught of medieval dental tools. And this, my friends, is what mobile gaming is all about!

I know, you've been hearing talk about the "wireless revolution" for several years now, and you've chalked it up to techno hype. I don't blame you. Up until recently I was skeptical myself of what could realistically be done on a device that I frequently pick up off the ground and pray that it still works. Let's face it: Mobile phones are not what most of us think of when we contemplate the future of digital interactive entertainment. But we can't afford to maintain this attitude much longer. The reality is that mobile phones have arrived as game machines, and if you're reading this book you are obviously interested in "getting in the game."

Although it's perfectly legitimate to group together mobile phones with other kinds of handheld entertainment devices such as Palm Pilots, Pocket PCs, and Game Boys (to name a few) this book takes a narrower look at mobile game programming by focusingsolely on games as they apply to mobile phones. It's not that I'm against any of the other devices, but none of those devices have anywhere near the same reach as mobile phones in terms of users. Think of five of the least technical people you know, and count how many own a mobile phone. If the answer is less than four or five, just give them a couple of years. Whether or not my informal poll convinces you, mobile phones represent the broadest installation of computers the world has ever seen, and it's growing at a staggering rate.

So you have all these people toting personal communicators (mobile phones), and primarily using them to talk to each other. And then technologies arrive that make it possible to extend those communicators beyond simple voice communications. Technologies such as Java empower mobile phones with roughly the same capabilities as desktop computers. Couple this with the wireless networking support common to all mobile phones and you have quite a unique device on your hands: rugged, compact, portable, networked, programmable...a game programmer's dream.

I'd be lying if I said that mobile game programming wasn't still in its infancy. The technologies are new and the phones that support them are even newer. But as you may know about technology, the only way to keep up with it is to stay as far ahead of the curve as possible. By learning how to design and build mobile games as the industry unfolds, you'll be better prepared to take advantage of opportunities as they arise. Whether it's a mobile game just to share with family and friends, or a full-blown commercial endeavor to fund your early retirement and cement your place in the mobile game hall of fame, this book will provide you with everything you need to get started with game programming for mobile phones. Check out Figure 1 for an example of one of the games you design and build in this book.

Figure 1
The Henway game is somewhat of a take-off on the classic Frogger arcade game.

The Henway game shown in Figure 1 is loosely based on the classic Frogger arcade game. If getting a chicken across the road isn't to your liking, then maybe the High Seas game in Figure 2 will get your attention.

Figure 2
The High Seas game takes advantage of a scrolling background and "intelligent" computer enemies.

The High Seas game is a pirate game where you cruise around a nautical map rescuing lost pirates while avoiding roaming squids, floating mines, and a large enemy pirate ship. These are just two of the five complete mobile games you build throughout the book. I'll let the others remain a surprise!

Java is the programming language of choice used throughout this book to develop mobile games, and there is a good reason for it. I go into more details on this choice in Chapter 1, "Games on the Go," but the quick reason is simply that Java is the dominant game development technology for mobile phones now and into the foreseeable future. A bonus Java tutorial, "Java Programming Primer," is included on the CD-ROM, just in case you aren't a Java whiz. Regardless of your views on Java as you go into this book, I think you'll agree by the end that Java is an ideal technology for mobile game development.

People often ask me what kind of phone I use to tinker with mobile game programming, and I always tell them the huge one sitting on my desk. I'm talking about my desktop PC, which I use the vast majority of the time during mobile game development as a mobile phone emulator. There are so many phones on the market and new models are released so frequently, it would be impossible for me to endorse a particular phone without outdating this book instantly. So I recommend using the Java emulator built into the J2ME Wireless Toolkit, which is included on the accompanying CD-ROM. Of course, you'll certainly want to test your games on a real phone throughout the development process, but you'd be surprised how handy an emulator can be.

Like game programming for desktop computers and console systems, mobile game programming isn't easy. You'll be called upon to master and combine a wide range of software development skills, not to mention a good dose of creative and artistic sensibilities. This unique blend of art and technical skill is likely what makes game programming so alluring. Add the sizzle of doing all of this on a tiny device with a wireless network connection, and you have the recipe for some serious techie fun.How This Book Is Structured

This book is organized into five parts, each of which tackles a different facet of game programming:

  • Part I, "Getting Started with Mobile Game Programming"—In this part, you learn the basics of mobile game development and what goes into creating a mobile game with Java and the J2ME Wireless Toolkit. You construct a mobile game skeleton that serves as a template for future games throughout the book, and test the game with a Java mobile phone emulator.

  • Part II, "Mobile Game Programming Essentials"—In this part, you learn how to draw graphics for mobile games, including images. You also learn the ropes of sprite animation, which is the cornerstone of two-dimensional game programming. You also develop a couple of complete games, including Henway and Cat Catcher. There's admittedly a bit of an animal theme going on here, but don't worry; you get into pirates and aliens later in the book.

  • Part III, "Virtual Worlds and Mobile Game Intelligence"—In this part, you learn about game layers and how they are used to construct games as overlapping visual pieces. You also explore the fundamentals of artificial intelligence (AI), and why it is important to games. AI can be a daunting topic, so I focus on some basic AI techniques that are easy to understand and apply in your own games. This part of the book also includes the development of another complete game, High Seas, which is a pirate game where you sail around a large sea map battling other pirates and sea monsters.

  • Part IV, "Taking Advantage of the Wireless Network"—In this part, you find out how to make the most of the killer feature of mobile phones: the wireless network. After learning the basics of network programming for mobile games, you develop a game called NetConnect4, which is a mobile networked version of the classic Connect4 game. You then design and build a networked action game called Mad Plumber, where you race against another player to lay plumbing pipes.

  • Part V, "Sprucing Up Your Games"—In this part, you explore some interesting game programming techniques that enable you to get the most performance out of your mobile games. You also learn how to create and manage a high score list that is stored on the phone. This part of the book guides you through the design and development of another complete game, Space Out, which is a space shoot-em-up that incorporates much of what you've learned throughout the book.

What You'll Need

This book assumes that you have a knowledge and understanding of the Java programming language. I really don't rely on any complex Java programming constructs, so a basic understanding of Java is all you need. If your Java skills are a bit rusty, you can get a refresher by reading the Java tutorial included on the CD-ROM. The book doesn't assume any knowledge of mobile Java programming, so don't worry if you've never tinkered with a Java-powered phone.

All the examples in the book are available on the accompanying CD-ROM, including batch files for using the command-line J2ME Wireless Toolkit tools to build and run them from a command prompt; the J2ME Wireless Toolkit is also included on the CD-ROM. As I mention several times throughout the book, you'll likely find the KToolbar visual tool that comes with the J2ME Wireless Toolkit to be extremely useful for building and testing the examples. All the examples are designed to be easily opened, compiled, and emulated with KToolbar.

Beyond some Java knowledge, all you really need is an open mind and a little creativity to get the most out of this book. They will serve you well as you embark on this journey into the world of mobile game creation. And if you happen to get lost along the way, drop by my website at http://www.michaelmorrison.com/ and you may be able to find some help in the forum for this book. Have fun!

© Copyright Pearson Education. All rights reserved.

Read More

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >