About the Author
Chad Carter, Chief Technology Officer at Robertson Marketing Group, authored the previous edition of this book, Microsoft® XNA™ Unleashed: Graphics and Game Programming for Xbox 360 and Windows. Chad has been writing games and graphics software for more than 15 years.
Excerpt. © Reprinted by permission. All rights reserved.
Many developers became interested in programming because they saw a video game and thought, “How did they do that?” This book helps demystify what is required to make video games. Being able to write games on a next-generation console such as the Xbox 360 has never been an option for the masses before. Now with the XNA Framework, games can be written for the console.
By the end of this book, you will have created four complete games and many demos along the way. This book takes a serious look at performance-related issues when writing games using XNA for Windows and the Xbox 360. Two chapters are devoted to the High Level Shader Language (HLSL), which is a necessity for writing great games. The book covers physics and artificial intelligence (AI). It also covers special effects, including explosions, transitions, and how to create a 3D particle system. It demonstrates how to create a sound project using the Microsoft Cross-Platform Audio Creation Tool (XACT) and how to directly access sound files in a game. Two chapters are devoted to programming games for the Zune. Saving and loading a high score list and creating a full menu system are also taught in this book. Five chapters are devoted to creating multiplayer games. Writing network games can be challenging, and this book covers networking in detail. The final two chapters are on best practices and provide tips on how to sell games on the Xbox LIVE Marketplace. In general, this book contains a great foundation for many topics that need to be learned to create and sell a full-featured single-player or multiplayer game.
Who Should Read This Book?
This book was written for developers. You should have a good understanding of programming in general. The book uses C#, but if you know any modern language, such as C++, Java, or VB.NET, you will have no problem understanding the code in this book. The book assumes some understanding of the Microsoft .NET Framework, which is what the XNA Framework runs on. Without prior experience writing code using the .NET Framework, you might have to do a little research now and then, but should not have trouble getting through this book.
This book was written with a few different audiences in mind. Business application developers who want to use their programming skill set to write computer games are one audience. Graphics and game developers who have been around the OpenGL and DirectX block should also find useful information in this book—especially in seeing how things are done “the XNA way.” The book also targets readers who have some programming experience but have not done anything formal. The book teaches by example. It is written in such a way that if you are not in front of your computer, you can still get valuable information from the book because the code is presented as it is being discussed.
Hardware and Software Requirements
The code in this book is compiled with XNA Game Studio 3.0. In order to complete the games and demos in this book, the requirements that follow must be met.
Supported Operating Systems
The following operating systems are supported:
- Windows XP Home Edition
- Windows XP Professional Edition
- Windows XP Media Center Edition
- Windows XP Tablet Edition
- Windows Vista Home Basic Edition
- Windows Vista Home Premium Edition
- Windows Vista Business Edition
- Windows Vista Enterprise Edition
- Windows Vista Ultimate Edition
Windows XP requires Service Pack 2 or later.
When you run XNA Framework games on Windows, a graphics card that supports Shader Model 1.1 is required. This book has samples that use Shader Model 2.0 and a couple that use Shader Model 3.0. To get the most from this book, you need a graphics card that supports Shader Model 3.0. The graphics card should have the most up-to-date drivers. Updated drivers can be found on the graphics card’s hardware vendor website.
When you run XNA Framework games on the Xbox 360 console, a hard drive must be connected to the console.
All the software required to utilize the XNA Framework on Windows is free:
- Microsoft Visual C# 2005 Express Edition
- Microsoft XNA Game Studio Express
- DirectX 9.0c
Instructions on installing the software can be found in Chapter 1, “Introducing the XNA Framework and XNA Game Studio.”
The source code for the examples in this book can be found on the accompanying CD. Any updates to the code can be downloaded via http://www.samspublishing.com or http://www.xnaessentials.com.
How This Book Is Organized
This book is organized into 11 main parts, representing the information you need to understand to use XNA Game Studio effectively. Writing a book is an interesting challenge. There are basically two routes an author can go. One route is to create small bite-sized pieces that can be used as a reference. The other route is to take the reader on a journey from start to finish, covering important topics along the way but doing it in such a manner that the reader is gradually learning concepts. Then, once the entire book has been enjoyed, the reader can go back and reread certain sections for mastery.
I have tried to take the second approach in writing this book. The book is best read in order. The Internet has a wealth of information. Learning about a particular topic is not difficult. You can easily find information from many different sources on a particular topic. The problem is there is usually no place to see how a lot of different topics work together. With a book that is designed to be read from front to back, the main drawback is a larger time commitment. However, there is usually deeper understanding by the time the task is complete versus the same amount of time spent looking at particular topics on the subject from online tutorials and blog posts. Both are very important, but because a wealth of reference information is available online already, there was no need to make this a reference book.
There was some criticism concerning the order of the first book. This book is not organized in a manner similar to many other books. However, a lot of thought was put into the order of this book. I do believe this book’s order is important, and I did not change it from the first edition. I start with a very basic chapter explaining the history of XNA and very detailed instructions on how to install XNA Game Studio. Most people will not need this, but it is there for those who do. The next chapter jumps right in to talking about the Xbox 360. Even though there are people who do not have an Xbox 360, it is important to put this chapter up front so you can be aware of certain things when creating games using XNA. It is always important to know what you are up against before you start. It is for this same reason that the very next chapter is on performance. Most books simply give a nod to performance in a later chapter or maybe an appendix, if at all. I personally believe that thinking about performance early on is crucial to making a good game. This does not mean we need to do micro-optimizations early in the process; instead, it is all about measurement. This is why performance is discussed so early in the book.
The first real game code that is presented in this book is written for 3D. Many people are shocked that 2D is not discussed until Chapter 9, “2D Basics.” The reason for putting 3D before 2D in this book is because picking up 3D is not any harder than learning 2D. The early chapters are there to introduce you to the XNA Framework as well as the concepts behind a camera. It is my hope to tear down the mental block many people have that 3D is much harder than 2D. Granted, there are some complex topics surrounding 3D, and those are covered later in the book. However, by getting started by drawing models and responding to input, you’ll see there is not a huge difference in the knowledge needed to write 3D games versus 2D games.
After discussing 3D and the Content Pipeline, the book discusses 2D and then moves into two chapters devoted to programming for the Zune. The next part of the book discusses the High Level Shader Language. Physics and artificial intelligence are discussed next. The code for those chapters uses the basic 3D information you will learn in earlier parts the book.
This is followed up by talking about more advanced 3D topics. A single-player 3D game is then built, thus allowing us to put into practice all you will learn in this book.
The next part of the book provides an intensive look at developing multiplayer games. Then the final part of the book discusses some best practices, most of which are done while creating the demos and games throughout the book. The last chapter explains the review process and getting your game into a condition to be sold on the Xbox LIVE Marketplace.
© Copyright Pearson Education. All rights reserved.