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

Tài liệu 3D Game Programming All in One- P1 docx

30 425 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

Tiêu đề 3D Game Programming All in One
Tác giả Kenneth C. Finney
Định dạng
Số trang 30
Dung lượng 1,44 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.... Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.... Team LRNPlease purchase PD

Trang 1

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 2

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 3

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 4

This page intentionally left blank

Trang 6

SVP, Course Professional, Trade, Reference Group:

Michael Dawson and Les Pardew

Retail Market Coordinator:

Sandi Wilson and Sara Gullion

© 2004 by Premier Press, a division of Course Technology All rightsreserved No part of this book may be reproduced or transmitted in anyform or by any means, electronic or mechanical, including photocopy-ing, recording, or by any information storage or retrieval system with-out written permission from Course PTR, except for the inclusion ofbrief quotations in a review

The Premier Press logo and related trade dress are trademarks of PremierPress and may not be used without written permission

UltraEdit is a registered trademark of IDM Computer Solutions, Inc.,Paint Shop Pro 8 is a trademark of Jasc Corporation, Inc Audacity andQuArK 6.3 use are subject to the GNU General Public License ChainReaction and Reaction Engine SDK are trademarks of Monster Studios

UVMapper 0.25—copyright ©1998-2002 Stephen L Cox, All rightsreserved ThinkTanks is a trademark of BraveTree Productions, LLC Orbz

is a trademark of Mind Vision Software Marble Blast Gold is a trademark

of GarageGames MilkShape 3D is a trademark of chUmbaLum sOft

All other trademarks are the property of their respective owners

Important: Course PTR cannot provide software support Please contact

the appropriate software manufacturer’s technical support line or Website for assistance

Course PTR and the author have attempted throughout this book todistinguish proprietary trademarks from descriptive terms by followingthe capitalization style used by the manufacturer

Information contained in this book has been obtained by Course PTRfrom sources believed to be reliable However, because of the possibility

of human or mechanical error by our sources, Course PTR, or others, thePublisher does not guarantee the accuracy, adequacy, or completeness ofany information and is not responsible for any errors or omissions or theresults obtained from use of such information Readers should be partic-ularly aware of the fact that the Internet is an ever-changing entity Somefacts may have changed since this book went to press

Educational facilities, companies, and organizations interested in ple copies or licensing of this book should contact the publisher forquantity discount information Training manuals, CD-ROMs, and por-tions of this book are also available individually or can be tailored forspecific needs

multi-ISBN: 1-59200-136-XLibrary of Congress Catalog Card Number: 2004090733Printed in the United States of America

04 05 06 07 08 BH 10 9 8 7 6 5 4 3 2 1

Course PTR, a division of Course Technology

25 Thomson PlaceBoston, MA 02210http://www.courseptr.com

Trang 7

This book is dedicated to my wife, Tubetti, and my two sons, Rockid and Lincus, whose sacrifices and encouragement made it possible.

-CERDIP

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 8

I would like to thank Dave Wilkes for his encouragement to do this book, and the other

guys at Wilkes Associates for just putting up with me, especially during the early days

of its creation.

I also want to thank my editors, Mitzi Koontz, Laura Gabler, Mike Dawson, Les Pardew, Kevin Hawkins, and Dave Astle, and especially the ever-patient Jenny Davidson (she laughs at my jokes!) A big thank you to André LaMothe for pushing the idea, and mak- ing it happen.

Many thanks and a tip o’ the hat go to those Four Guys in a Garage: Jeff Tunnell, Rick Overman, Mark Frohnmayer, and Tim Gift These are the perpetrators of Torque, and the founders of GarageGames An amazing crew Thanks to Desmond Fletcher for his assis- tance (knowing and unknowing) with subjects as diverse as particles, terrain, and clouds Many thanks go to Melv May, Harold Brown, Anthony Rosenbaum, Phil Carlisle, Dave Wyand, Matthew Fairfax, Pat Wilson, Ryan Parker, Simon Windmill, Kevin Ryan, Joe Mar- uschak, Joel Baxter, Justin Mette and the 21-6 gang, and Frank Bignone, for their many contributions to the Torque engine and its game development community Hearty thanks

to Nick Palmer for allowing me to use his music, which appears on the CD.

I also want to thank every player who came to Tubettiworld in those halcyon DF2 days and made it his or her virtual home They made it a great place to play and socialize online I would like to list them all, but obviously I can’t To the late John “Tufat” Tucker, the gentleman—I salute you, !S Then there are, in no particular order: AceTW, his evil twin Malfunction, Strata, Spector, Roadkill, Midnight, Oz Mal, Deadbolt, Insomniac, Checkfire, Norway, Animal, Qdad, MickyD, Buster, Major Chip Hazard, Pirate, Kotch, C2, FF6, IRS Agent, and Kdawg—I mustn’t neglect to mention Dr Evil and the great work he

vi

Acknowledgments

Trang 9

Acknowledgments vii

and his gang are doing with the TXP stuff Last, but certainly not least, Jim, The Nailer, the epitome of the Online Game Player, and an all around great guy I hope that everything works out, Jim.

Along the way, there have been many others in various places that deserve some mention:

KILLER and his gang, who do what cornered rats do best—fight back Many other game developers can learn a thing or two about hard work from those guys Onchas, Cowboy, Badger, and the rest of the “Allies”—keep up the good work Same with you “Axis” play- ers (except that your days are numbered!) Also a hearty !S to the Playnet forum denizens who opened a second front as soon as the war started (Teh?).

I’m sure I’ve forgotten to acknowledge someone, and I’ll probably get e-mails to that effect, but that’s the risk one embraces.

Regards, CERDIP

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 10

KENNETHC FINNEY is the Principal Software Engineer at Wilkes Associates, Inc in the Greater Toronto Area He began programming in 1974 and was a recipient of the presti- gious Conference Board of Canada ITX (Innovation in Technology Excellence) Award in

1997 for his work on InScan—a high-speed document scanning system He was a tant to the Department of National Defence in Canada in Armoured Fighting Vehicle sys- tems design, and is an orange-qualified Nuclear Engineer designing NDE systems and techniques for Candu reactor stations He is an associate professor at Seneca College at York University in Toronto, helping technical writers learn how to survive in a software development environment Ken is the creator of the popular Tubettiland ‘Online Cam- paign’ Mod and the ‘QuicknDirty’ game management tools for Novalogic’s Delta Force 2 game series He is currently working on the new and unique Tubettiworld action/adven- ture game (www.tubettiworld.com) using the Torque Game Engine.

consul-A bout the consul-Author

Trang 11

ANDRÉLAMOTHE, CEO, Xtreme Games LLC, has been involved in the computing try 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 Course Technology PTR

indus-Game Development series.

A bout the Series Editor

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 13

Contents at a Glance xi

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 14

Introduction xxvi

Chapter 1 Introduction to 3D Game Development 1

The Computer Game Industry .1

3D Game Genres and Styles .2

Game Platforms .8

Game Developer Roles 11

Publishing Your Game .15

Elements of a 3D Game .16

Game Engine .16

Scripts 17

Graphical User Interface .19

Models .19

Textures .20

Sound .20

Music .21

Support Infrastructure .21

The Torque Game Engine 23

Descriptions .23

Using Torque in This Book .28

Moving Right Along .29

xii

Contents

Trang 15

Chapter 2 Introduction to Programming 31

UltraEdit-32 .31

Program Setup and Configuration .32

Setting Up Projects and Files .32

Search and Replace .35

Find in Files .38

grep .39

Bookmarks .42

Macros .43

UltraEdit Review .44

Controlling Computers with Programs .45

Programming Concepts .48

How to Create and Run the Example Programs .48

Hello World .49

Expressions .52

Variables .53

Operators .60

Loops .64

Functions .66

Conditional Expressions .71

Branching 74

Debugging and Problem Solving .82

Best Practices .86

Moving Right Along 87

Chapter 3 3D Programming Concepts 89

3D Concepts .89

Coordinate Systems .90

3D Models .92

3D Shapes .94

Displaying 3D Models 95

Transformation .95

Rendering .98

Scene Graphs .103

3D Audio .104

3D Programming .104

Programmed Translation .105

Programmed Rotation .111

Contents xiii

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 16

Programmed Scaling .113

Programmed Animation .115

3D Audio .119

Moving Right Along .122

Chapter 4 Game Programming 123

Torque Script .123

Strings .124

Objects .125

DataBlocks .128

Game Structure .129

Server versus Client Design Issues .132

Common Functionality .133

Preparation 133

Root Main 134

Control Main .139

Initialization .141

Client .144

Server .149

Player .151

Running Emaga4 .153

Moving Right Along .155

Chapter 5 Game Play 157

The Changes .157

Folders .157

Modules .158

Control Modules 158

control/main.cs .159

Client Control Modules .160

control/client/client.cs .160

control/client/interfaces/menuscreen.gui .162

control/client/interfaces/playerinterface.gui .165

