Beginning XNA 3.0 Game Programming.pdf
(
7989 KB
)
Pobierz
254106810 UNPDF
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 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
.
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
iii
■
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
v
Plik z chomika:
elrafb
Inne pliki z tego folderu:
User Interfaces with CSharp Windows Forms and Custom Controls.pdf
(22178 KB)
Using and Understanding Java Data Objects.chm
(5797 KB)
Using Microsoft Windows Small Business Server 2003.pdf
(7476 KB)
Virtualization From the Desktop to the Enterprise.chm
(12465 KB)
Visual Basic 2005 Recipes.pdf
(10845 KB)
Inne foldery tego chomika:
Linux Foundation - (LFCS)
Linux Video
O'Reilly
Prasa
Zgłoś jeśli
naruszono regulamin