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

a0002 beginning xna 3 0 game programming from novice to professiona morebook vn 9514

7 2 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Beginning XNA 3.0 Game Programming: From Novice to Professional
Tác giả Alexandre Santos Lobão, Bruno Evangelista, José Antonio Leal de Farias, Riemer Grootjans
Trường học Springer-Verlag
Chuyên ngành Game Programming
Thể loại Giáo trình sách chuyên khảo
Năm xuất bản 2009
Thành phố United States of America
Định dạng
Số trang 7
Dung lượng 417,72 KB

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

Nội dung

Beginning XNA 3.0 Game Programming From Novice to Professional ■ ■ ■ Alexandre Santos Lobão, Bruno Evangelista, José Antonio Leal de Farias, and Riemer Grootjans... Beginning XNA 3.0

Trang 2

Beginning XNA 3.0 Game Programming From Novice to Professional

■ ■ ■

Alexandre Santos Lobão,

Bruno Evangelista,

José Antonio Leal de Farias,

and Riemer Grootjans

Trang 3

Beginning XNA 3.0 Game Programming: From Novice to Professional

Copyright © 2009 by Alexandre Santos Lobão, Bruno Evangelista, José Antonio Leal de Farias,

Riemer Grootjans

All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.

ISBN-13 (pbk): 978-1-4302-1817-3

ISBN-13 (electronic): 978-1-4302-1818-0

Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1

Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence

of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

Lead Editors: Ewan Buckingham, Joohn Choe

Technical Reviewer: Fabio Claudio Ferracchiati

Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell,

Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie,

Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft,

Matt Wade, Tom Welsh

Project Manager: Sofia Marchant

Copy Editor: Marilyn Smith

Associate Production Director: Kari Brooks-Copony

Production Editor: Laura Esterman

Senior Compositor: Susan Glinert

Proofreader: Greg Teague

Indexer: Becky Hornyak

Cover Designer: Kurt Krames

Manufacturing Director: Tom Debolski

Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders ny@springer sbm.com, or visit http://www.springeronline.com

For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http:// www.apress.com

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales.

The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly

by the information contained in this work

The source code for this book is available to readers at http://www.apress.com

Trang 4

Contents at a Glance

Foreword xiii

About the Authors xv

About the Technical Reviewer xvii

Acknowledgments xix

Introduction xxi

CHAPTER 1 Game Planning and Programming Basics 1

CHAPTER 2 2D Graphics, Audio, and Input Basics 15

CHAPTER 3 Creating Your First 2D Game 39

CHAPTER 4 Improving Your First 2D Game 61

CHAPTER 5 Basics of Game Networking 117

CHAPTER 6 Rock Rain Live! 151

CHAPTER 7 Rock Rain Zune 183

CHAPTER 8 3D Game Programming Basics 199

CHAPTER 9 Rendering Pipeline, Shaders, and Effects 227

CHAPTER 10 Lights, Camera, Transformations! 241

CHAPTER 11 Generating a Terrain 261

CHAPTER 12 Skeletal Animation 299

CHAPTER 13 Creating a Third-Person Shooter Game 337

CHAPTER 14 Closing Words 395

INDEX 399

Trang 5

Contents

Foreword xiii

About the Authors xv

About the Technical Reviewer xvii

Acknowledgments xix

Introduction xxi

CHAPTER 1 Game Planning and Programming Basics 1

Planning the Game 1

Target Market 1

Game Genre 2

The Game Team 2

Game Planning 3

XNA Game Programming Concepts 5

General Game Structure 7

Game Initialization 9

Game Finalization 11

Game Loop 11

Summary 13

CHAPTER 2 2D Graphics, Audio, and Input Basics 15

2D Graphics 15

Common Gaming Terms 15

2D and Screen Coordinate Systems 16

Drawing a Sprite Using XNA 18

Moving the Sprite on the Screen 24

Coding for Collision Detection 26

Game Input 29

Using the Xbox 360 Gamepad 30

Using the Keyboard 31

Using the Mouse 31

Game Audio 32

Creating Audio Content with XACT 32

Using Audio in Games 35

Summary 37

Trang 6

■ I N D E X

user input

keyboard, 31

mouse, 31

overview of, 29

Xbox 360 gamepad, 30–31

using statement, creating object in, 8

V

varying input data, 231

Vector2 class, 18

Vector3 class

Cross method, 243, 245

Lerp method, 249

Vector3 data type

methods of, 205

shortcuts of, 206

vertices and, 201

vectors

3-D games, 205–206

camera coordinate system, 244–246

velocity property (clsSprite class), 24–25

vertex buffer, coding for 3-D axis, 211–215

vertex grid, 6x6, created over x,z plane, 261

vertex processing

AnimatedModel class, 331–333

for normal mapping, 290

vertex shaders

See also techniques

description of, 228

semantics, 231

for terrain effect, 280–281

vertex structures, predefined, 266

VertexBuffer for terrain mesh, 267

VertexPositionNormalTangentBinormalText

ure, defining, 266–267

vertices 3-D games, 201–205 coding for 3-D axis, 211–215 mesh, 266, 324–325

moving triangle up Y axis and, 206 normalizing weights of, 325 representing as matrices, 207 terrains

generating position and texture coordinate, 269–272

normal vector, 272–273 tangent and binormal vectors, 273–275 vibration effect, adding to Rock Rain, 56–57 view matrix, 209, 243–244

viewport, aspect ratio and, 209 Visual C# Express Edition, downloading, 5

W

walking character, animating, 299 Wander method (Enemy class), 376–377 Wandering state (Enemy class), 375–376 wave bank operations (XACT), 33 WaveBank object, 36

web sites Apress, 396 Augusto, Carlos, 366 Entertainment Software Association, 2 image editors, 19

Microsoft Developer Network Platformer Starter Kit example, 16 Psionic, 372

recommended, 396–397 Sharp Games community sites, 396 SpriteLIB GPL, 43

Xbox LIVE Community Games, 126 XNA Creators Club, 5, 397

Trang 7

422 ■ I N D E X

weights of vertex, normalizing, 325

window size, changing, 23

world matrix, 209

World property (BasicEffect class), 222

world transformation, 258

writing custom user data

(AnimatedModelProcessor class), 316–318

X

X (DirectX File) format, 301

XACT (Microsoft Cross-Platform Audio

Creation Tool), 32–34 Xbox 360

gamepad, user input from, 30–31

modifying and deploying Rock Rain to,

57–59 skeletal animation and, 307

Xbox LIVE (Microsoft)

Community Games, 126

profile, creating, 127–131

XNA 3.0 Game Programming Recipes

(Grootjans), 396 XNA Creators Club

Billboards sample, 16

web site, 5, 397

XNA Game Studio, downloading, 5 XNA Game Studio Device Center with Zune added, 196

Z

Zune platform deploying game on, 196–198 menu changes for Rock Rain version for, 187

modifying classes for Rock Rain version for

ActionScene class, 195–196 Game1 class, 193–195 HelpScene class, 186–187 Meteor class, 188–190 MeteorsManager class, 192 Player class, 190–192 PowerSource class, 187–188 StartScene class, 192–193 organizing Rock Rain version for, 184–185 planning Rock Rain version for, 183–184

Ngày đăng: 04/12/2022, 09:34

🧩 Sản phẩm bạn có thể quan tâm