black art of java gaame programmig

983 482 0
black art of java gaame programmig

Đ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

Black Art of Java Game Programming:Introduction Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Table of Contents Introduction Gaming on the Web is the next blockbuster business. Have any doubts? The video game industry, which already eclipses Hollywood in terms of revenue, targets the Web as the next huge growth area. Software developers are busily porting games to the online environment, or developing entirely new ones. And numerous popular Web sites, many of which charge fees, are devoted to game entertainment. With Black Art of Java Game Programming, you’ll learn how to create your own dynamic online entertainment using the Java programming language. Java heralds a revolutionary shift in gaming, away from the desktop and into the network. Using Java, you’ll create games that people can download through the Web and play. Using Java, you’ll enable players from around the world to compete against one another. As Java enters its maturity, the possibilities of creating innovative entertainment are endless, and the potential for profit unbounded. This book provides you with the foundations for creating Java games of all types, such as board games, video games, and networked/multiplayer games. We recommend that you have some basic knowledge of C, C++, or Java before diving in. The underlying thread of this book is that good object- oriented design and good Java games go hand in hand, so we devote the early chapters of the book to covering and applying object-oriented principles to graphics and games. Once the foundations have been laid, we build a wide variety of games. As you will see, game programming is almost a game in itself, and once you learn the basics, you’ll be well equipped to write innovative games on your own. Organization Black Art of Java Game Programming is divided into three parts: Part I, Fundamentals of Java Game Development Part II, Advanced Game and Graphics Techniques Part III, Game Gallery file:///D|/Downloads/Books/Computer/Java/Bla %20Of%20Java%20Game%20Programming/index.html (1 von 3) [13.03.2002 13:17:32] www.traintelco.com Black Art of Java Game Programming:Introduction Part I, Fundamentals Part I takes you on a whirlwind tour of Java, graphics, and object-oriented game programming. This section is for you if you’re learning Java, if you’re new to object-oriented design, or if you want to see how to build a game step by step. This is what’s covered in the Fundamentals section: Chapter 1, “Fundamental Java,” delivers a turbocharged introduction to the Java language, the API, and object-oriented design. By the end, you’ll create graphics applets. Chapter 2, “Using Objects for Animation,” shows you how classes, inheritance, and dynamic method binding help you animate objects. You’ll also learn about clipping and double-buffering, two basic graphics techniques. Chapter 3, “Animating Sprites,” teaches you to create a simple abstract class for representing graphics objects called sprites. In addition, you’ll learn about interfaces, bitmap animation, and sound. Chapter 4, “Adding Interactivity,” shows you how to create applets that respond in real time to player input. Chapter 5, “Building a Video Game,” shows you how to apply what you’ve learned in the first four chapters to create a shoot-’em-up video game. What you learn here can be applied to creating many other types of games. Chapter 6, “Extending Your Video Game,” shows you how to take a game that you’ve developed and add new features to it without starting from scratch. Chapter 7, “Creating Customizable Games with the AWT,” demonstrates how Java’s Abstract Windowing Toolkit allows players to change parameters in your games. What you learn here about the AWT will be applied throughout the rest of the book. Part II, Advanced Game and Graphics Techniques In Part II, you’ll learn the skills necessary to bring your games into the next dimension, such as multithreading, networking and multiplayer techniques, and 3D. Chapter 8, “Implementing a High Score Server on a Network,” takes you through Java’s networking and GUI facilities, and teaches you to build a high score server for your games. Chapter 9, “Advanced Networking and Multiplayer Gaming Concepts,” illustrates techniques for enabling multiuser game play over the Web. In addition, you’ll deepen your understanding of Java’s networking capabilities by implementing a chat room. file:///D|/Downloads/Books/Computer/Java/Bla %20Of%20Java%20Game%20Programming/index.html (2 von 3) [13.03.2002 13:17:32] www.traintelco.com Black Art of Java Game Programming:Introduction Chapter 10, “Advanced Techniques,” covers features of Java and the Java API that are useful in writing games and organizing programs. Chapter 11, “Into the Third Dimension,” demonstrates the process of defining, transforming, projecting, and painting three-dimensional models, and builds classes that can be used to make a simple 3D engine. Chapter 12, “Building 3D Applets with App3Dcore,” shows how the App3Dcore (a set of classes) works and how it can be used to develop some simple 3D applets and an advanced 3D game. Part III, Game Gallery In Part III, you’ll apply the skills you’ve learned in earlier chapters as leading Java game designers take you step by step through the creation of a wide spectrum of cool games. Chapter 13,“Building the JAVAroids Game,” shows you how to create a Java version of the video game classic Asteroids. Chapter 14, “Daleks!,” takes you through the creation of an enhanced Java version of a classic computer game. Chapter 15, “NetOthello,” builds on your networking skills learned in earlier chapters to create a networked implementation of the classic game Othello. Chapter 16, “WordQuest,” takes you through the creation of a Java game specifically designed to teach vocabulary, but which could easily be extended to teach a plethora of other concepts, demonstrating Java’s potential as a learning tool. Chapter 17, “The Magic Squares Puzzle,” is an example of a deceptively simple, yet challenging puzzle game that will delight Rubik’s Cube enthusiasts (and many others). Chapter 18, “The Internet MahJong Server,” demonstrates a software package that allows people to play the classic Chinese strategy game MahJong with each other online. Chapter 19, “Slider Puzzle,” shows you how to write a Java applet for a simple slider puzzle enhanced with animation and sound. Chapter 20, “The Game of Worm,” develops a game in which you control the direction of a virtual worm on a rectangular playing surface, collecting treats while avoiding collision with solid objects. Table of Contents file:///D|/Downloads/Books/Computer/Java/Bla %20Of%20Java%20Game%20Programming/index.html (3 von 3) [13.03.2002 13:17:32] www.traintelco.com Black Art of Java Game Programming:Table of Contents Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Introduction What's on the CD-ROM? About the Authors Part I—Fundamentals of Java Game Development Chapter 1—Fundamental Java What Is Java? The World Wide Web What Is a Java Applet? Advantages to Writing Games in Java Other Benefits Current Limitations to Writing Games in Java Object-Oriented Fundamentals Thinking with States and Behaviors Defining a Class Variables Methods Constructors Creating an Object Accessing Object Variables and Methods Inheritance Java Summary The Java Core Primitive Data Types Arrays Classes and Objects Instance, Static, and Final Variables and Methods Memory Management Packages Operators Control Flow Threads Exceptions Major Differences Between Java, C, and C++ The Java API file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (1 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java Game Programming:Table of Contents java.applet java.awt java.awt.image java.awt.peer java.io java.lang java.net java.util The Java Interpreter Three Sample Applications Program 1: Your First Java Program Program 2: Parameter Passing Program 3: A Linked List Understanding Applets Executing an Applet Creating Graphics Drawing Filling Color A Graphics Applet The Applet Life Cycle Suggestion Box Summary Chapter 2—Using Objects for Animation What Is Animation? Creating Our First Animation Applet Using the Universal Animation Loop Tracing the Applet’s Execution Path Improving Animation Quality Understanding Animation Flicker Using Double-Buffering to Eliminate Flicker Using Clipping to Improve Performance Adding Complexity to Your Animation Using Objects Defining the Class The this Keyword Using this in Constructors Using the DancingRect Class Using Inheritance When to Use Inheritance When Not to Use Inheritance file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (2 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java Game Programming:Table of Contents Inheritance Details The Object Class Method Overriding The super Keyword Using super in Constructors Final Classes and Methods Using Inheritance in Our Example Applet Using Dynamic Method Binding Putting It Together Suggestion Box Summary Chapter 3—Animating Sprites What Are Sprites? Sprite States Sprite Behaviors Using Abstract Classes Defining the Sprite Class Using Access Specifiers Public Access Private Access Protected Access Package/Default Access Accessor Methods Applying the Sprite Class to an Example Applet Using Interfaces What Is an Interface? Java Interfaces Multiple Interfaces Abstract Classes vs. Interfaces Creating a Moveable Interface Creating an Applet with Bouncing Sprites Using Bitmaps Bitmaps in Java Loading and Drawing a Bitmap Image Specifying the Location of a Bitmap Image Creating Bitmap Sprites Using Sound Loading an AudioClip Playing the Sound Four Rectangles and a Sushi Chef Suggestion Box file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (3 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java Game Programming:Table of Contents Summary Chapter 4—Adding Interactivity How Input Devices Work What Is an Event? Mouse Events Keyboard Events The Event Class Handling Function Keys Handling Modifier Keys Event Handling in the AWT Overview of Component classes How the AWT Handles Events Displaying Text Defining Strings Choosing Fonts Drawing Strings Inserting a Text String into an Applet Clicking and Dragging Sprites Creating Bitmap Loops Using MediaTracker Defining the BitmapLoop Class An Interactive Applet Using BitmapLoop Sprites Suggestion Box Summary Chapter 5—Building a Video Game Overview of the Alien Landing Game The Video Game Loop Dividing Responsibility Among Functional Units The GunManager Unit The UFOManager Unit The GameManager Unit Interplay Among the Functional Units Defining the GunManager GunSprite The BitmapSprite Class The Moveable Interface The Intersect Interface Determining Intersections with Bounding Boxes Implementing GunSprite MissileSprite The RectSprite Class file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (4 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java Game Programming:Table of Contents Incorporating the Intersect Interface Implementing MissileSprite GunManager Computing Variables Defining the UFOManager The UFO Class The BitmapLoop Sprite Class The Four UFO Behavioral States Transitioning Between States Implementing the UFO Sprite Class The UFOManager Class Defining the GameManager Two Responsibilities of the GameManager Class Passing Mouse Input to the GunManager Implementing the Video Game Loop Implementing the GameManager Class Suggestion Box Summary Chapter 6—Extending Your Video Game Changing the UFO Animations Extending the UFO Class Modifying GameManager and UFOManager Adding Levels of Difficulty Tracking Game Status Modifying GunManager Creating an Opening and Closing Source Code for Modified Classes Suggestion Box Summary Chapter 7—Creating Customizable Games with the AWT Creating Graphical Interfaces with the AWT Overview of the AWT Creating Graphical Interfaces Handling Action Events Defining the Action Handler in the Container Defining the Action Handler in the Component Using Components, LayoutManagers, and Containers Components Buttons Checkboxes Checkbox Groups file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (5 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java Game Programming:Table of Contents Labels Text Fields LayoutManagers FlowLayout BorderLayout GridLayout Other Layout Managers Containers Panels Frames Dialogs Customizing Alien Landing Defining the GameFrame Container Creating a Menu Bar Handling Menu Actions Defining the Customization Dialog Customized Source Code for GameManager Using Applet Parameters What Are Applet Parameters? Reading Applet Parameters Quick AWT Reference The Component and Container Classes Components Containers Cursors Menu, MenuBar, and MenuItem The Event Class Suggestion Box Summary Part II—Advanced Game and Graphics Techniques Chapter 8—Implementing a High Score Server on a Network Why Use Java for Network Programming? What Is Client-Server Networking? Basic Client-Server Terminology Some Additional Concepts Exception Handling Streams Implementing Our Client Server Game Model Implementing Client Features Creating the HighScoreManager Class file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (6 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java Game Programming:Table of Contents How HighScoreManager Reduces Calculations Implementing Server Features Effect of Client Design on Server Performance Tasks Performed by the Server Creating the High Score Objects The HighScoreList Class Scoring Variables The HSob Object Class Data Parsing The StringTokenizer Class Converting Data to Objects The parseData() Method The addScore() Method The tryScore() Method The getScore() Method Creating the HighScoreManager Class The getScores() Method The paintScores() Method Methods for Creating Colors Methods for Creating Fonts Adding New Scores to HighScoreList Creating a Testing Applet Double-Buffering the Testing Applet The testApp GUI Threading HighScoreManager Using Threads Converting HighScoreManager to a Thread Writing the Networking Code Creating a New Socket Establishing the Connection Updating and Requesting Information: The HighScore Protocol Understanding Blocking Terminating the Link Creating a Server Application The HighScoreServer Class The ServerThread Class Server Initialization Routine Coding the run() Method Trying Out the New Server Writing Scores Out to a File Running the New Server file:///D|/Downloads/Books/Computer/Java/Bl 20Of%20Java%20Game%20Programming/ewtoc.html (7 von 20) [13.03.2002 13:17:36] www.traintelco.com [...]... file:///D|/Downloads/Books/Computer /Java/ Bl 2 0Of% 2 0Java% 20Game%20Programming/ewtoc.html (20 von 20) [13.03.2002 13:17:37] Black Art of Java Game Programming:What's on the CD-ROM? Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Table of Contents What’s on the CD-ROM? The CD-ROM included with Black Art of Java Game Programming contains... Tenitchi Table of Contents www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/about_author.html (3 von 3) [13.03.2002 13:17:38] Black Art of Java Game Programming:Fundamental Java Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Previous Table of Contents Next Part I Fundamentals of Java Game... file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/ch01/001-010.html (4 von 4) [13.03.2002 13:17:38] Black Art of Java Game Programming:Fundamental Java Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Previous Table of Contents Next Other Benefits The benefits of Java go far beyond its use on the Web Java s blend of multiplatform, multi-threaded,... file:///D|/Downloads/Books/Computer /Java /Black% 2 0Art% 2 0Of% 2 0Java% 20Game%20Programming/about.html [13.03.2002 13:17:37] Black Art of Java Game Programming:About the Authors Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Table of Contents About the Authors Joel Fan is an expert programmer and multimedia developer in Java, C/C++, and Macromedia... negation operator } Previous Table of Contents Next www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/ch01/010-014.html (4 von 4) [13.03.2002 13:17:40] Black Art of Java Game Programming:Fundamental Java Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Previous Table of Contents Next Other objects... cmAbstractMovingScenery The Buildings, Extensions of cmAbstractStaticStructure The Missile Launcher, Extension of cmAbstractWeapon The Constructor www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Bl 2 0Of% 2 0Java% 20Game%20Programming/ewtoc.html (12 von 20) [13.03.2002 13:17:37] Black Art of Java Game Programming:Table of Contents The fire() Method The Missile, Extension of cmAbstractRound The Constructor... object When writing Java games, you www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/ch01/010-014.html (1 von 4) [13.03.2002 13:17:40] Black Art of Java Game Programming:Fundamental Java need to think in terms of the states and behaviors of the objects involved Thinking with States and Behaviors Look at the room around you You’ll see lots of things, such as... collision has occurred A diagram of the UFO object we’ve described is shown in Figure 1-6 Of course, the actual state and behaviors will depend on the particular game www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/ch01/010-014.html (2 von 4) [13.03.2002 13:17:40] Black Art of Java Game Programming:Fundamental Java Figure 1-6 Diagram of UFO object Now that you’ve... shifts in the software industry! Let’s see why Java has created such excitement, and why it’s an innovative platform for creating games First of all, you should understand how Java dramatically changes the nature of the World Wide Web www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/ch01/001-010.html (1 von 4) [13.03.2002 13:17:38] Black Art of Java Game Programming:Fundamental... Figure 1-3 Web page and HTML document www.traintelco.com file:///D|/Downloads/Books/Computer /Java/ Blac 2 0Java% 20Game%20Programming/ch01/001-010.html (2 von 4) [13.03.2002 13:17:38] Black Art of Java Game Programming:Fundamental Java Now let’s see how a Java applet can liven up an HTML document What Is a Java Applet? A Java applet is a program that a browser can download and execute To add an applet to a . Programming:Table of Contents java. applet java. awt java. awt.image java. awt.peer java. io java. lang java. net java. util The Java Interpreter Three Sample Applications Program 1: Your First Java Program. Gallery file:///D|/Downloads/Books/Computer /Java/ Bla %2 0Of% 2 0Java% 20Game%20Programming/index.html (1 von 3) [13.03.2002 13:17:32] www.traintelco.com Black Art of Java Game Programming:Introduction Part I, Fundamentals Part I takes. Between Java, C, and C++ The Java API file:///D|/Downloads/Books/Computer /Java/ Bl 2 0Of% 2 0Java% 20Game%20Programming/ewtoc.html (1 von 20) [13.03.2002 13:17:36] www.traintelco.com Black Art of Java

Ngày đăng: 27/10/2014, 00:32

Từ khóa liên quan

Mục lục

  • Black Art Of Java Game Programming

    • Introduction

    • Table of Contents

    • What's on the CD-ROM?

    • About the Authors

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Fundamental Java

    • Black Art of Java Game Programming:Fundamental Java

    • Black Art of Java Game Programming:Using Objects for Animations

    • Black Art of Java Game Programming:Using Objects for Animations

    • Black Art of Java Game Programming:Using Objects for Animations

    • Black Art of Java Game Programming:Using Objects for Animations

    • Black Art of Java Game Programming:Using Objects for Animations

    • Black Art of Java Game Programming:Using Objects for Animations

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan