Table Of ContentThis document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
• Table of Contents
J2ME ™
By MARTIN J. WELLS
Publisher: Premier Press
Pub Date: 2004
ISBN: 1-59200-118-1
Pages: 803
Have you ever seen players' eyes light up as they explore the worlds that you've created in your games? If you have,
then game development probably has you hooked firmly in its grasp! If you've never taken your games beyond the
PC, now's the time! "J2ME Game Programming" is a hands-on guide that teaches you how to create games for
micro-devices. You'll be amazed at just how cool the games you create can look and play. Focusing primarily on
mobile phone game creation, you'll jump right in and create your own games as you work your way through the book.
The thought has surely crossed your mind that it would be nice to make some money off of this cool hobby of yours.
J2ME offers real opportunity to profit from your games. Learn how you can earn revenue from your games by taking
them to market. If you have a basic understanding of Java, then you're ready to explore all that "J2ME Game
Programming" has to offer!
Features
Contact the author at marty@tasman-studios.com with questions or comments about the book
Addresses important issues of J2ME game development that have been given little, or no attention in other
publications such as game play design tailored for mobile devices, supporting multiple target devices,
squeezing traditional game techniques, and more.
Readers additionally learn how to structure code and classes to achieve as small an application footprint as
possible.
Covers all the elements needed to create the reader's own J2ME game. Readers learn the essentials of J2ME
game development from the ground up, including issues involved in developing for multiple target devices and
how to wrestle the jungle of device specific libraries and device capabilities.
[ LiB ]
This document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
J2ME ™
By MARTIN J. WELLS
Publisher: Premier Press
Pub Date: 2004
ISBN: 1-59200-118-1
Pages: 803
Table of
•
Contents
Dedication
Acknowledgments
About the Author
About the Series Editor
Letter from the Series Editor
Introduction
What's in the Book?
Who Are You?
Who Am I?
Let's Go!
Part I: What Is J2ME?
Chapter 1. J2ME History
Java's Acorn
Java's Growth in the Sun
So What Is Java?
Multiple Editions
Micro Devices Everywhere
Micro Software
Conclusion
Chapter 2. J2ME Overview
I Shall Call It Mini-ME
J2ME Architecture
MIDP
MIDP 2.0
Conclusion
Chapter 3. J2ME-Enabled Devices
MID Overview
Conclusion
Part II: Show Me the Code!
Chapter 4. The Development Environment
Getting the Tools
Installing the Software
Baking Some MIDlets!
Creating the Full Package
The J2ME Wireless Toolkit
Working with Other Development Environments
Conclusion
Chapter 5. The J2ME API
MIDP API Overview
The MIDlet Application
This document is created with the unregistered version of CHM2PDF Pilot
Using Timers
Networking
Persistence (RMS)
User Interface (LCDUI)
Conclusion
Chapter 6. Device-Specific Libraries
Device-Specific Libraries
Nokia
Siemens
Motorola
Other Extensions
Conclusion
Chapter 7. Game Time
Game Time
Game Design
The Application Class
The Menu
The Game Screen
The Game Loop
Adding the Graphics
The Actors
Input Handling
Collision Detection
Game Over
Conclusion
Part III: Game On
Chapter 8. The Project
The State of Play
Game Types
Designing Your Game
The Development Process
Your Idea
Conclusion
Chapter 9. The Graphics
Sprite Basics
Advanced Sprites
Conclusion
Chapter 10. The Action
Getting Some Action
Basic Movement
Moving at an Angle
Advanced Motion
Collision Detection
Actors
The Enemy
Conclusion
Chapter 11. The World
A New World
Creating a Tile Engine
Building Worlds
Conclusion
Chapter 12. The Game
The Game Screen
Game State
The Primary Actor
This document is created with the unregistered version of CHM2PDF Pilot
Dealing with Damage
Saving and Loading
Conclusion
Chapter 13. The Front End
Front End Overview
The Application Class
The Menus
The Splash Screen
Conclusion
Chapter 14. The Device Ports
Nokia Customization
Build Systems
Multi-Device Builds
Conclusion
Chapter 15. The Optimizing
Speed, Glorious Speed
Optimization
Conclusion
Chapter 16. The Localization
Localizing
Conclusion
Part IV: Sell, Sell, Sell
Chapter 17. Marketing Material
Game Guide
Taking Screenshots
Making Movies
Company Presence
Conclusion
Chapter 18. Sales Channels
J2ME Business Model
Ways to Market
Approaching the Publisher
Doing the Deal
Conclusion
Part V: What Next ?
Chapter 19. CLDC 1.1 and MIDP 2.0
The Next Generation
Developing with MIDP 2
Sound
Enhanced LCDUI
Game API
Communications
Push Registry
Conclusion
Chapter 20. Isometric Games
What Is Isometric Projection?
The Graphics
Conclusion
Chapter 21. Ray Casting
What Is Ray Casting?
The Fundamentals
The Engine
Advanced Features
Conclusion
Chapter 22. Making the Connection
This document is created with the unregistered version of CHM2PDF Pilot
Mobile Communications
Network Gaming
A Simple Networked MIDlet
The Server Side
Online Scoring for Star Assault
Advanced Networking
Conclusion
Appendix A. Java 2 Primer
Java 2
The Nature of a Program
Objects Everywhere
Basic Syntax
Strings
Arrays
Advanced Object-Oriented Programming
Exceptions
Packages, Import, and CLASSPATH
[ LiB ]
This document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
Dedication
For G.I.
[ LiB ]
This document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
Acknowledgments
If you've never written a book, I have to tell you that it's not easy. Once upon a time I was an armchair critic of
booksin hindsight, maybe that's why I decided to write one. The thing that strikes you when you embark on writing
something like this is the sheer mountain of (hard) work involved. In fact, it's so much work that it really isn't possible
for one person to do it alone. Throughout the writing of this book, I've been helped in so many ways by so many
people that I can't hope to get across how grateful I am. All I can do is say a thank you and trust you to know how
much I mean it.
I will, however, attempt to recognize some of the people who deserve a little acknowledgmentif I've forgotten you,
then obviously you didn't deserve it....:)
First, thanks to André LaMothe for giving me the opportunity to contribute to such an excellent series. To Mitzi
Koontz, Jenny Davidson, and Cathleen Snyder for the excellent feedback, continual support, and understanding when
things didn't quite go according to planwe got there in the end. Thanks also to Cristiano Garibaldi for covering all the
technical bases (and learning along with me).
To Colin Pyle and J. Alexander von Kotze: Thanks for never giving up on the dream of making games for a living (and
an extra thanks to Colin for supplying the excellent sprites used in the examples).
To Blake, for allowing me to use his laptop sometimes, and to Ryan, for showing me how a CD drive opens a
thousand times. To Vandana and Pratibha Rai for buying me some time (and thanks for the math books laaa). To
Scott, Rhandy, Simon, Rob, Gibbo, Mike, Jules, Kristy, Kat, Lee, and the rest of the team for keeping the day job
challenging, interesting, and fun.
To Tarek, Sahar, Radfan, and Suleiman for the encouragement and support only friends can give.
To Rick, my only mentor, for showing me that computing really is a science.
To my mum, for showing me that being creative is a way of life and dad for throwing in regular doses of reality.
And finally, to the one and only G.I.: Thanks for believing from day one we could do it, and then bearing the brunt of
following through on that belief.
[ LiB ]
This document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
About the Author
MARTIN J. WELLS began programming his own games on a Tandy micro-computer more than 20 years ago.
Throughout an extensive career in the IT industry, he has worked in many diverse fields involving a huge variety of
computer languages and systems, including Java from its origins. He has extensive experience in media,
communications, and entertainment industry development and has founded successful companies in all of these areas.
Martin lives with his wife and two sons in Sydney, Australia. He loves playing soccer and inline hockey, reading, and
playing with anything cool and interesting (including his sons).
[ LiB ]
This document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
About the Series Editor
ANDRÉ LAMOTHE, CEO, Xtreme Games LLC, has been involved in the computing industry for more than 25
years. He wrote his first game for the TRS-80 and has been hooked ever since! His experience includes 2D/3D
graphics, AI research at NASA, compiler design, robotics, virtual reality, and telecommunications. His books are top
sellers in the game programming genre, and his experience is echoed in the Premier Press Game Development books.
[ LiB ]
This document is created with the unregistered version of CHM2PDF Pilot
[ LiB ]
Letter from the Series Editor
Writing games for PCs is fun, but it just doesn't have the feel of a console or other handheld device. However, the
thought of creating an embedded game for a phone was completely out of the question a few years ago, unless you
wanted to call up Nokia or Motorola and see if you could have the contract to create the on-board games. (I wish
someone would have; they are terrible!) Anyway, luckily for us, new phones support a number of technologies that
allow programmers to create fantastic applications. One such technology is Java II Micro Edition, or J2ME. And
that's what this book is all aboutwriting games for any phone that supports the J2ME standard.
When I first thought of doing a book on J2ME game programming, I knew that I wanted it to push the envelope to set
a new standard on what can be done on a phone. That means I had to find an author who was an expert on the
platform, but was also willing to push limits and do the impossible, in a manner of speaking. I have to say that I am
very happy with this book. The author, Martin Wells, had the same vision about wanting to create the most amazing
book on phone/J2ME game programming. For example, he knew that he had to put a chapter on 3D in the book and
talk about optimization and other advanced topics. The bottom line is that this book is the best book on the market
about making real games on the J2ME platform; moreover, it's written by someone who has made numerous games
on the platform. Marty knows the ins and outs and tricks of the system, which is invaluable in such a complex subject
area with so many other choices to confuse you.
The other amazing thing about this book is that it is completely self-contained; if you don't know Java 2, there is a
Java 2 primer contained within, so more or less all you need is your phone, the book, and some time and you are
going to be creating J2ME games on your own phone! I think that this is an amazing thing to be able to do. It's like
having your own little game console in your hand. You can play your own games or give them to your friends, or
possibly even sell and market them (which is also covered within the book).
In conclusion, if you have been interested in writing games for phones under the J2ME platform, but don't know
where to start, how to integrate all the technology, or make sense of all the different APIs, then this is the book for
you. Rarely can a single book empower someone to do so much, but Martin Wells has done an amazing job of it.
André LaMothe
Series Editor, Premier Game Development Series
[ LiB ]
Description:Have you ever seen a player's eyes light up as they explore the worlds that you've created in your games? If you have, then game development probably has you hooked firmly in its grasp! If you've never taken your games beyond the PC, now's the time! "J2ME Game Programming" is a hands-on guide that t