control/client/interfaces/splashscreen.gui 169

control/client/misc/screens.cs .169

control/client/misc/presetkeys.cs 171

Server Control Modules .175

control/server/server.cs .175

control/server/players/player.cs 180

Contents xiv

Trang 17

control/server/weapons/weapon.cs .186

control/server/weapons/crossbow.cs 190

control/server/misc/item.cs .197

Running Emaga5 .202

Moving Right Along .203

Chapter 6 Network 205

Direct Messaging .205

CommandToServer .206

CommandToClient .207

Direct Messaging Wrap-up .209

Triggers 209

Area Triggers .209

Animation Triggers .209

Weapon State Triggers 210

Player Event Control Triggers 210

GameConnection Messages .211

What GameConnection Messages Do .212

Specifics .212

Finding Servers .217

Code Changes .217

New Modules .218

Dedicated Server .230

Root Main Module 230

Control—Main Module .231

Control—Initialize Module 231

Testing Emaga6 .232

Moving Right Along .233

Chapter 7 Common Scripts 235

Game Initialization 235

Selected Common Server Modules .240

The Server Module 240

The Message Module .241

The MissionLoad Module .242

The MissionDownload Module .246

The ClientConnection Module .250

The Game Module .256

Contents xv

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 18

Selected Common Code Client Modules .258

The Canvas Module .259

The Mission Module 261

The MissionDownload Module .262

The Messages Module .266

A Final Word .268

Moving Right Along .273

Chapter 8 Introduction to Textures 275

Using Textures .275

Paint Shop Pro .279

Installing Paint Shop Pro .279

Getting Started .279

Working with Files .283

Paint Shop Pro Features .290

Moving Right Along .307

Chapter 9 Skins 309

UV Unwrapping .309

The Skin Creation Process 310

Making a Soup Can Skin .311

The Soup Can Skinning Procedure 311

Testing the Soup Can Skin .315

Making a Vehicle Skin .316

The Dune Buggy Diversion 316

Testing the Runabout Skin 321

Making a Player Skin .322

The Head and Neck .322

Hair and Hands .327

The Clothes .329

Trying It on for Size .333

Moving Right Along .333

Chapter 10 Creating GUI Elements 335

Controls .336

GuiChunkedBitmapCtrl .337

GuiControl .339

GuiTextCtrl .339

GuiButtonCtrl 340

Contents xvi

Trang 19

GuiCheckBoxCtrl .341

GuiScrollCtrl .342

GuiTextListCtrl .343

GuiTextEditCtrl .344

The Torque GUI Editor .345

The Cook’s Tour of the Editor .345

Moving Right Along .349

Chapter 11 Structural Material Textures 351

Sources .352

Photography .352

Original Artwork .357

Scaling Issues .358

Tiling 359

Texture Types .360

Irregular .360

Rough 361

Pebbled .361

Woodgrain .361

Smooth 361

Patterned .362

Fabric .362

Metallic .362

Reflective .362

Plastic .362

Moving Right Along .363

Chapter 12 Terrains 365

Terrains Explained .365

Terrain Characteristics .365

Terrain Data .367

Terrain Modeling .367

Height Maps 368

Terrain Cover .369

Tiling 369 Creating Terrains .370

The Height-Map Method .370

Applying Terrain Cover .378

Moving Right Along .380

Contents xvii

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Trang 20

Chapter 13 Introduction to Modeling with MilkShape 381

MilkShape 3D .381

Installing MilkShape 3D .381

The MilkShape 3D GUI .382

Navigating in Views .383

View Scale and Orientation .383

The Soup Can Revisited .384

Menus 391 The Toolbox .398

The Preferences Dialog Box .404

UVMapper .406

The File Menu .407

The Edit Menu .407

The Help Menu .407

UV Mapping 407

Moving Right Along .414

Chapter 14 Making a Character Model 415

Modeling Techniques .415

Shape Primitives .415

Incremental Polygon Construction 415

Axial Extrusion .416

Arbitrary Extrusion 417

Topographical Shape Mapping .417

Hybrids .417

The Base Hero Model .417

The Head .418

The Torso .423

Matching the Head to the Torso .429

The Legs .430

Integrating the Legs to the Torso .432

The Arms .433

Integrating the Arms to the Torso .438

The Hero Skin .438

Character Animation .443

Animating Characters in Torque .443

Building the Skeleton .446

Rigging: Attaching the Skeleton .447

Contents xviii

Ngày đăng: 24/12/2013, 17:15

TỪ KHÓA LIÊN QUAN