1. Trang chủ
  2. » Công Nghệ Thông Tin

Micro java game development

418 407 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 418
Dung lượng 6,98 MB

Nội dung

Table of Contents Micro Java™ Game Development By David Fox, Roman Verhosek Publisher : Addison Wesley Pub Date : April 18, 2002 ISBN : 0-672-32342-7 Pages : 576 Wireless games are always on and always with you, and can reach a more massive audience than any other gaming platform in history. No programming language is as suited for micro games as Java 2 Micro Edition (J2ME). Micro Java Game Development is your step-by-step guide to creating games for devices that support J2ME/MIDP. The material covers a full range of topics, from a tour of all available micro devices (PDAs, cell phones, and pagers) to a discussion of software standards that support J2ME (WAP, SMS, i-mode, and wireless enhancements such as Bluetooth) to an overview of J2ME extensions (Siemens Game API, NTT DoCoMo I- Appli). Chapter by chapter, this book will guide you through the development of Micro Racer, a professional-level game. Brought to you by ownSky!! ii Table of Content Table of Content i Copyright . i Trademarks i Warning and Disclaimer . i Credits ii Dedication iii About the Author iii Acknowledgments .iii Chapter 1. Introduction (or Everything I Wanted to Know About Micro Java Gaming But Was Afraid to Ask) . 1 A New Era of Gaming 1 This Book's Mission . 3 A Bit About Game Design . 6 Show Me the Money: Micro Game Business Models . 16 Summary . 18 Part I: Small Devices 19 Chapter 2. The Mobile World 20 A New Era of Gaming 20 High-End Java Devices: Set-Top Boxes, Phones, Consoles 22 Personal Digital Assistants (PDAs) . 24 Mobile Phones and Pagers 31 Low-End Java Devices: Smart Cards and Embedded Chips 40 Summary . 41 Chapter 3. Big Games, Small Screens . 42 Your Competition . 42 WAP Games . 43 i-mode Games 54 SMS Games 55 J2ME MIDP Games . 57 J2ME Palm Games 65 iAppli Games . 67 What Are You Waiting For? 74 Part II: Before, Between, and Beyond J2ME 75 Chapter 4. Wireless Standards: How Data Goes To And Fro . 76 Wireless Networks . 76 The Wireless Application Protocol (WAP) 78 Server-Side WAP . 95 Handheld Device Markup Language (HDML) 102 WAP 2.0 and xHTML Basic 105 Summary . 106 Chapter 5. Let's Talk: Instant Wireless Messaging . 107 Messaging And Gaming 107 Short Message Service (SMS) . 108 Actually Sending SMS Messages 112 SMS and J2ME . 113 Multimedia Messaging Service (MMS) . 115 Summary . 117 Chapter 6. Wireless in Asia: i-mode and cHTML 118 Using i-mode . 118 Compact HTML (cHTML) 119 Development Tools 125 Testing and Emulators 125 iii Summary . 128 Chapter 7. The Wireless Landscape . 129 Bluetooth . 129 Mobile Positioning 131 m-Commerce 135 Voice and Telephony . 137 Unified Messaging (UM) 138 Summary . 138 Part III: The Java 2 Micro Edition 140 Chapter 8. J2ME Overview . 141 The Trinity of Java Platforms 141 It's a Small World After All 142 Profiles and Configurations 143 Connected in a Limited Way: The CLDC . 147 The Mobile Profile 148 Summary . 149 Chapter 9. Creating a MIDlet 150 Command-Line MIDlet Development 150 Development Environments . 152 Lifecycle of a MIDlet 156 Displaying Stuff . 157 Menus and Commands . 161 Creating Help and About Alert Screens 164 Global Properties . 168 Summary . 169 Chapter 10. Making the Most of Limited Resources . 171 The Limitations . 171 Memory Limitations 172 Displays . 174 Breaking Through the Limitations 175 Summary . 176 Chapter 11. Making the Most of It: Optimizations . 177 A Limited World 177 Making Code Optimal 177 Code Size Reductions . 178 Speeding Up the Code 182 Using Less Memory . 185 Power Consumption 187 Summary . 187 Chapter 12. Multithreaded Game Programming 188 Threads 188 Extending the Thread Object 189 Implementing the Runnable Interface . 190 Thread Priorities . 192 Thread States . 192 Synchronizations and Deadlocks 192 wait() and notify() 193 Timers 194 Making Threads Better 195 Summary . 196 Part IV: Let the Games Begin! 198 Chapter 13. High-Level Graphical User Interfaces . 199 The Screen Class . 199 Forms and Alerts 200 iv Lists 200 Text Boxes 204 Items . 205 Tickers . 212 Additional Libraries 212 Summary . 213 Chapter 14. Working with Graphics: Low-Level Graphical User Interfaces 214 The Canvas Class . 214 Painting on the Screen 217 Drawing Images . 223 Summary . 226 Chapter 15. Entering the Land of Sprites . 227 Sprites 227 Image Files 231 Collision Detection . 233 Creating Child Sprites . 235 Image Transparency 236 Summary . 239 Chapter 16. Managing Your Sprites 240 Networked Game Components 240 Advanced Collision Detection 242 The Sprite Manager . 245 Summary . 248 Chapter 17. Sprite Movement . 249 Floating-Point in J2ME 249 Game Initialization . 255 Movement 256 Piecing It All Together . 258 Summary . 261 Chapter 18. J2ME Audio Basics 262 Sounds Are (Barely) Possible! . 262 Summary . 263 Chapter 19. Be Persistent: MIDP Data Storage 265 RecordStore Overview 265 RecordStore in Practice 266 More RecordStore Joy 273 Summary . 278 Chapter 20. Connecting Out: Wireless Networking 279 J2ME Networking Overview . 279 MIDP Networking . 281 Setting Up Your Game Server . 285 Data Format 286 Making a Multiplayer Car Racing Game . 289 Summary . 315 Part V: J2ME Extensions .316 Chapter 21. PersonalJava, Connected Device Configuration, and Other Micro Java Blends 317 Connected Device Configuration (CDC) 317 PersonalJava 318 PDA Profile 323 Java Game Profile . 324 The J2ME Multimedia Profile . 324 Summary . 325 Chapter 22. iAppli: Micro Java with a Twist 326 v The Architecture of It All 326 iAppli: Like MIDP, But Not Quite 330 Developing iApplis . 341 Summary . 343 Chapter 23. Siemens Game API 345 Getting Set Up 345 The Game SDK Overview 348 Images and Sprites 348 Graphic Objects 350 Sprites 350 TiledBackground 353 Flashing . 356 Good Vibrations 357 Music, Sweet Music . 357 GSM Functions . 360 Input Output 361 Summary . 362 Part VI: Micro Racer 364 Chapter 24. Micro Racer: Putting It All Together . 365 The Bad News 365 The Good News . 366 Putting Together the Pieces . 366 One Game Running Everywhere . 383 Summary . 385 Part VII: Appendixes .386 Appendix A. Low-Level GUI Classes 387 Game Classes 387 javax.microedition.lcdui.AlertType . 388 javax.microedition.lcdui.Command 389 javax.microedition.lcdui.Display 389 javax.microedition.lcdui.Displayable 389 javax.microedition.lcdui.Canvas 389 javax.microedition.lcdui.Screen 390 javax.microedition.lcdui.Alert . 390 javax.microedition.lcdui.Form . 390 javax.microedition.lcdui.List . 390 javax.microedition.lcdui.TextBox 391 javax.microedition.lcdui.Font . 391 javax.microedition.lcdui.Graphics . 392 javax.microedition.lcdui.Image . 392 javax.microedition.lcdui.Item . 393 javax.microedition.lcdui.ChoiceGroup 393 javax.microedition.lcdui.DateField . 393 javax.microedition.lcdui.Gauge . 393 javax.microedition.lcdui.ImageItem . 394 javax.microedition.lcdui.StringItem . 394 javax.microedition.lcdui.TextField . 394 javax.microedition.lcdui.Ticker 394 Appendix B. MIDP 1.1 . 395 Main Packages . 395 java.io Class Hierarchy 395 java.io Interface Hierarchy 396 java.lang Class Hierarchy . 396 vi java.lang Interface Hierarchy 397 java.util Class Hierarchy . 397 java.util Interface Hierarchy 397 javax.microedition.io Class Hierarchy . 397 javax.microedition.io Interface Hierarchy . 397 javax.microedition.lcdui Class Hierarchy 398 javax.microedition.lcdui Interface Hierarchy 398 javax.microedition.midlet Class Hierarchy . 398 javax.microedition.rms Class Hierarchy 398 javax.microedition.rms Interface Hierarchy 398 Appendix C. Siemens Game API . 400 Game Classes 400 Siemens GSM Classes . 402 Input/Output Classes . 402 Appendix D. The iAppli API . 404 Packages . 404 com.nttdocomo.io Interfaces 404 com.nttdocomo.io Interfaces 404 com.nttdocomo.lang . 405 com.nttdocomo.net 405 com.nttdocomo.ui 405 com.nttdocomo.ui Interfaces 406 com.nttdocomo.util . 407 com.nttdocomo.util Interfaces . 407 IApplication 408 i Copyright Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book and Addison-Wesley was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers discounts on this book when ordered in quantity for special sales. For more information, please contact: Pearson Education Corporate Sales Division 201 W. 103rd Street Indianapolis, IN 46290 (800) 428-5331 corpsales@pearsoned.com Visit AW on the Web: www.awl.com/cseng/ Copyright © 2002 by Pearson Education All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or other-wise, without the prior consent of the publisher. Printed in the United States of America. Published simultaneously in Canada. 05 04 03 02 4 3 2 1 First printing, April 2002 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Addison-Wesley cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an "as is" basis. ii Credits Associate Publisher Rochelle J. Kronzek Acquisitions Editor Carol Ackerman Development Editor Bryan Morgan Managing Editor Matt Purcell Project Editor George E. Nedeff Copy Editor Seth Kerney Indexers Ginny Bess Sharon Shock Proofreader Harvey Stanbrough Technical Editor Bryan Morgan Team Coordinator Denni Bannister Interior Designer Anne Jones Cover Designer Aren Howell Page Layout iii Michelle Mitchell Dedication To Charlotte, This Future is Yours —David To Lina, the princess of my heart, and Dixie, the silly cat —Roman About the Author David Fox works for Next Game, Inc., creating Web and wireless multiplayer games. Prior to that, his design and development credits include Michael Crichton's "Westworld 2000," Fox Interactive's "X-Files: Unauthorized Access," and PlayLink's real-time strategy "Citizen 01." He is the author of several best-selling books about Internet technologies, and his writing frequently appears in publications such as Salon.com , Gamasutra, and Developer.com. David has presented topics in Java gaming at Sun Microsytem's JavaOne conference for the past three years, and has been the winner of the Motorola-Nextel Developer Challenge for the past two years. Roman Verhovsek is CEO and co-founder of Cocoasoft Ltd., where he is leading a team of J2ME developers. He holds a bachelor's degree in electrical engineering from the University of Ljubljana, and is working on his master's degree of computer science. Since early 1996, he has focused primarily on Java technologies, and for last two years in particular on Java-enabled small devices. In 2001 he held a lecture on J2ME game development at the JavaOne conference. In his other life, Roman enjoys cooking, mountaineering, jogging, and traveling with his girlfriend, Lina. Acknowledgments Writing a book is like a little saga—lots of comedy, some moments of tragedy, and a veritable revolving door of plot turns. The Pearson Technology Group folks are among the most professional and resourceful I've had the privilege of working with, and ultimately responsible for this saga's success. Thanks to Shelly Kronzek for launching things off, Carol Ackerman for fearlessly navigating through muddy and rocky waters, Bryan Morgan for truly excellent advice and insight, Seth Kerney for kicking things into fighting shape, and George Nedeff for actually caring. Andy Langton, as he is wont to do, lent a surefire hand when one was desperately needed. And apologies to Louise for typing myself into oblivion all those unexpected weekends— especially the sunny ones. —David [...]... results This type of game usually appeals to adolescents or hard-core RPG gamers • Games of Chance—Any game based upon random result Most casino games are games of chance, with a little skill thrown on top Roulette, slot machines, or the card game War are the most basic games of chance Games such as Backgammon involve chance, but also require a great amount of strategy • Sports Games—These games allow the... do it, every game designer will need to and answer the following questions: • • • • • What is the game' s genre? What are the limitations of the game? What is the game' s central mission? What are the inputs, and what are the outputs? How will the game play out? 7 Picking a Game Genre There are literally millions of games in the world, and tens of thousands of computer games But all these games can be... makers have Java is clearly the future platform of choice for mobile devices, and an ideal platform for mobile games This Book's Mission We have attempted to write the most in-depth guide showing you how to craft the most cuttingedge Micro Java games possible Whether you are a professional game designer hoping to expand your knowledge of various platforms, a game programmer who wants to port a game to... games such as Monkey's Island and Riven use advanced 3D graphics, strong artificial intelligence, and rich audio to flesh out the game worlds • Puzzle Games—These games require the player to use logic, and often involve the arrangement or matching of symbols Tetris is the king of all puzzle games The audience for puzzle games is usually made up of intelligent, crafty adults • Strategy Games—These games... state of micro gaming We'll go on a whirlwind tour of some of the most popular and revolutionary games out there Because most of these games are not written in Java, we'll try to distill the most successful element of these games so that you can take the best ideas and run with them Part II: Before, Between, and Beyond J2ME In many cases, handheld games will not be written in Java alone Rather, games... The games usually have excellent 10 graphics and highly realistic physics These games usually appeal to the same fans that enjoy the sport itself Some sports games are coaching or managing games, and allow the player to take a more strategic, top-down, and sideline approach to team building, player trading, or gameplaying A special subset of sports games worth singling out is racing games These games... writing in Micro Java games becomes more essential than ever A good Micro Java game designer is also about turning lemons into lemonade Good designers can actually take new devices such as mobile phones and use them in ways that nobody has ever imagined or expected, but that are wholly intuitive and logical For instance, one of the most ingenious mobile phone games out there is a Japanese game called... that it will support Java technology in most of its future mobile terminals, with plans to sell more than 50 million Java handsets in 2002 and 100 million Java phones by the end of 2003 Nokia phones will support various flavors of Java, ranging from MIDP to PersonalJava and JavaPhone In addition, many North American wireless services already support Java, or are planning to support Java network traffic... http://www.javasoft.com/products/personaljava/ JavaTV JavaTV is an Application Program Interface (API) specifically designed for a digital television receiver It sits atop PersonalJava and includes special functions for • Streaming audio and video 23 • • • Accessing in-band and out-of-band data channels Changing channels On-screen graphical overlays For more information on the Java TV API, visit http:/ /java. sun.com/products/javatv/ JavaPhone... decade or two ago, the only games that people spent much time with were professional sports, board games like Monopoly and Chess, paper and dice games such as Dungeons and Dragons, and card games like Poker or Hearts Some games were for heavy money, some were bone-jarringly competitive, but most were just about good clean fun With the advent of computers, games entered a new era Games became one of the . language is as suited for micro games as Java 2 Micro Edition (J2ME). Micro Java Game Development is your step-by-step guide to creating games for devices that. superior Micro Java game that we call Micro Racer. Check out Figure 1.1 for a sneak preview. Figure 1.1. You will learn how to build this game. Micro Racer

Ngày đăng: 10/10/2013, 12:20

TỪ KHÓA LIÊN QUAN